SA-MP Forums Archive
OnPlayerUpdate - 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: OnPlayerUpdate (/showthread.php?tid=374554)



OnPlayerUpdate - Gooday - 03.09.2012

Howdy Guys.

pawn Код:
// Other code here...
          SendClientMessage(playerid, COLOR_CRIMSON, "The vehicle engine is totalled.");
         }
    }
    new Float:health;
    GetPlayerHealth(playerid,health);
    if (health < 2.0)
    {
     ApplyAnimation(playerid,"CRACK","crckdeth2",4.0,0,0,0,1,1);
     TogglePlayerControllable(playerid,0);
     GameTextForPlayer(playerid, "~b~Heavily Injured ~n~ ~r~/die ~w~or ~r~/getcurated", 3000, 4);
    }
    return 1;
}
This code is not working, any fixes?


Re: OnPlayerUpdate - Misiur - 03.09.2012

Code is good. Let's debug

pawn Код:
GetPlayerHealth(playerid,health);
printf("Current health: %0.2f. Should happen? %d", health, health < 2.0);



Re: OnPlayerUpdate - Gooday - 03.09.2012

Nope, when I have 1hp I still die


Re: OnPlayerUpdate - Yiin - 03.09.2012

pawn Код:
// global variables:
new Float X[MAX_PLAYERS], Float Y[MAX_PLAYERS], Float Z[MAX_PLAYERS];

OnPlayerDeath()
{
GetPlayerPos( X[pid] Y[pid] Z[pid]);
ClearAnimations(pid);
}
OnPlayerSpawn()
{
SetPlayerPos( X[pid] Y[pid] Z[pid]);
TooglePlayerControllable(false);
ApplyAnimation(smth);
}



Re: OnPlayerUpdate - Gooday - 03.09.2012

Nope, not working.


Re: OnPlayerUpdate - GtasaPoliceModz - 05.09.2012

Код:
    
if (health < 10.0)
    {
     ApplyAnimation(playerid,"CRACK","crckdeth2",4.0,0,0,0,1,1);
     TogglePlayerControllable(playerid,0);
     GameTextForPlayer(playerid, "~b~Heavily Injured ~n~ ~r~/die ~w~or ~r~/getcurated", 3000, 4);
    }