27.08.2016, 18:00
I'm trying to place a cooldown timer on this command, is anyone able to help?
Код:
CMD:cupgrade(playerid, params[])
{
new string[1024];
if(PlayerInfo[playerid][pCPlan] == 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You have already purchased this upgrade!");
return 1;
}
if(PlayerInfo[playerid][pCPlan] == 0)
{
if(GetPlayerCash(playerid) < 1499)
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You must have enough money (1500$) to purchase this upgrade!");
return 1;
}
else if(PlayerInfo[playerid][pPnumber] >= 1)
{
SendClientMessageEx(playerid, COLOR_YELLOW, "SMS: Thank you for upgrading!, Sender: Phones&U");
RingTone[playerid] = 20;
PlayerInfo[playerid][pCPlan] += 1;
new randphone = 1000 + random(9999);//minimum 1000 max 9999
ReplacePH(PlayerInfo[playerid][pPnumber], randphone);
PlayerInfo[playerid][pPnumber] = randphone;
format(string, sizeof(string), "Your number has been changed, your new phone number is %d.", randphone);
SendClientMessageEx(playerid, COLOR_GRAD4, string);
SetPVarInt(playerid, "CellCooledDown", 1);
SetTimerEx("CellCooldown", 3600000, 0, "i", playerid);
GivePlayerCash(playerid, -1500);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You need to purchase a phone before upgrading!");
return 1;
}
}
return 1;
}
Код:
forward CellCooldown(playerid);
public CellCooldown(playerid)
{
SetPVarInt(playerid, "CellCooledDown", 1);
return 1;
}

