how to script when player used command and he must wait untill .... - 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: how to script when player used command and he must wait untill .... (
/showthread.php?tid=119089)
how to script when player used command and he must wait untill .... -
gozo12 - 06.01.2010
hi .how to script this
Example : when player used /s command and he talked with it ..
then when he wants to use /s again a msg showed at his screens and say You must
wait affter 20 Sec To use /s again .
Re: how to script when player used command and he must wait untill .... -
GTAguillaume - 06.01.2010
Код:
new bool:bool[MAX_PLAYERS]
Код:
if (strcmp("/s", cmdtext, true) == 0)
{
if(bool[playerid] == true) return SendClientMessage(playerid, COLOR_RED,"You need to wait 40 seconds");
//....
bool[playerid] = true;
SetTimerEx("usecmd",40*1000,0,"i",playerid);
}
Код:
forward usecmd(playerid);
public usecmd(playerid)
{
bool = false
}
Re: how to script when player used command and he must wait untill .... -
jamesb93 - 06.01.2010
Hmm,
Just make it call a timer:
Under OnPlayerConnect
Then Just make the command and check if UsedS is = 1, Else send them a message saying they cant do it
pawn Код:
dcmd_s(playerid, params[])
{
if(UsedS[playerid] == 1) return SendClientMessage(playerid, COLOR_YELLOW, "You Must Wait 20 Secs);
else
{
//Stuff In Here
UsedS[giveplayerid] = 1; //Setting it to 1
SetTimerEx("STimer",20000,0,"i",playerid); //Setting A Timer
return 1;
}
return 1;
}
}
pawn Код:
forward STimer
public STimer(playerid);
{
UsedS[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "You Can Use /s Now");
return 1;
}
Re: how to script when player used command and he must wait untill .... -
Damon_Black - 06.01.2010
Does that save a bunch of CPU, *****?
I'm familiarizing myself with new functions as I took a coding hiatus. My server has some CPU issues when we hit 40 players so I'd love to remove the timers.
Re: how to script when player used command and he must wait untill .... -
gozo12 - 07.01.2010
Quote:
Originally Posted by ŚĂĞĔ
Hmm,
Just make it call a timer:
Under OnPlayerConnect
Then Just make the command and check if UsedS is = 1, Else send them a message saying they cant do it
pawn Код:
dcmd_s(playerid, params[]) { if(UsedS[playerid] == 1) return SendClientMessage(playerid, COLOR_YELLOW, "You Must Wait 20 Secs); else { //Stuff In Here
UsedS[giveplayerid] = 1; //Setting it to 1 SetTimerEx("STimer",20000,0,"i",playerid); //Setting A Timer return 1; } return 1; } }
pawn Код:
forward STimer
public STimer(playerid); { UsedS[playerid] = 0; SendClientMessage(playerid, COLOR_YELLOW, "You Can Use /s Now"); return 1; }
|
Thanks BUT what is this warring
Код:
warning 203: symbol is never used: "UsedS"
Re: how to script when player used command and he must wait untill .... -
Deat_Itself - 07.01.2010
Код:
forward STimer();
public STimer(playerid)
Re: how to script when player used command and he must wait untill .... -
jamesb93 - 07.01.2010
Sorry,
Suppsoed to be