Injured System
#1

It seems it is not working for me...

Код:
new Injured[MAX_PLAYERS];
--- Top of my Script..

Код:
		if (Injured[playerid] == 1 && GetPlayerAnimationIndex(playerid) != 386)
		{
			ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 1, 0, 1);
			SendEMSQueue(playerid,1);
		}
SetPlayerSpawn, so if they log in, they're Injured...

Код:
	if (Injured[playerid] == 0)
	{
	    new Float:x, Float:y, Float:z;
	    new Float:angle;
		Injured[playerid] = 1;
		GetPlayerPos(playerid, x, y, z);
		GetPlayerFacingAngle(playerid, angle);

	}

	else if (Injured[playerid] == 1)
	{
		KillTimer(LoseHealthTimer[playerid]);
		KillEMSQueue(playerid);
		if(GetPVarInt(playerid, "activesling") > 0)
		{
			DeletePVar(playerid, "activesling");
		}
	}
Under OnPlayerDeath...

Код:
	if (Injured[playerid] == 1 && GetPlayerAnimationIndex(playerid) != 386)
	{
		ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 1, 0, 1);
	}
Under OnPlayerUpdate..

Basically, when the person dies, they just go to the hospital... Not placing them in the position, injured.
Reply
#2

What position? in which part
Reply
#3

You have to get the player's position on death, and set their position to that when they spawn again.
Reply
#4

Use GetPlayerPos under OnPlayerDeath and put SetPlayerPos with the X Y Z under OnPlayerSpawn, don't forget to get the virtual world and interior too in case the player dies in one. You can also add TogglePlayerControllable and set it to false(or 0) so they can't move while injured.
So in the end it should look like
PHP код:
 new Injured[MAX_PLAYERS]; //Top of your script
new Float:XFloat:YFloat:ZFloat:A//Storing the coordinates and angle when a player dies. Again on top.
new interior//In case you want to store the interior too.


public OnPlayerDeath(playeridkilleridreason)
{
   
Injured[playerid] = 1;
   
GetPlayerPos(playeridXYZ);
   
GetPlayerFacingAngle(playeridA);
   
GetPlayerInterior(interior); //In case you add the interior too
    
return 1;
}
public 
OnPlayerSpawn(playerid)
{

    
    if(
Injured[playerid] == 1//Here it checks if the player died is injured
    
{
    
SetPlayerInterior(playeridinterior);
    
SetPlayerPos(playeridXYZ); 
    
SetPlayerFacingAngle(playeridA);
    
TogglePlayerControllable(playerid0); //Freezes the player so he can't use anything.
    
ApplyAnimation(playerid"CRACK""crckdeth2"4.0100101);
    
SendEMSQueue(playerid,1);
    }
    return 
1;

This is what I would have done if I needed a similiar system, you can edit the code to suit your own needs as I quickly made one for you, couldn't fully understand you so sorry if its not what you need.
Reply
#5

Now when I go hospital, it does not let me out. I'm just stuck there.
Does anyone have Skype and able to help me? PM Me. Else I'll send my TV over PM's.
Reply
#6

The one I've given you is an example, the player will just stay there in an injured position as that's what I've understood from the post you did. What else do you need, a command to help the downed player up? A way for the player to accept the death and get spawned to the hospital? A good system like this would also have a way to track if a player has been shot, maybe make a timer and check if the player has been shot or just died in a brawl, if there are gunshot wounds registered then after the timer ending you can make him spawn in a hospital and if there were no gsw, just make him get up back onto his feet. The problem with the script I made for you is that, upon a player dying he's always having his Injured[playerid] set to 1, hence you not leaving the hospital or not getting there at all.
Reply
#7

Quote:
Originally Posted by cs_waller
Посмотреть сообщение
The one I've given you is an example, the player will just stay there in an injured position as that's what I've understood from the post you did. What else do you need, a command to help the downed player up? A way for the player to accept the death and get spawned to the hospital? A good system like this would also have a way to track if a player has been shot, maybe make a timer and check if the player has been shot or just died in a brawl, if there are gunshot wounds registered then after the timer ending you can make him spawn in a hospital and if there were no gsw, just make him get up back onto his feet. The problem with the script I made for you is that, upon a player dying he's always having his Injured[playerid] set to 1, hence you not leaving the hospital or not getting there at all.
They just automatically go to hospital still...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)