23.10.2015, 07:56
PHP код:
new CanArmor[MAX_PLAYERS],timer[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
timer[playerid] = SetTimerEx("CanArmorTimer",60000,0,"i",playerid); // How long before you can /armor
CanArmor[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
KillTimer(timer[playerid]);
return 1;
}
forward CanArmorTimer(playerid);
public CanArmorTimer(playerid)
{
SendClientMessage(playerid, -1, "You can now buy armor!(/Armor)");
CanArmor[playerid] = 1;
}
CMD:armor(playerid,params[])
{
if(CanArmor[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREEN, "You have bought extra armor!");
SetPlayerArmour(playerid, 100);
CanArmor[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You can not buy extra armor yet!");
}
return 1;
}
PHP код:
timer[MAX_PLAYERS];
timer[playerid] = SetTimerEx(....);
KillTimer(timer[playerid);
