SA-MP Forums Archive
Team Kill 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Team Kill Problem (/showthread.php?tid=154698)



Team Kill Problem - MWF2 - 15.06.2010

How can i use

SetPlayerTeam


and make it so players cannot kill each other? If I put it under onplayerspawn some times teams can still kill each other.


How can i fix this?


Re: Team Kill Problem - Babul - 15.06.2010

not tested:
Код:
if(gTeam[killerid]==TEAM_COP || gTeam[killerid]==TEAM_ARMY || gTeam[killerid]==TEAM_AIRSUPPORT)
{
	if(gTeam[playerid]==TEAM_COP || gTeam[playerid]==TEAM_ARMY || gTeam[playerid]==TEAM_AIRSUPPORT)
	{
		teamkiller[killerid] +=1;
		if(teamkiller[killerid] >2) 
		{
			new str[100];
			GetPlayerName(killerid, str, 24);
			format(str, 100, "**(AUTO KICK)** %s(%d) Too Many Team Kills(TeamKiller)", str,killerid);
			SendClientMessageToAll(0xFF7F50AA, str);
			printf("%s", str);
			SetPlayerInterior(killerid,10);
			SetPlayerPos(killerid,219.6257,111.2549,999.0156);
			SetPlayerFacingAngle(killerid,2.2339);
			SetCameraBehindPlayer(killerid);
			teamkiller[killerid] =0;
			Kicking[killerid] =1;
			SetTimer("KickPlayer",700,0);
			return 1;
		}
		SendClientMessage(killerid,COLOR_RED, "TEAM KILL - Do not kill other Law Enforcement agents (Blue/Purple)");
		SendClientMessage(killerid,COLOR_RED, "If you continue to kill other Law Enforcement agents you will be kicked/banned");
		SendDeathMessage(killerid,playerid,reason);
		SetPlayerColor(playerid,COLOR_DEADCONNECT);
		oscore = GetPlayerScore(killerid);
		SetPlayerScore(killerid, oscore -1);
		return 1;
	}
	//"cop/army/air killed civilian" message for cop/army/air here?
	return 1;
}



Re: Team Kill Problem - Grim_ - 15.06.2010

Just set a timer every few seconds re-setting the players team. Sometimes the effect isn't set correctly.
pawn Код:
public OnPlayerSpawn(playerid)
{
  SetTimerEx("UpdatePlayerTeam", 10000, 1, "i", playerid);
  return 1;
}

forward UpdatePlayerTeam(playerid);
public UpdatePlayerTeam(playerid) SetPlayerTeam(playerid, teamid);



Re: Team Kill Problem - MWF2 - 15.06.2010

Quote:
Originally Posted by Grim_
Just set a timer every few seconds re-setting the players team. Sometimes the effect isn't set correctly.
pawn Код:
public OnPlayerSpawn(playerid)
{
  SetTimerEx("UpdatePlayerTeam", 10000, 1, "i", playerid);
  return 1;
}

forward UpdatePlayerTeam(playerid);
public UpdatePlayerTeam(playerid) SetPlayerTeam(playerid, teamid);
But how would i do that for more then one team?



So like i want it so that, TEAM_COP and TEAM_ARMY cannot hurt there own team or each other as well


EDIT: That doesn't protect the teams from killing each other.


Re: Team Kill Problem - MWF2 - 15.06.2010

Anyone?