Can i use this with OnPlayerStateChange ??
#1

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 ^^'
Reply
#2

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!
Reply
#3

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
Reply
#4

Okay man, thanks for sharing the info.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)