Health Detection/Injury System
#8

In my opinion, making a system like this based on health blows. I would just try something with death in general. Here are examples from my working script:

Код:
enum PlayerStatistics
{
    IsDead,
    Dead,
}
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    Player[playerid][LastWorld] = GetPlayerVirtualWorld(playerid);
    Player[playerid][LastInterior] = GetPlayerInterior(playerid);

    Player[playerid][LastX] = x;  //saves players position for spawning
    Player[playerid][LastY] = y; 
    Player[playerid][LastZ] = z;

    Player[playerid][IsDead] = 1;
}
Код:
public OnPlayerSpawn(playerid)
{
     if(Player[playerid][IsDead] == 1)
     {
          SetPlayerPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
 	  SetPlayerCameraPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
 	  SetPlayerInterior(playerid, Player[playerid][LastInterior]);
 	  SetPlayerVirtualWorld(playerid, Player[playerid][LastWorld]);

          format(string, sizeof(string), "(( Has been brutally wounded, /damages %d for more info. ))", playerid);
  	  SetPlayerChatBubble(playerid, string, ADM, 30.0, 600000); 
 
          // bunch of other shit, anims & etc 
     }
}
Код:
public OnPlayerUpdate(playerid)
{
    if(Player[playerid][IsDead] == 1)
    {
         ApplyAnimation(playerid, // ur anim
    }
}
You don't have to add TogglePlayerControllable on spawn while dead because having this under OnPlayerUpdate will just repeat the anim and they can't get up but still move their camera.

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
{
     if(Player[damagedid][IsDead] == 1) 
     {
	TogglePlayerControllable(damagedid, false);
	Player[damagedid][IsDead] = 0;
	Player[damagedid][Dead] = 1;
        SetPlayerChatBubble(damagedid, "(( PLAYER IS DEAD ))", ADM, 30.0, 1220001);
     }
}
Just my opinion & a base for you to start if you'd like.
Reply


Messages In This Thread
Health Detection/Injury System - by xLucy - 10.04.2017, 10:22
Re: Health Detection/Injury System - by khRamin78 - 10.04.2017, 10:27
Re: Health Detection/Injury System - by Kane - 10.04.2017, 10:33
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:35
Re: Health Detection/Injury System - by khRamin78 - 10.04.2017, 10:35
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:37
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:44
Re: Health Detection/Injury System - by Kane - 10.04.2017, 10:46
Re: Health Detection/Injury System - by Kane - 10.04.2017, 10:49
Re: Health Detection/Injury System - by xLucy - 10.04.2017, 10:51

Forum Jump:


Users browsing this thread: 1 Guest(s)