#1

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 !!
Reply
#2

add

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

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

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

Nothing
Reply
#4

Then Remove :

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

and change :

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

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

Thank You rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)