28.01.2015, 10:15
Here is one command from my drugs system
When i take weed it set my drunk level but doesn't change me health !
Please Help !!
PHP код:
CMD:takeweed(playerid, params[])
{
new string[128];
new amount;
new Float:health;
new drunk = GetPlayerDrunkLevel(playerid);
if(sscanf(params, "i", amount)) return SendClientMessage(playerid, COLOR_RED, "Take weed: /takeweed [Amount]");
if(weed[playerid] < amount) return SendClientMessage(playerid, COLOR_RED, "You don't have enough weed");
weed[playerid] -= amount;
if(amount =< 0) return SendClientMessage(playerid, COLOR_RED, "You don't have enough weed ");
if(amount < 25)
{
SetPlayerHealth(playerid,health+ 10);
SetPlayerDrunkLevel(playerid, drunk+1000);
}
if(amount > 25 && amount < 50)
{
SetPlayerDrunkLevel(playerid, drunk+4000);
SetPlayerHealth(playerid, health + 20);
}
if(amount > 50 && amount < 75)
{
SetPlayerDrunkLevel(playerid, drunk+6000);
SetPlayerHealth(playerid, health + 30);
}
if(amount > 75 && amount <= 100)
{
SetPlayerHealth(playerid, health + 40);
SetPlayerDrunkLevel(playerid, drunk+10000);
}
if(amount > 100)
{
SetPlayerHealth(playerid, health + 50);
SetPlayerDrunkLevel(playerid, drunk+150000);
}
if(drunk > 49999)
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, COLOR_RED, "Wow ! Don't drink so much.");
}
format(string,sizeof(string),"You had take %i gram of weed", amount);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
Please Help !!