SA-MP Forums Archive
Kill condition - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Kill condition (/showthread.php?tid=565902)



Kill condition - bigboy81 - 02.03.2015

how to make a condition if the player kills a cop?
I need that i make something..


AW: Kill condition - Nero_3D - 02.03.2015

Check in OnPlayerDeath if the playerid was in team cop and the killerid was a player and not in team cop


Re: AW: Kill condition - bigboy81 - 02.03.2015

Something like this?

Код:
if(gTeam[playerid] == 1 || gTeam[killerid] == 0)



Re: AW: Kill condition - 1fret - 02.03.2015

Quote:
Originally Posted by bigboy81
Посмотреть сообщение
Something like this?

Код:
if(gTeam[playerid] == 1 || gTeam[killerid] == 0)
pawn Код:
|| //  that mean or

Try this
If(gTeam[killerid] != TEAM_POLICE) // the ! Sign means not, so it checks if  the killer team is not team police . That's what its saying.
{
If(gTeam[playerid] == TEAM_POLICE) // this checks if the player that died is on team police
{
  //your code here
}
}



Re: AW: Kill condition - CalvinC - 02.03.2015

Quote:
Originally Posted by bigboy81
Посмотреть сообщение
Something like this?

Код:
if(gTeam[playerid] == 1 || gTeam[killerid] == 0)
If you use the default SetPlayerTeam function, use GetPlayerTeam to detect the player's team, otherwise it all depends how you define teams in your script.


AW: Kill condition - Nero_3D - 02.03.2015

If you use gTeam than it should look like
pawn Код:
if(killerid != INVALID_PLAYER_ID) { // thats pretty important because we don't count suicide
    if(gTeam[playerid] == TEAM_POLICE && gTeam[killerid] != TEAM_POLICE) {
        print("Player killed cop");
    }
}