timer help - 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: timer help (
/showthread.php?tid=228315)
timer help -
tanush - 19.02.2011
can i make a cmd like forexample "buyhealth". if an person used it once they have to wwait 10minute again. HOW I DO THAT??
Re: timer help -
xRyder - 19.02.2011
First you need to make and array for a player.
pawn Код:
new UsedHealth[MAX_PLAYERS] = 0;
Than you make a command what will give you health and start a timer.
pawn Код:
COMMAND:buyhealth(playerid, params[])
{
if(UsedHealth[playerid] == 0)
{
SetPlayerHealth(playerid, 100.0);
UsedHealth[playerid] = 1;
SendClientMessage(playerid, YourCOLOR, "Your health has been set to 100.");
SetTimerEx("BoughtHealth",600000, false, "i", playerid);
}
else return SendClientMessage(playerid, YourCOLOR, "You need to wait for 10 minutes to buy health again");
return 1;
}
And then you make what will happen when timer finishes.
pawn Код:
forward BoughtHealth(playerid);
public BoughtHealth(playerid)
{
UsedHealth[playerid] = 0;
return 1;
}
Re: timer help -
tanush - 19.02.2011
umm what is 600000 in SetTimerEx("BoughtHealth",600000, false, "i", playerid);, i wanna do a quick 10sec test first and please tell where i add
pawn Код:
forward BoughtHealth(playerid);
public BoughtHealth(playerid)
{
UsedHealth[playerid] = 0;
return 1;
}
Re: timer help -
xRyder - 19.02.2011
What is 6x10^5 you can find
here = TIME!
Just replace the time(6x10^5) with your time in your SetTimerEx function.
Re: timer help -
Mokerr - 19.02.2011
SetTimerEx("BoughtHealth",600000, false, "i", playerid);
Boughthealth = Name of function.
60000 = Miliseconds (1 minute in this case)
false = Do you want it to repeat. (in this case false, which means NO).
i = values.
Re: timer help -
tanush - 19.02.2011
pawn Код:
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Timer.pwn(88) : error 055: start of function body without function header
D:\Users\Tanush\Desktop\SA-MP\filterscripts\Timer.pwn(90) : error 010: invalid function or declaration
Help please i get this with
pawn Код:
forward BoughtHealth(playerid);
public BoughtHealth(playerid);
{
UsedHealth[playerid] = 0;
return 1;
}
Re: timer help -
xRyder - 19.02.2011
pawn Код:
public BoughtHealth(playerid)
{
}
With out the ';'.
Re: timer help -
tanush - 19.02.2011
thanks ryder