Anti Team-Kill Problem -
xXdaeminoXx - 19.04.2016
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
Re: Anti Team-Kill Problem -
zPain - 19.04.2016
SetPlayerTeam is the simplest way.
https://sampwiki.blast.hk/wiki/SetPlayerTeam
Re: Anti Team-Kill Problem -
Saliim - 19.04.2016
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;
}
Re: Anti Team-Kill Problem -
F1N4L - 19.04.2016
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;
}
Re: Anti Team-Kill Problem -
xXdaeminoXx - 19.04.2016
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 ?
Re: Anti Team-Kill Problem -
F1N4L - 19.04.2016
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.
Re: Anti Team-Kill Problem -
xXdaeminoXx - 19.04.2016
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 :/
Re: Anti Team-Kill Problem -
F1N4L - 19.04.2016
Example:
new gTeam[MAX_PLAYERS];
if(gTeam[playerid] == gTeam[damagedid])
Sorry my bad english
Re: Anti Team-Kill Problem -
xXdaeminoXx - 19.04.2016
and anti teamkill between USA and UK ?
Re: Anti Team-Kill Problem -
AdrianG - 20.04.2016
Use SetPlayerTeam in order to put someone in a team;
Use in
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float: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;
}