timer help
#1

can i make a cmd like forexample "buyhealth". if an person used it once they have to wwait 10minute again. HOW I DO THAT??
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

What is 6x10^5 you can find here = TIME!
Just replace the time(6x10^5) with your time in your SetTimerEx function.
Reply
#5

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.
Reply
#6

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

pawn Код:
public BoughtHealth(playerid)
{

}
With out the ';'.
Reply
#8

thanks ryder
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)