SA-MP Forums Archive
OnPlayerDeath - 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 (/showthread.php?tid=386983)



OnPlayerDeath - Blackazur - 22.10.2012

Hello, i have a problem that sometimes when player spawn he got automatic killed, here is the onplayerspawn:

Код:
public OnPlayerSpawn(playerid)
{

	if(PlayerTeam[playerid] == TEAM_ZOMBIE)
	{
	    if(Map == 0)
	    {
	        new rand = random(sizeof(Map0ZombieRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map0ZombieRand[rand][0],Map0ZombieRand[rand][1],Map0ZombieRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map0ZombieRand[rand][3]);
	    }
	    else if(Map == 1)
	    {
	        new rand = random(sizeof(Map1ZombieRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map1ZombieRand[rand][0],Map1ZombieRand[rand][1],Map1ZombieRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map1ZombieRand[rand][3]);
	    }
	    


        PlayerConnect[playerid] = true;
        PlayerHealTime[playerid] = 5;
   	 	SetPlayerHealth(playerid, 100);
		SetPlayerChatBubble(playerid,"[ANTI-SPAWN-KILL]",COLOR_YELLOW,40.0,1000);
		SendClientMessage(playerid,COLOR_LIGHTGREEN,"«| Anti Spawn Kill (5 seconds) |»");
		SetPlayerColor(playerid,0xBDE784AA);
	    SetPlayerTeam(playerid,TEAM_ZOMBIE);
    	TextDrawShowForPlayer(playerid,tURL);
    	TextDrawShowForPlayer(playerid,tVS);
    	TextDrawShowForPlayer(playerid,tTimer);
        TextDrawShowForPlayer(playerid,tBite);
	    GivePlayerWeaponEx(playerid,4,1);
	    SendClientMessage(playerid,COLOR_RED,"Team: Zombie");
	    SendClientMessage(playerid,COLOR_RED,"Kill the humans. Use your Knife to infect a Human.");
	    SendClientMessage(playerid,COLOR_RED,"One Hit and the Human is infected.");
	    SendClientMessage(playerid,COLOR_LIGHTGREEN,"For the commands, type /cmds, for help type /help.");
	}
	else if(PlayerTeam[playerid] == TEAM_HUMAN)
	{
	    if(Map == 0)
	    {
	        new rand = random(sizeof(Map0HumanRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map0HumanRand[rand][0],Map0HumanRand[rand][1],Map0HumanRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map0HumanRand[rand][3]);
	    }
	    else if(Map == 1)
	    {
	        new rand = random(sizeof(Map1HumanRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map1HumanRand[rand][0],Map1HumanRand[rand][1],Map1HumanRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map1HumanRand[rand][3]);
	    }
	    
	    PlayerConnect[playerid] = true;
	    PlayerHealTime[playerid] = 5;
   	 	SetPlayerHealth(playerid, 100);
		SetPlayerChatBubble(playerid,"[ANTI-SPAWN-KILL]",COLOR_YELLOW,40.0,1000);
		SendClientMessage(playerid,COLOR_LIGHTGREEN,"«| Anti Spawn Kill (5 seconds) |»");
	    SetPlayerColor(playerid,0x66E5FFAA);
     	SetPlayerTeam(playerid,TEAM_HUMAN);
     	TextDrawShowForPlayer(playerid,tURL);
    	TextDrawShowForPlayer(playerid,tVS);
    	TextDrawShowForPlayer(playerid,tTimer);
	    TextDrawHideForPlayer(playerid,tBite);
     	GivePlayerWeaponEx(playerid,1,1);
     	GivePlayerWeaponEx(playerid,3,1);
     	GivePlayerWeaponEx(playerid,24,9999);
     	GivePlayerWeaponEx(playerid,25,9999);
     	GivePlayerWeaponEx(playerid,31,9999);
     	SendClientMessage(playerid,COLOR_BLUE,"Team: Human");
     	SendClientMessage(playerid,COLOR_BLUE,"Work in Team!");
     	SendClientMessage(playerid,COLOR_BLUE,"Kill the Zombies. You have got heavy Weapons, they make Double Damage.");
     	SendClientMessage(playerid,COLOR_LIGHTGREEN,"For the commands, type /cmds, for help type /help.");
	}
	return 1;
}



AW: OnPlayerDeath - Blackazur - 23.10.2012

Know everyone a Answer?


Re: OnPlayerDeath - gtakillerIV - 23.10.2012

Show us your OnPlayerSpawn.


AW: OnPlayerDeath - Blackazur - 23.10.2012

here:

Код:
public OnPlayerSpawn(playerid)
{

	if(PlayerTeam[playerid] == TEAM_ZOMBIE)
	{
	    if(Map == 0)
	    {
	        new rand = random(sizeof(Map0ZombieRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map0ZombieRand[rand][0],Map0ZombieRand[rand][1],Map0ZombieRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map0ZombieRand[rand][3]);
	    }
	    else if(Map == 1)
	    {
	        new rand = random(sizeof(Map1ZombieRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map1ZombieRand[rand][0],Map1ZombieRand[rand][1],Map1ZombieRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map1ZombieRand[rand][3]);
	    }
	    


        PlayerConnect[playerid] = true;
        PlayerHealTime[playerid] = 5;
   	 	SetPlayerHealth(playerid, 100);
		SetPlayerChatBubble(playerid,"[ANTI-SPAWN-KILL]",COLOR_YELLOW,40.0,1000);
		SendClientMessage(playerid,COLOR_LIGHTGREEN,"«| Anti Spawn Kill (5 seconds) |»");
		SetPlayerColor(playerid,0xBDE784AA);
	    SetPlayerTeam(playerid,TEAM_ZOMBIE);
    	TextDrawShowForPlayer(playerid,tURL);
    	TextDrawShowForPlayer(playerid,tVS);
    	TextDrawShowForPlayer(playerid,tTimer);
        TextDrawShowForPlayer(playerid,tBite);
	    GivePlayerWeaponEx(playerid,4,1);
	    SendClientMessage(playerid,COLOR_RED,"Team: Zombie");
	    SendClientMessage(playerid,COLOR_RED,"Kill the humans. Use your Knife to infect a Human.");
	    SendClientMessage(playerid,COLOR_RED,"One Hit and the Human is infected.");
	    SendClientMessage(playerid,COLOR_LIGHTGREEN,"For the commands, type /cmds, for help type /help.");
	}
	else if(PlayerTeam[playerid] == TEAM_HUMAN)
	{
	    if(Map == 0)
	    {
	        new rand = random(sizeof(Map0HumanRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map0HumanRand[rand][0],Map0HumanRand[rand][1],Map0HumanRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map0HumanRand[rand][3]);
	    }
	    else if(Map == 1)
	    {
	        new rand = random(sizeof(Map1HumanRand));
	        SetPlayerInterior(playerid,0);
	        SetPlayerPos(playerid,Map1HumanRand[rand][0],Map1HumanRand[rand][1],Map1HumanRand[rand][2]);
	        SetPlayerFacingAngle(playerid,Map1HumanRand[rand][3]);
	    }
	    
	    PlayerConnect[playerid] = true;
	    PlayerHealTime[playerid] = 5;
   	 	SetPlayerHealth(playerid, 100);
		SetPlayerChatBubble(playerid,"[ANTI-SPAWN-KILL]",COLOR_YELLOW,40.0,1000);
		SendClientMessage(playerid,COLOR_LIGHTGREEN,"«| Anti Spawn Kill (5 seconds) |»");
	    SetPlayerColor(playerid,0x66E5FFAA);
     	SetPlayerTeam(playerid,TEAM_HUMAN);
     	TextDrawShowForPlayer(playerid,tURL);
    	TextDrawShowForPlayer(playerid,tVS);
    	TextDrawShowForPlayer(playerid,tTimer);
	    TextDrawHideForPlayer(playerid,tBite);
     	GivePlayerWeaponEx(playerid,1,1);
     	GivePlayerWeaponEx(playerid,3,1);
     	GivePlayerWeaponEx(playerid,24,9999);
     	GivePlayerWeaponEx(playerid,25,9999);
     	GivePlayerWeaponEx(playerid,31,9999);
     	SendClientMessage(playerid,COLOR_BLUE,"Team: Human");
     	SendClientMessage(playerid,COLOR_BLUE,"Work in Team!");
     	SendClientMessage(playerid,COLOR_BLUE,"Kill the Zombies. You have got heavy Weapons, they make Double Damage.");
     	SendClientMessage(playerid,COLOR_LIGHTGREEN,"For the commands, type /cmds, for help type /help.");
	}
	return 1;
}