GetPlayerHealth? Confused.
#1

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

I suppose if he says argument 1, he means id but i cant find the error neither :/ strange..
Reply
#3

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.
Reply
#4

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

lol don't use strtok...
Reply
#6

Im using it with dcmd to get more than 1 param
Reply
#7

use sscanf then -.- its faster, alot of params..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)