Can i use this with OnPlayerStateChange ?? - 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: Can i use this with OnPlayerStateChange ?? (
/showthread.php?tid=90686)
Can i use this with OnPlayerStateChange ?? -
Martin_White - 09.08.2009
Am i able to use this:
pawn Код:
#include <a_samp>
new neardeath[MAX_PLAYERS];
forward death(playerid);
forward crack(playerid);
forward OnPlayerUpdate(playerid);
new Float:pHealth;
public OnPlayerUpdate(playerid)
{
GetPlayerHealth(playerid,pHealth);
if (pHealth < 20.0)
{
SetPlayerFacingAngle(playerid, 0);
TogglePlayerControllable(playerid, 0);
SetTimerEx("crack", 55, false, "i", playerid);
neardeath[playerid]=true;
}
return 1;
}
public crack(playerid)
{
ApplyAnimation(playerid, "CRACK", "crckdeth1", 1, 1, 0, 0, 0, 1);
SetTimerEx("death", 60000, false, "i", playerid);
return 1;
}
public death(playerid)
{
SetPlayerHealth(playerid, 0);
return 1;
}
public OnPlayerDeath (playerid)
{
neardeath[playerid] = false;
return 1;
}
With OnPlayerStateChange?
Because the script above is not working good with the OnPlayerUpdate, and i need serious help, if you did help me i will give credits in /credits command ^^'
Re: Can i use this with OnPlayerStateChange ?? -
Martin_White - 09.08.2009
Just answer okay? even if you do not know or not sure answer, or even if it is impossible answer, just dont leave me here confused!
Re: Can i use this with OnPlayerStateChange ?? -
Moustafa - 09.08.2009
I do not think it is possible, i've tried to merge it with OnPlayerStateChange but i couldn't, maybe someone else can make it possible :P
Re: Can i use this with OnPlayerStateChange ?? -
Martin_White - 09.08.2009
Okay man, thanks for sharing the info.
Re: Can i use this with OnPlayerStateChange ?? -
MadeMan - 09.08.2009
Why isn't it working with OnPlayerUpdate?
I think OnPlayerStateChange is not the best callback to use when you want to detect health change. You can make your own function and add timer to it, to check players healths.