[HELP] /usedrug
#1

Quote:

if(strcmp(cmdtext, "/usedrug", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pDrugs] > 0)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health + 15.0);
SendClientMessage(playerid, COLOR_GREY, " 1 gram drug used !");
PlayerInfo[playerid][pDrugs] -= 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You dont have any drug grams left !");
}
return 1;
}

}

The problem is they can get more then +150 health by using /usedrugs more times how to make it max. to 150 health ? and it should show a message that he have enaugh for now

Pls help
Thanks
Reply
#2

Put the following after "new Float:health;"

Код:
if(GetPlayerHealth(playerid,health) >= 150)
{
SendClientMessage(playerid,0xAA3333AA,"You have enough for now.");
return 2;
}
Reply
#3

Quote:
Originally Posted by Houstin_Trint
Put the following after "new Float:health;"

Код:
if(GetPlayerHealth(playerid,health) >= 150)
{
SendClientMessage(playerid,0xAA3333AA,"You have enough for now.");
return 2;
}
Return 2? I assumed you typo'd? Use return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)