need help with limited time use command
#1

hello, i created a command which players can use to throw other players in the sky one time in hour, but when it's once used, then other players can't use it, but this command should be for each player in one hour(sorry, my english is terrible, i mean each player cant use it in one hour). Can somebody fix this? big thanks.

pawn Код:
if (strcmp(cmd, "/fu", true)==0)
        {
        if(GetPlayerScore(playerid) > 18) return SendClientMessage(playerid,0xC0C0C0C8,"Tev vajadzīgs 18. Līmenis lai lietotu љo komandu!");
        new Float:fuX, Float:fuY, Float:fuZ;
        tmp=strtok(cmdtext, idx);
        if(!strlen(tmp))return SendClientMessage(playerid,0xC0C0C0C8,"Lieto:/fu [ID]!");
        if(fuizlietots == 1) return SendClientMessage(playerid, 0xFFFFFF55, "Љī iespēja vēl nav atjaunojusies!");
                new id = strval(tmp);
                new metejs[MAX_PLAYER_NAME];
                new metamais[MAX_PLAYER_NAME];
                new mashina1;
                new eString1[32];
                new targetid;
                targetid = strval(tmp);
                mashina1 = GetPlayerVehicleID(playerid);
                GetPlayerName(playerid,metejs,sizeof(metamais));
                GetPlayerName(targetid,metamais,sizeof(metejs));
                GetPlayerPos(targetid, fuX,fuY,fuZ);
                {
                if(fuizlietots == 0)
                {
                if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xC0C0C0C8,"Spēlētājs nav on!");
                if(GetPlayerMoney(playerid) < 100000) return SendClientMessage(playerid,0xC0C0C0C8,"Tev nav pietiekami daudz naudas lai veiktu љo komandu!");
                if(IsPlayerInVehicle(targetid, mashina1))
                    RemovePlayerFromVehicle(targetid);
                    SetPlayerPos(targetid,fuX +50,fuY+50,fuZ +200);
                    GivePlayerMoney(playerid,-100000);
                    format(eString1, sizeof(eString1), "Tu uzlidināji gaisā %s.",metamais);
                    SendClientMessage(playerid, 0xFFFFFF55, eString1);
                    format(eString1, sizeof(eString1), " %s Tevi uzlidināja gaisā.",metejs);
                    SendClientMessage(targetid, 0xFFFFFF55, eString1);
                    fuizlietots = 1;
                    SetTimerEx("fuaktivs", 600000, 0, "i", playerid);
                    }
        }
        return 1;
        }
Reply
#2

You need to declare a per-player global variable for it to affect one player; either use a PVar or increase the size of the variable you've already created, since right now it is only a global variable which is equal to everyone as it only haves one address.
Reply
#3

can you say some examples, how i should do it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)