Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×
  • 0

Question

Posted

Salut am si eu o problema, era ora 21 la ora 20 a mers comanda /attack dar la ora 21 nu imi functioneaza, ea ar trebuii sa mearga pana la 22.. Dar nu ii dau de cap putin ajutor??

 

Spoiler

CMD:attack(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    new hour,minn,sec;
    gettime(hour,minn,sec);
    if(IsPlayerConnected(playerid))
    {
        if(!IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"You are not a member of a mafia.");
        if(PlayerInfo[playerid][pRank] < 4) return SCM(playerid,COLOR_WHITE,"You don't have rank 4.");
        if(GetWeekDay() == 1 || GetWeekDay() == 6 || GetWeekDay() == 6) return SendClientMessage(playerid, COLOR_WHITE, "War-ul este permis doar Luni, Miercuri, Vineri si Duminica.");
        if(hour == 20 || hour == 22)
        {
            new turf,faction,string[128],sendername[MAX_PLAYER_NAME];
            for(new i = 1; i <= sizeof(TurfInfo); i++)
            {
                if(IsPlayerInTurf(playerid, i) == 1)
                {
                    turf = i;
                    break;
                }
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(turf == 0) return SCM(playerid, COLOR_WHITE, "You are not on a turf.");
            if(DeelayWar[PlayerInfo[playerid][pMember]] > 0)
            {
                format(string,sizeof(string),"Your mafia can attack another turf in %d seconds.",DeelayWar[PlayerInfo[playerid][pMember]]);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            faction = PlayerInfo[playerid][pMember];
            if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, COLOR_WHITE, "You can't attack your own turf.");
            if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, COLOR_WHITE, "Turf is already attacked.");
            if(InWar[faction] == 1) return SCM(playerid, COLOR_WHITE, "You have an active war.");
            if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, COLOR_WHITE, "This mafia have active war.");
            new memberss;
            foreach(Player, i)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[pMember] == TurfInfo[turf][zOwned])
                    {
                        memberss ++;
                    }
                }
            }
            if(memberss < 1) return SCM(playerid, COLOR_WHITE, "This mafia don't have members online.");
            WarInfo[turf][wTime] = 1200;
            WarInfo[turf][wAttacker] = faction;
            WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
            format(string,sizeof(string),"[TURF] %s from your group attacked turf %d (owned by %s).",sendername,turf,NumeFactiune(TurfInfo[turf][zOwned]));
            SendFamilyMessage(faction,COLOR_GREEN,string);
            format(string,sizeof(string),"[TURF] %s from %s attacked turf %d owned by you.",sendername,NumeFactiune(WarInfo[turf][wAttacker]),turf);
            SendFamilyMessage(TurfInfo[turf][zOwned],COLOR_GREEN,string);
            mysql_query(SQL, "SELECT * FROM wars");
            mysql_store_result(); 
            new warid = mysql_num_rows() + 1; 
            mysql_free_result();
            format(string, sizeof(string),"[WAR] %s started a war with %s (war id: %d).",NumeFactiune(WarInfo[turf][wAttacker]),NumeFactiune(TurfInfo[turf][zOwned]),warid);
            foreach(Player, i)
            {
                if(PlayerInfo[pMember] == TurfInfo[turf][zOwned] || PlayerInfo[pMember] == WarInfo[turf][wAttacker])
                {
                    SetPlayerVirtualWorld(i, 1024);
                    SendClientMessage(i, COLOR_YELLOW, "Ai fost teleportat intr-un Virtual World unde sunt prezenti doar jucatorii ce participa la war.");
                }
            }
            if(WarInfo[turf][wAttacker] == 4 || TurfInfo[turf][zOwned] == 4)
            {
                for(new veh; veh < sizeof(Aztecasc); veh++)
                {
                    SetVehicleVirtualWorld(Aztecasc[veh], 1024);
                }
            }
            if(WarInfo[turf][wAttacker] == 5 || TurfInfo[turf][zOwned] == 5)
            {
                for(new veh; veh < sizeof(Grovec); veh++)
                {
                    SetVehicleVirtualWorld(Grovec[veh], 1024);
                }
            }
            if(WarInfo[turf][wAttacker] == 6 || TurfInfo[turf][zOwned] == 6)
            {
                for(new veh; veh < sizeof(Vagosc); veh++)
                {
                    SetVehicleVirtualWorld(Vagosc[veh], 1024);
                }
            }
            if(WarInfo[turf][wAttacker] == 10 || TurfInfo[turf][zOwned] == 10)
            {
                for(new veh; veh < sizeof(Ballasc); veh++)
                {
                    SetVehicleVirtualWorld(Ballasc[veh], 1024);
                }
            }
            new y,m,d,h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            worstscoreat[turf] = 0;
            worstmemberat[turf] = 999;
            bestscoreat[turf] = 0;
            bestmemberat[turf] = 999;
            worstscoredf[turf] = 0;
            worstmemberdf[turf] = 999;
            bestscoredf[turf] = 0;
            bestmemberdf[turf] = 999;
            InWar[TurfInfo[turf][zOwned]] = 1;
            InWar[faction] = 1;
            waitwar[faction] = 60;
        }
        else return SCM(playerid,COLOR_WHITE,"War must be between 20:00 and 22:00.");
    }
    return 1;
}

 

2 answers to this question

Recommended Posts

  • 0
Posted
Acum 2 ore, Bogdan1 a spus:

Salut am si eu o problema, era ora 21 la ora 20 a mers comanda /attack dar la ora 21 nu imi functioneaza, ea ar trebuii sa mearga pana la 22.. Dar nu ii dau de cap putin ajutor??

 

  Ascunde conținuturi

CMD:attack(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    new hour,minn,sec;
    gettime(hour,minn,sec);
    if(IsPlayerConnected(playerid))
    {
        if(!IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"You are not a member of a mafia.");
        if(PlayerInfo[playerid][pRank] < 4) return SCM(playerid,COLOR_WHITE,"You don't have rank 4.");
        if(GetWeekDay() == 1 || GetWeekDay() == 6 || GetWeekDay() == 6) return SendClientMessage(playerid, COLOR_WHITE, "War-ul este permis doar Luni, Miercuri, Vineri si Duminica.");
        if(hour == 20 || hour == 22)
        {
            new turf,faction,string[128],sendername[MAX_PLAYER_NAME];
            for(new i = 1; i <= sizeof(TurfInfo); i++)
            {
                if(IsPlayerInTurf(playerid, i) == 1)
                {
                    turf = i;
                    break;
                }
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(turf == 0) return SCM(playerid, COLOR_WHITE, "You are not on a turf.");
            if(DeelayWar[PlayerInfo[playerid][pMember]] > 0)
            {
                format(string,sizeof(string),"Your mafia can attack another turf in %d seconds.",DeelayWar[PlayerInfo[playerid][pMember]]);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            faction = PlayerInfo[playerid][pMember];
            if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, COLOR_WHITE, "You can't attack your own turf.");
            if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, COLOR_WHITE, "Turf is already attacked.");
            if(InWar[faction] == 1) return SCM(playerid, COLOR_WHITE, "You have an active war.");
            if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, COLOR_WHITE, "This mafia have active war.");
            new memberss;
            foreach(Player, i)
            {
                if(IsPlayerConnected(i))
                {
                    if(PlayerInfo[pMember] == TurfInfo[turf][zOwned])
                    {
                        memberss ++;
                    }
                }
            }
            if(memberss < 1) return SCM(playerid, COLOR_WHITE, "This mafia don't have members online.");
            WarInfo[turf][wTime] = 1200;
            WarInfo[turf][wAttacker] = faction;
            WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
            format(string,sizeof(string),"[TURF] %s from your group attacked turf %d (owned by %s).",sendername,turf,NumeFactiune(TurfInfo[turf][zOwned]));
            SendFamilyMessage(faction,COLOR_GREEN,string);
            format(string,sizeof(string),"[TURF] %s from %s attacked turf %d owned by you.",sendername,NumeFactiune(WarInfo[turf][wAttacker]),turf);
            SendFamilyMessage(TurfInfo[turf][zOwned],COLOR_GREEN,string);
            mysql_query(SQL, "SELECT * FROM wars");
            mysql_store_result(); 
            new warid = mysql_num_rows() + 1; 
            mysql_free_result();
            format(string, sizeof(string),"[WAR] %s started a war with %s (war id: %d).",NumeFactiune(WarInfo[turf][wAttacker]),NumeFactiune(TurfInfo[turf][zOwned]),warid);
            foreach(Player, i)
            {
                if(PlayerInfo[pMember] == TurfInfo[turf][zOwned] || PlayerInfo[pMember] == WarInfo[turf][wAttacker])
                {
                    SetPlayerVirtualWorld(i, 1024);
                    SendClientMessage(i, COLOR_YELLOW, "Ai fost teleportat intr-un Virtual World unde sunt prezenti doar jucatorii ce participa la war.");
                }
            }
            if(WarInfo[turf][wAttacker] == 4 || TurfInfo[turf][zOwned] == 4)
            {
                for(new veh; veh < sizeof(Aztecasc); veh++)
                {
                    SetVehicleVirtualWorld(Aztecasc[veh], 1024);
                }
            }
            if(WarInfo[turf][wAttacker] == 5 || TurfInfo[turf][zOwned] == 5)
            {
                for(new veh; veh < sizeof(Grovec); veh++)
                {
                    SetVehicleVirtualWorld(Grovec[veh], 1024);
                }
            }
            if(WarInfo[turf][wAttacker] == 6 || TurfInfo[turf][zOwned] == 6)
            {
                for(new veh; veh < sizeof(Vagosc); veh++)
                {
                    SetVehicleVirtualWorld(Vagosc[veh], 1024);
                }
            }
            if(WarInfo[turf][wAttacker] == 10 || TurfInfo[turf][zOwned] == 10)
            {
                for(new veh; veh < sizeof(Ballasc); veh++)
                {
                    SetVehicleVirtualWorld(Ballasc[veh], 1024);
                }
            }
            new y,m,d,h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            worstscoreat[turf] = 0;
            worstmemberat[turf] = 999;
            bestscoreat[turf] = 0;
            bestmemberat[turf] = 999;
            worstscoredf[turf] = 0;
            worstmemberdf[turf] = 999;
            bestscoredf[turf] = 0;
            bestmemberdf[turf] = 999;
            InWar[TurfInfo[turf][zOwned]] = 1;
            InWar[faction] = 1;
            waitwar[faction] = 60;
        }
        else return SCM(playerid,COLOR_WHITE,"War must be between 20:00 and 22:00.");
    }
    return 1;
}

 

Verifici daca ora este 20 sau 22 aici if(hour == 20 || hour == 22) si daca e adevarat "executi" comanda /atack. Poti face asa  if(hour >= 20 && hour <= 22) sau  if(hour == 20 || hour == 22 || hour == 21)

  • 0
Posted
On 3/25/2018 at 11:51 PM, valivaly96 said:

Verifici daca ora este 20 sau 22 aici if(hour == 20 || hour == 22) si daca e adevarat "executi" comanda /atack. Poti face asa  if(hour >= 20 && hour <= 22) sau  if(hour == 20 || hour == 22 || hour == 21)

Solved, THX.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.