PDA

View Full Version : Drugs


nezo2001
28/01/2015, 10:15 AM
Here is one command from my drugs system
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;
}
When i take weed it set my drunk level but doesn't change me health !
Please Help :D !!

GGW
28/01/2015, 11:02 AM
add

GetPlayerHealth(playerid,health);

with

new Float:health;

so it be like this :

new Float:health;
GetPlayerHealth(playerid,health);

nezo2001
28/01/2015, 11:17 AM
Nothing

GGW
28/01/2015, 11:48 AM
Then Remove :

new Float:health;
GetPlayerHealth(playerid,health);

_________________________________________________

and change :

SetPlayerHealth(playerid, health + 20);

To

SetPlayerHealth(playerid,GetPlayerHealth(playerid) +20);

nezo2001
28/01/2015, 11:54 AM
Thank You rep+