SA-MP Forums Archive
PLayer ID Undefined under this callback? Any alternatives? - 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: PLayer ID Undefined under this callback? Any alternatives? (/showthread.php?tid=270832)



PLayer ID Undefined under this callback? Any alternatives? - Shockey HD - 21.07.2011

For my HealthCheck,

Код:
forward HealthCheck();
public HealthCheck()
{
    for(new i=0; i<MAX_PLAYERS; i++){
        if(IsPlayerConnected(i)){
            new Float:Health;
            GetPlayerHealth(i, Health);
            if(Health < 10){
                SetPlayerSkin(playerid,137);
            }
        }
    }
}
I get the Playerid is underfined. Is there a way around this? the plan is, Checks if players health is 10 or below, and if so, it will change the skin.


Re: PLayer ID Undefined under this callback? Any alternatives? - MadeMan - 21.07.2011

pawn Код:
SetPlayerSkin(i,137);



Re: PLayer ID Undefined under this callback? Any alternatives? - =WoR=Varth - 22.07.2011

pawn Код:
forward HealthCheck(playerid);

public HealthCheck(playerid)
{
    new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 10) SetPlayerSkin(playerid,137);
    return 1;
}