Issue with SetPlayerHealth to parameter (y_commands)
#5

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
hp[3] is already an integer :P.

Anyway, just change
pawn Код:
SetPlayerHealth(playerid, hp[3]);
To

pawn Код:
SetPlayerHealth(playerid, floatstr(hp));
It might also be good if you checked the float value first .
Yeah, this works like a charm!
Here is the final code if that will help anyone out in the futuuure:
pawn Код:
//===[Set Health]===
YCMD:sethp(playerid, hp[], help)
{
    if (help)
    {
        SendClientMessage(playerid, 0xFF0000AA, "Set the player health to wanted number");
    }
    else
    {
        SetPlayerHealth(playerid, floatstr(hp)); //anything not a number above 1 seems to kill you, a check above here is probably a good idea!
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)