SA-MP Forums Archive
Health - 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)
+--- Thread: Health (/showthread.php?tid=548191)



Health - StR_MaRy - 28.11.2014

What is wrong whit this ? , i want to freeze and send a message to players with 5 or - , why is not working ?

forward DamagedPlayer(playerid);
public DamagedPlayer(playerid)
{
new Float:health;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerHealth(playerid, health);
if(health == 5)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE, "[Medic]: Nu mai ai Viata, Contacteaza un Medic(/call 911).");
}
return 1;
}


Re: Health - HY - 28.11.2014

pawn Код:
forward DamagedPlayer(playerid);
public DamagedPlayer(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if(health < 6)
    {
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, COLOR_WHITE, "[Medic]: Nu mai ai Viata, Contacteaza un Medic(/call 911).");
    }
    return 1;
}



Re: Health - StR_MaRy - 28.11.2014

same is not working uhh


Re: Health - HY - 28.11.2014

Can you be more explicit? Errors when compile...?


Re: Health - StR_MaRy - 28.11.2014

works you need to put it under public othertimer thx rep for trying to help me


Re: Health - Sawalha - 28.11.2014

You have set the function, that's okay, but you forgot the callback which you are gonna use to call this callback:
You can use a timer , or you can use OnPlayerUpdate callback:
pawn Код:
public OnPlayerUpdate(playerid)
{
        new Float:health;
    GetPlayerHealth(playerid, health);
    if(health < 6)
    {
        TogglePlayerControllable(playerid, 0);
        SendClientMessage(playerid, COLOR_WHITE, "[Medic]: Nu mai ai Viata, Contacteaza un Medic(/call 911).");
    }
    return 1;
OnPlayerUpdate is called every second, when player's stats are updated.

EDIT: nvm, late.