Anti Team Kill
#1

How to make Anti Team Kill
have GM, should I put in Gm and where to put
IF you can put code because i am noob...
Need it for my server...
Thanks!
Have 10 teams so how to make anti tk for every of each ?
AND how to make /rules system not in dialog but in chat and /commands like this in chat not in dialog
To do that in gamemode and what code to do?
Reply
#2

Quote:
Originally Posted by Djane
View Post
How to make Anti Team Kill
have GM, should I put in Gm and where to put
IF you can put code because i am noob...
Need it for my server...
Thanks!
Have 10 teams so how to make anti tk for every of each ?
AND how to make /rules system not in dialog but in chat and /commands like this in chat not in dialog
To do that in gamemode and what code to do?
/Rules would use SendClientMessage function if you want them to appear in chat. If you got some problems with making the anti team kill, simply the easiest way is to make some code at OnPlayerTakeDamage, where you would check if the player is shooting another player from his team and if yes simply set his health back to full everytime and so on.
Reply
#3

Anti Team Kill: (Change Team_1-10 with your funtions to check the teams).
Code:
public OnPlayerTakeDamage(playerid, damagedid, Float: amount, weaponid)
{
        new Float:HP;
	GetPlayerHealth(damagedid, HP);
 	if(Team_1[playerid] == 1 && Team_1[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_2[playerid] == 1 && Team_2[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_3[playerid] == 1 && Team_3[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_4[playerid] == 1 && Team_4[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_5[playerid] == 1 && Team_5[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_6[playerid] == 1 && Team_6[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_7[playerid] == 1 && Team_7[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_8[playerid] == 1 && Team_8[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_9[playerid] == 1 && Team_9[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_10[playerid] == 1 && Team_10[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        return 1;
}
Rules displayed in the chat:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/rules", cmd, true) == 0)
	{
            SendClientMessage(playerid, 0xFFFFFF00, "Rule 1: Don't Hack.");
            SendClientMessage(playerid, 0xFFFFFF00, "Rule 2: Don't Spam.");
            SendClientMessage(playerid, 0xFFFFFF00, "Rule 3: Don't Flood.");
	    return 1;
	}
	return 0;
}
Commands displayed in the chat:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/commands", cmd, true) == 0)
	{
            SendClientMessage(playerid, 0xFFFFFF00, "Command 1: /slap [id].");
            SendClientMessage(playerid, 0xFFFFFF00, "Command 2: /givecash [id] [ammount].");
            SendClientMessage(playerid, 0xFFFFFF00, "Command 3: /spec [id].");
	    return 1;
	}
	return 0;
}
Reply
#4

^you could just use SetPlayerTeam..
Reply
#5

Yeah but the guy already has the teams made so he just has to replace Team_1-10 with the funtions to get the players team in his script.
Reply
#6

Quote:
Originally Posted by SickAttack
View Post
Yeah but the guy already has the teams made so he just has to replace Team_1-10 with the funtions to get the players team in his script.
What? You can use something very simple. Your code doesn't make sense..

(Basic code, do not copy and paste)
pawn Code:
new pAlreadySpawned[MAX_PLAYERS],
    pTeam[MAX_PLAYERS];

//Your code to let the player choose his/her team. In this code you'll set the pTeam variable

public OnPlayerSpawn(playerid)
{
    if(pAlreadySpawned[playerid] != 1)
    {
        pAlreadySpawned[playerid] = 1;
        SetPlayerTeam(playerid, pTeam[playerid]);
    }
    return 1;
}
The most efficient way is to set the player's team after he chose which team he'd like to join.
Reply
#7

Use SetPlayerTeam for your teams
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) == GetPlayerTeam(issuerid))
    {
        GameTextForPlayer(issuerid, "~r~Dont atack your team!", 2000, 6); return 0;    
    }
}
Reply
#8

Quote:
Originally Posted by Voxel
View Post
Use SetPlayerTeam for your teams
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) == GetPlayerTeam(issuerid))
    {
        GameTextForPlayer(issuerid, "~r~Dont atack your team!", 2000, 6); return 0;    
    }
}
I do not believe this works. If two players are in the same team, they can't damage each other.
Reply
#9

Quote:
Originally Posted by Biesmen
View Post
I do not believe this works. If two players are in the same team, they can't damage each other.
I use this method and without it players can still damage and kill each other (using /setplayerteam), without this they can team kill.
Reply
#10

Post your teams here and i will make it for you.
Reply


Forum Jump:


Users browsing this thread: