Death problem
#1

When player dies no matter how, the player hears the noise of the legs getting broken and getting spawn right away, no second to pass, also getting spawned with CJ's skin even through he had other one and I added SetPlayerSkin when spawns but it dosen't work.
Reply
#2

Use SetSpawnInfo
Reply
#3

SetSpawnInfo didn't helped.

I've built a new death system and I noticed something.
The system:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(IsPlayerLoggedIn(playerid))
	{
	    new string[128];
	    new Float:pPosX, Float:pPosY, Float:pPosZ, Gun, Ammos;
		GetPlayerPos(playerid, pPosX, pPosY, pPosZ);
		Gun = GetPlayerWeapon(playerid);
	 	Ammos = GetPlayerAmmo(playerid);
	 	if(Gun != 0 && Ammos != 0 && !IsAGov(playerid) && !PlayerInfo[playerid][pFacDuty]) CreateDroppedGun(Gun, Ammos, pPosX+random(2)-random(2), pPosY+random(2)-random(2), pPosZ);
   		if(Event[playerid])
     	{
    		format(string, sizeof(string), "OnEventDeath: %s has killed %s using %s.", RPN(killerid), RPN(playerid), RWN(reason));
			foreach(Player, i)
			{
   				if(Event[i]) SendClientMessage(i, COLOR_REPORT, string);
			}
			Event[playerid] = 0;
    	}
    	if(aDuty[playerid])
    	{
    	    SetPlayerPos(playerid,1177.4894,-1324.2737,14.0732);
			SetPlayerFacingAngle(playerid, 268.8192);
			TogglePlayerControllable(playerid, 1);
			SetPlayerColor(playerid, 0x4d729400);
			SetPlayerHealth(playerid, 50000000);
		}
		if(PlayerInfo[playerid][pDead])
		{
		    PlayerInfo[playerid][pDead] = 0;
		    SetPlayerHealth(playerid, 100);
		    PlayerInfo[playerid][pHealth] = 100;
		    PlayerInfo[playerid][pSpawnFreeze] = 0;
		    SetPlayerVirtualWorld(playerid, 0);
		    SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
		    SetPlayerInterior(playerid, 0);
		    TogglePlayerControllable(playerid, 1);
		    Delete3DTextLabel(Death[playerid]);
		    SetPlayerPos(playerid, 1190.7158,-1323.1836,13.3984);
		    GiveZaiatMoney(playerid, -1500);
	    	SendClientMessage(playerid, COLOR_GREEN, "You were killed.");
	    	return 1;
		}
		if(PlayerInfo[playerid][pPrison])
		{
			GiveZaiatMoney(playerid, -150);
			format(string, sizeof(string), "You were killed by %s using a %s while being imprisoned.", RPN(killerid), RWN(GetPlayerWeapon(killerid)));
			SendClientMessage(playerid, COLOR_LIGHTRED, string);
			SpawnCharInCell(playerid);
		}
		else
		{
		    new Float:Pos[3];
		    new vw = GetPlayerVirtualWorld(playerid);
		    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
		    PlayerInfo[playerid][pDead] = 1;
	     	PlayerInfo[playerid][pSpawnFreeze] = 1;
			PlayerInfo[playerid][pArmor] = 0;
			PlayerInfo[playerid][pHealth] = 15;
			SetPlayerHealth(playerid, 15);
			SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
			TogglePlayerControllable(playerid, 0);
			LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
			Death[playerid] = Create3DTextLabel("Injured", COLOR_LIGHTRED, 0, 0, 0, 10, vw, 1); //adding textlabel
            Attach3DTextLabelToPlayer(Death[playerid], playerid, 0.0, 0.0, 0.7);
            if(BeingCalled[playerid] || Calling[playerid])
			{
			    if(BeingCalled[playerid]) SendClientMessage(Caller[playerid], COLOR_ORANGE, " The line went dead...");
			   	else if(Calling[playerid]) SendClientMessage(Called[playerid], COLOR_ORANGE, " The line went dead...");
			    new params[1];
			    cmd_hangup(playerid, params);
			}
			if(IsPlayerLoggedIn(killerid))
		    {
				format(string, sizeof(string), "OnPlayerDeath: %s has killed %s using %s.", RPN(killerid), RPN(playerid), RWN(reason));
				SendAdminMessage(COLOR_DARKRED, 1, string);
				Log("logs/kill.log", string);
			}
			return 1;
		}
	}
	return 1;
}
There's more but that's not important, what I've noticed that on those lines in OnPlayerDeath

Код:
new Float:Pos[3];
		    new vw = GetPlayerVirtualWorld(playerid);
		    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
		    PlayerInfo[playerid][pDead] = 1;
	     	PlayerInfo[playerid][pSpawnFreeze] = 1;
			PlayerInfo[playerid][pArmor] = 0;
			PlayerInfo[playerid][pHealth] = 15;
			SetPlayerHealth(playerid, 15);
			SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
			TogglePlayerControllable(playerid, 0);
			LoopingAnim(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
It gets the player pos and then sets it, well it's actually setting him on LV, the known request class background and does all of the others, what means that for some reason on his death he gets spawn there with CJ's skin...
Reply
#4

they're dead, their health is already 0, they cannot control the player and they are on their way to respawn, you might be stuffing up the client by setting their health, applying animations and setting their positions (I could be wrong) but try removing them if you've got no other ideas
Reply
#5

Any more ideas ...
Reply
#6

for CJ i had that bug long time ago .. this is how i solve it
top of the script
PHP код:
new oldskin
PHP код:

public OnPlayerDeath(playeridkilleridreason)
{
       
oldskin GetPlayerSkin(playerid); 
PHP код:

public OnPlayerSpawn(playerid)
{
    
SetPlayerSkin(playeridoldskin);
.
.
.
Your code here .. 
hope that will fix your problem ..
Reply
#7

Thanks for Help. It worked.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)