SA-MP Forums Archive
OnPlayerDeath Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDeath Problem (/showthread.php?tid=435082)



OnPlayerDeath Problem - Blackazur - 05.05.2013

Код:
	if(team[playerid] == TEAM_HUMAN)
	{
 		ZombieSetup(playerid);
 		team[playerid] = TEAM_ZOMBIE;
	    SetPlayerTeam(playerid,TEAM_ZOMBIE);
	}
Why is the player when he is human still human when he make suicide?


Re: OnPlayerDeath Problem - RajatPawar - 05.05.2013

That looks okay, can you show us the ZombieSetup function?


AW: OnPlayerDeath Problem - Blackazur - 05.05.2013

Код:
stock ZombieSetup(playerid)
{
    team[playerid] = TEAM_ZOMBIE;
    TogglePlayerControllable(playerid,0);
	ResetPlayerWeapons(playerid);
	GivePlayerWeapon(playerid,4,1);
	SetPlayerTeam(playerid,TEAM_ZOMBIE);
	SetPlayerColor(playerid,COLOR_ZOMBIE);
    TogglePlayerControllable(playerid,1);
	new zskin = random(3);
 	switch(zskin) {
  		case 0:SetPlayerSkin(playerid,162);
    	case 1:SetPlayerSkin(playerid,134);
     	case 2:SetPlayerSkin(playerid,137);
	}
	return 1;
}



Re: OnPlayerDeath Problem - SimpalK - 05.05.2013

Use this :-
pawn Код:
if(team[playerid] == TEAM_HUMAN)
    {
        ZombieSetup(playerid);
    }
As it already got : SetPlayerTeam.


AW: OnPlayerDeath Problem - Blackazur - 05.05.2013

When the player make suicide and he is human he die, but then he spawns as Human again and is not Zombie then.


Re: OnPlayerDeath Problem - SimpalK - 05.05.2013

I Edited my Post, Hope it will Help.


AW: OnPlayerDeath Problem - Nero_3D - 05.05.2013

The only reason I would think of would be that it gets never called, just put a debug print before the if statment and test it


Re: OnPlayerDeath Problem - kamzaf - 05.05.2013

is this under if(killerid != INVALID_PLAYER_ID)? cause if it is then it wont get called cause the player hasnt suicided but killed. You must put


pawn Код:
if(team[playerid] == TEAM_HUMAN)
    {
        ZombieSetup(playerid);
        team[playerid] = TEAM_ZOMBIE;
        SetPlayerTeam(playerid,TEAM_ZOMBIE);
    }
under OnPlayerDeath in order for the the player to change when he suicides.