09.01.2012, 00:22
Hi, have a little bit of samp but find nothing. There is something script when you have examples below 50 hp so you fall to the ground? or if someone wants to help how to fix it
new Float:phealth;
GetPlayerHealth(playerid,phealth);
if(phealth < 51)
{
//apply the fall animation
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"You have falled to the ground because you are injured");
return 1;
}
Use a timer or use onplayerupdate ( i think it will work)
pawn Код:
|
new HPTimer[MAX_PLAYERS];
SetTimerEx("FallDown",100,true,"i",playerid);
forward FallDown(playerid);
public FallDown(playerid)
{
new Float:phealth;
GetPlayerHealth(playerid,phealth);
if(phealth < 51)
{
//apply the fall animation
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"You have falled to the ground because you are injured");
KillTimer(HPTimer[playerid]);
}
return 1;
}
new bool:IsPlayerDowned[MAX_PLAYERS];
IsPlayerDowned[playerid] = false;
public OnPlayerUpdate(playerid)
{
new Float:phealth;
GetPlayerHealth(playerid,phealth);
if(phealth <= 50 && IsPlayerDowned[playerid] = false)
{
//apply the fall animation
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"You have falled to the ground because you are injured");
IsPlayerDowned[playerid] = true;
}
return 1;
}
Lol that's so prone to bugs.
Just create a variable: pawn Код:
pawn Код:
pawn Код:
|
C:\Users\Robin\Desktop\New rp\gamemodes\RMRP.pwn(85578) : error 001: expected token: ";", but found ")" C:\Users\Robin\Desktop\New rp\gamemodes\RMRP.pwn(85578) : error 029: invalid expression, assumed zero C:\Users\Robin\Desktop\New rp\gamemodes\RMRP.pwn(85578) : fatal error 107: too many error messages on one line
new Float:phealth; GetPlayerHealth(playerid,phealth); line 85578 if(phealth <= 50 && IsPlayerDowned[playerid] = false) { //apply the fall animation TogglePlayerControllable(playerid,0); SendClientMessage(playerid,-1,"You have falled to the ground because you are injured"); IsPlayerDowned[playerid] = true; } return 1;
umm you added it in timer? if so try using it onplayerupdate. Or maybe if your using onplayerupdate and it doesnt work on timer, try doing the bottom with your timer.
pawn Код:
pawn Код:
pawn Код:
|