GetPlayerHealth? Confused. - 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: GetPlayerHealth? Confused. (
/showthread.php?tid=179598)
GetPlayerHealth? Confused. -
Ash. - 27.09.2010
Can somebody give me some help with GetPlayerHealth
Here's the problem. I try and compile my script, everythings fine, apart from this:
pawn Код:
new Float:pHealth;
GetPlayerHealth(id, pHealth);
SetPlayerHealth(id, pHealth - 10);
The error is:
Код:
C:\Documents and Settings\Ash B Funky\Desktop\Trucking World Server Project Files\filterscripts\admin.pwn(99) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Ash B Funky\Desktop\Trucking World Server Project Files\filterscripts\admin.pwn(100) : error 035: argument type mismatch (argument 1)
I dont get it, it worked on my other script that i compiled yesterday.
Re: GetPlayerHealth? Confused. -
Mike_Peterson - 27.09.2010
I suppose if he says argument 1, he means id but i cant find the error neither :/ strange..
Re: GetPlayerHealth? Confused. -
nepstep - 27.09.2010
I think you wanna give the player -10 to his life, try this function for a sure result:
At the end of your script:
pawn Код:
stock GivePlayerHealth(playerid,Float:Health)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health+Health);
}
At where you want to give -10 on the life:
pawn Код:
GivePlayerHealth(playerid,-10);
You can change the arguments (playerid,health) to your own (id,pHealth)
Let me now if this works.
Re: GetPlayerHealth? Confused. -
Ash. - 27.09.2010
Ah, i found it - im using dcmd, and strtok to split up 2 params.I forgot to do strval(id) instead of just id - my bad

- it tends to happen when you're really really really tired xD
Thanks Anyways
Ash!
Re: GetPlayerHealth? Confused. -
legodude - 27.09.2010
lol don't use strtok...
Re: GetPlayerHealth? Confused. -
Ash. - 27.09.2010
Im using it with dcmd to get more than 1 param
Re: GetPlayerHealth? Confused. -
Mike_Peterson - 27.09.2010
use sscanf then -.- its faster, alot of params..