Anti Team-Kill Problem
#1

Hello guys,

i have problem with Anti Team-Kill between more teams.
Anti teamkill between USArmy and United Kingdom Forces or SAS and Spetsnaz.

Please give me answer, how to make multi anti team-kill between more teams. NOT between players in one team
Reply
#2

SetPlayerTeam is the simplest way.

https://sampwiki.blast.hk/wiki/SetPlayerTeam
Reply
#3

Hi bro, use that :
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)//This callback is called when a player gives damage to another player.
{
if (GetPlayerTeam(playerid) != NO_TEAM && GetPlayerTeam(playerid) == GetPlayerTeam(damagedid)) {
    	GameTextForPlayer(playerid, "~w~Hey~>~~r~STOP KILL", 2000, 3);
}
return 1;
}
Reply
#4

No give damage
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    new Float:pHealth;
    GetPlayerHealth(damagedid, pHealth);
   
    if(damagedid != INVALID_PLAYER_ID)
    {
        if(GetPlayerTeam(playerid) == GetPlayerTeam(damagedid))
            return SetPlayerHealth(damagedid, pHealth);
    }
    return 1;
}
Reply
#5

I want Multi Anti team kill between 3 teams not 3 players. -_- i want to set Anit team killing between USA UK and Russia Teams. and SetPlayerTeam i never use because i dont have time to rebuild an all parts of Team System. Who have here somthing usefull ?
Reply
#6

Quote:
Originally Posted by xXdaeminoXx
Посмотреть сообщение
I want Multi Anti team kill between 3 teams not 3 players. -_- i want to set Anit team killing between USA UK and Russia Teams. and SetPlayerTeam i never use because i dont have time to rebuild an all parts of Team System. Who have here somthing usefull ?
Change GetPlayerTeam for the variable that you define.
GetPlayerTeam is just one example.
Reply
#7

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
No give damage
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    new Float:pHealth;
    GetPlayerHealth(damagedid, pHealth);
   
    if(damagedid != INVALID_PLAYER_ID)
    {
        if(GetPlayerTeam(playerid) == GetPlayerTeam(damagedid))
            return SetPlayerHealth(damagedid, pHealth);
    }
    return 1;
}
if(gTeam(playerid) == gTeam(damagedid) or if(TEAM_USA(playerid) == TEAM_UK(damagedid) ? i dont understand good english language. simple answer please :/
Reply
#8

Example:

new gTeam[MAX_PLAYERS];

if(gTeam[playerid] == gTeam[damagedid])

Sorry my bad english
Reply
#9

and anti teamkill between USA and UK ?
Reply
#10

Use SetPlayerTeam in order to put someone in a team;
Use in
PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
     if(
hittype==BULLET_HIT_TYPE_PLAYER//hit a player
               
if(GetPlayerTeam(playerid)==GetPlayerTeam(hitid)) //the same team
                           
return 0;       // block the shot
     
return 1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)