SA-MP Forums Archive
[HELP] /usedrug - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] /usedrug (/showthread.php?tid=75532)



[HELP] /usedrug - ArTisT - 02.05.2009

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


Re: [HELP] /usedrug - Houstin_Trint - 24.01.2010

Put the following after "new Float:health;"

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



Re: [HELP] /usedrug - Devine - 24.01.2010

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;