Kill condition
#1

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

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

Something like this?

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

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
}
}
Reply
#5

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.
Reply
#6

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");
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)