Limit a 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Limit a command (
/showthread.php?tid=127999)
Limit a command -
XeoN_13 - 15.02.2010
Hello everybody, I am making this post so that someone could help me. I have a command and i would like to add something that makes it only usable per player per ten seconds , im doing this because players abuse of the command and i would whant to add something that can make the command only usable once every ten seconds or so.
the command looks like this:
Код:
if(strcmp(cmd, "/sync", true) == 0) {
if(IsPlayerInAnyVehicle(playerid)){
SendClientMessage(playerid, COLOR_YELLOW, "Canot use this while in veh");
return 1;
}
SpawnPlayer(playerid);
return 1;
}
Re: Limit a command -
acade - 15.02.2010
Try using a timer for it
Re: Limit a command -
SlashPT - 16.02.2010
on top of script
Код:
new time[MAX_PLAYERS], timetimer;
forward 10sec(playerid);
Код:
if(strcmp(cmd, "/sync", true) == 0)
{
if(time[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "You have to wait 10 secounds before use this cmd again");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_YELLOW, "Canot use this while in veh");
return 1;
}
SpawnPlayer(playerid);
timetimer = SetTimer("10sec", 10*1000, 0);
time[playerid] = 1;
return 1;
}
public 10sec(playerid)
{
time[playerid] = 0;
}
meh dont tested hope it works... xD