21.02.2013, 22:39
(
Последний раз редактировалось Ananisiki; 15.12.2013 в 17:25.
)
^^^^^^^^
CMD:ad(playerid, params[])
{
if(GetPVarInt(playerid,"PillsTaken")>0)
{
return 1;//player has used the command already
}
SetPVarInt(playerid,"PillsTaken",1);//this line becomes obsolete, as soon you want to limit each player to more than 1 /ad. then you will like this:
//SetPVarInt(playerid,"PillsTaken",GetPVarInt(playerid,"PillTaken")+1);
new Float:health;GetPlayerHealth(playerid,health);
if(isDead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(health >= 100) return SendClientMessage(playerid, COLOR_RED, "Your Health Is Already Full, You Cannot Take /ad.");
if(iCanUse[playerid]-gettime() > 0) return SendClientMessage(playerid, COLOR_RED, "Please Wait Before Taking Another Adrenaline Pill.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Taken An Adrenaline Pill.");
SetPlayerHealth(playerid, 100.0);
{
iCanUse[playerid] = gettime() + 5; // 10 seconds
}
return 1;
}
public OnPlayerSpawn(playerid){
SetPVarInt(playerid,"PillsTaken",1);//simply add that line into the callback
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You Have Taken An Adrenaline Pill.");
return 1;