13.07.2013, 15:46
I'm not really sure, but I'll give it a try.
If you want it that you use /td amount of drugs name, I will make you another code for it
But I think this will help ^
pawn Код:
CMD:td(playerid,params[])//creating a use weed cmd.
{
if(PlayerInfo[playerid][drugs] > 0)//this will check if the player has the weed or not.
{
new Float:Health;//the variable which will store player's health.
GetPlayerHealth(playerid, Health);//this will get player's health and store it in the variable Health.(new Float:Health).
SetPlayerHealth(playerid, Health +20);//this will add 20+ health to player's current health.
PlayerInfo[playerid][drugs] -= 1;//this will minus player's amount of weed because he used some of it.
SetTimerEx("Usedrugs", 10000, false, "d", playerid);//setting timer for the player for like 10 seconds.
SendClientMessage(playerid, -1, "You are smoking 1 gram.");//this will send the player a message that he use one gram of weed.
}
else
{
SendClientMessage(playerid, -1, "You don't have any drugs.");//this error message will appear if he does not have weed to use.
return 1;
}
return 1;
}
