[Tutorial] Make Teams and Anti Team-Kill (gTeam)
#1

Hi Guys I am New To Scripting
I am Making A Server I Wanted To Make Anti Team Kill I Tried to Find It On Internet But I Could Hardly Find It.
So I wanted To Share It
So Here It Is How It Comes
First Of All Define Teams
Code:
#define blue 0
#define red 1
#define green 2
#define yellow 3
#define blue_color 0x33CCFFAA
#define red_color 0xAA3333AA
#define green_color 0x12900BBF
#define yellow_color 0xFFFF00AA
Then Under #else type
Code:
new gTeam[MAX_PLAYERS];
Then Under public OnGameModeInit() Add Classes
Code:
public OnGameModeInit()
{	
        AddPlayerClass(287, 1382.8832,794.5979,10.8280,177.3541, 33, 1000, 24, 1000, 25, 1000);//blue
	AddPlayerClass(124, 754.6019,274.7502,27.3949,3.6705, 33, 1000, 24, 1000, 25, 1000);//Red
	AddPlayerClass(73, -468.3686,-91.8865,60.0957,348.3795, 33, 1000, 24, 1000, 25, 1000);//Green
	AddPlayerClass(117, 1019.3360,-287.2638,73.9931,178.4066, 33, 1000, 24, 1000, 25, 1000);//Yellow 
	return 1;
}
First One Is Skin Id "287" And "1382.8832,794.5979,10.8280,177.3541" Is Spawn Area Where The Team Player Will Spawn And Next Are Weapon ids and ammo

After That Come To public OnPlayerRequestClass(playerid, classid)
Code:
public OnPlayerRequestClass(playerid, classid)
{	
           if(classid == 0) {
	    SetPlayerSkin(playerid, 287); //skin for team blue
        GameTextForPlayer(playerid,"~B~Blue",1000,4);
	    SetPlayerColor(playerid, blue_color);//color for team blue
	    gTeam[playerid] = 1; //class 0 will be ally of class 1
 }
 	if(classid == 1) {
	    SetPlayerSkin(playerid, 124); //skin for team red
        GameTextForPlayer(playerid,"~R~Red",1000,4);//color for team red
	    SetPlayerColor(playerid, red_color);
	    gTeam[playerid] = 0; //class 1 will be ally of class 0
 }
	if(classid == 2) {
	    SetPlayerSkin(playerid, 73); //skin for team green
        GameTextForPlayer(playerid,"~G~Green",1000,4);
	    SetPlayerColor(playerid, green_color);//color for team green
	    gTeam[playerid] = 3;//class 2 will be ally of class 3
 }
 	if(classid == 3) {
	    SetPlayerSkin(playerid, 117); //skin for team yellow
        GameTextForPlayer(playerid,"~Y~Yellow",1000,4);
	    SetPlayerColor(playerid, yellow_color);//color for team yellow
	    gTeam[playerid] = 2;//class 3 will be ally of class 2
 }
	return 1;
}
We made Teams Now Lets Move To Anti Team Kill For It We Must Go To public OnPlayerSpawn(playerid)

Code:
public OnPlayerSpawn(playerid)
{    
        new Skin=GetPlayerSkin(playerid);
	switch(Skin)
	{
		case 287,117: //The Skins Which Will Be Ally
		{
			SetPlayerTeam(playerid,Blue);//Team Blue And Its Ally Like Blue And Red They Cant Kill Each Other
		}
		case 73,124: //The Skins Which Will Be Ally
		{
			SetPlayerTeam(playerid,Green);//Team Green And Its Ally Like Green And Yellow
		}
	}
	return 1;
}
Reply


Messages In This Thread
Make Teams and Anti Team-Kill (gTeam) - by Gokhan152 - 14.06.2015, 07:24
Re: Make Teams and Anti Team-Kill (gTeam) - by Gokhan152 - 17.06.2015, 05:17
Re: Make Teams and Anti Team-Kill (gTeam) - by MichaelJones - 25.06.2015, 17:12
Re: Make Teams and Anti Team-Kill (gTeam) - by K0UMA - 26.06.2015, 02:27
Re: Make Teams and Anti Team-Kill (gTeam) - by Youssef221 - 26.06.2015, 05:31
Re: Make Teams and Anti Team-Kill (gTeam) - by Vince - 26.06.2015, 07:05
Re: Make Teams and Anti Team-Kill (gTeam) - by Joron - 15.12.2015, 22:48

Forum Jump:


Users browsing this thread: 1 Guest(s)