Injuried System
#1

Hey guys,

So I have been working on my death system, but I don't get why it won't work properly, as when I have one of my testers kills me to test, but what should happen is when someone kills someone, they should spawn back at their place as an injuried person, but oddly enough what it does is spawns you at the points of 0, 0, 0 (X, Y, Z), and doesn't do anything, its strange for me.

Code:
Код:
public OnPlayerSpawn(playerid)
{
	if(IsDead[playerid] == 1)
	{
		SetPlayerPos(playerid, DeathPos[playerid][dX], DeathPos[playerid][dY], DeathPos[playerid][dZ]);
		SetPlayerHealth(playerid, 50);
		IsDead[playerid] = 2;
		ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
		SetTimerEx("AutoDeath", AUTODEATH_SECONDS * 1000, false, "i", playerid);
		SendClientMessage(playerid, COLOUR_TWPINK, "------------------ Health Advice -----------------");
	    SendClientMessage(playerid, COLOUR_TWPINK, "You have been critically injured!");
	    SendClientMessage(playerid, COLOUR_TWPINK, "You can type either '/requestmedic' or '/acceptdeath' to continue.");
	    SendClientMessage(playerid, COLOUR_TWPINK, "--------------------------------------------------------");

		new string[400];
		new holder[400];

		if(sInfo[playerid][Misc] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d bruises on their body.\n", sInfo[playerid][Misc]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][Head] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the head.\n", sInfo[playerid][Head]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][Chest] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the chest.\n", sInfo[playerid][Chest]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][Crotch] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the crotch.\n", sInfo[playerid][Crotch]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][LArm] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the left arm.\n", sInfo[playerid][LArm]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][RArm] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the right arm.\n", sInfo[playerid][RArm]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][LLeg] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the left leg.\n", sInfo[playerid][LLeg]);
			strcat(holder, string, sizeof(holder));
		}
		if(sInfo[playerid][RLeg] > 0)
		{
			format(string, sizeof(string), ""COL_RED"%d gun shot wound(s) in the right leg.\n", sInfo[playerid][RLeg]);
			strcat(holder, string, sizeof(holder));
		}
		deathlabel[playerid] = Create3DTextLabel(holder, -1, DeathPos[playerid][dX], DeathPos[playerid][dY], DeathPos[playerid][dZ], 10.0, 0, 0);
	}
	else if(IsDead[playerid] == 2)
	{
	    AutoDeath(playerid);
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	new Float:pX, Float:pY, Float:pZ;
	GetPlayerPos(playerid, pX, pY, pZ);
	
	PlayerInfo[killerid][pKills]++;
	PlayerInfo[playerid][pDeaths]++;
	DeathPos[playerid][dX] = pX;
	DeathPos[playerid][dY] = pY;
	DeathPos[playerid][dZ] = pZ;
	IsDead[playerid] = 1;
	return 1;
}
Reply


Messages In This Thread
Injuried System - by McGuiness - 12.05.2016, 15:12
Re: Injuried System - by MBilal - 12.05.2016, 21:52
Re: Injuried System - by McGuiness - 13.05.2016, 08:36
Re: Injuried System - by Dayrion - 13.05.2016, 08:45
Re: Injuried System - by McGuiness - 13.05.2016, 08:53
Re: Injuried System - by MBilal - 13.05.2016, 09:24
Re: Injuried System - by IzadorO - 13.05.2016, 11:21

Forum Jump:


Users browsing this thread: 1 Guest(s)