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? |
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; }
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; }
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; }
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.
|
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;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(GetPlayerTeam(playerid) == GetPlayerTeam(issuerid))
{
GameTextForPlayer(issuerid, "~r~Dont atack your team!", 2000, 6); return 0;
}
}
Use SetPlayerTeam for your teams
pawn Code:
|
I do not believe this works. If two players are in the same team, they can't damage each other.
|