SA-MP Forums Archive
need help with limited time use command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: need help with limited time use command (/showthread.php?tid=417060)



need help with limited time use command - fireboy - 19.02.2013

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;
        }



Re: need help with limited time use command - CuervO - 19.02.2013

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.


Re: need help with limited time use command - fireboy - 19.02.2013

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