SA-MP Forums Archive
Drugs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Drugs (/showthread.php?tid=560352)



Drugs - nezo2001 - 28.01.2015

Here is one command from my drugs system
PHP код:
CMD:takeweed(playeridparams[])
{
    new 
string[128];
    new 
amount;
    new 
Float:health;
    new 
drunk GetPlayerDrunkLevel(playerid);
    if(
sscanf(params"i"amount)) return SendClientMessage(playeridCOLOR_RED"Take weed: /takeweed [Amount]");
    if(
weed[playerid] < amount) return SendClientMessage(playeridCOLOR_RED"You don't have enough weed");
    
weed[playerid] -= amount;
    if(
amount =< 0) return SendClientMessage(playeridCOLOR_RED"You don't have enough weed ");
    if(
amount 25)
    {
    
SetPlayerHealth(playerid,health10);
    
SetPlayerDrunkLevel(playeriddrunk+1000);
    }
    if(
amount 25 && amount 50)
    {
    
SetPlayerDrunkLevel(playeriddrunk+4000);
    
SetPlayerHealth(playeridhealth 20);
    }
    if(
amount 50 && amount 75)
    {
    
SetPlayerDrunkLevel(playeriddrunk+6000);
    
SetPlayerHealth(playeridhealth 30);
    }
    if(
amount 75 && amount <= 100)
    {
    
SetPlayerHealth(playeridhealth 40);
    
SetPlayerDrunkLevel(playeriddrunk+10000);
    }
    if(
amount 100)
    {
    
SetPlayerHealth(playeridhealth 50);
    
SetPlayerDrunkLevel(playeriddrunk+150000);
    }
    if(
drunk 49999)
    {
    
SetPlayerHealth(playerid0);
    
SendClientMessage(playeridCOLOR_RED"Wow ! Don't drink so much.");
    }
    
format(string,sizeof(string),"You had take %i gram of weed"amount);
    
SendClientMessage(playeridCOLOR_GREENstring);
    return 
1;

When i take weed it set my drunk level but doesn't change me health !
Please Help !!


Re: Drugs - GGW - 28.01.2015

add

pawn Код:
GetPlayerHealth(playerid,health);
with

pawn Код:
new Float:health;
so it be like this :

pawn Код:
new Float:health;
GetPlayerHealth(playerid,health);



Re: Drugs - nezo2001 - 28.01.2015

Nothing


Re: Drugs - GGW - 28.01.2015

Then Remove :

pawn Код:
new Float:health;
GetPlayerHealth(playerid,health);
_________________________________________________

and change :

pawn Код:
SetPlayerHealth(playerid, health + 20);
To

pawn Код:
SetPlayerHealth(playerid,GetPlayerHealth(playerid)+20);



Re: Drugs - nezo2001 - 28.01.2015

Thank You rep+