new Team1Kills = 0; new Team2Kills = 0;
public OnPlayerDeath(playerid, killerid, reason) { return1; }
public OnPlayerDeath(playerid, killerid, reason) { if(GetPlayerTeam(killerid) == 1) // Checks if the killer is in team 1 { // if the killer in team 1 it will increase the Team1Kills by 1 Team1Kills = Team1Kills + 1; // or you can use "Team1Kills += 1; } else if(GetPlayerTeam(killerid) == 2) // Checks if the killer is in team 2 { // if the killer in team 2 it will increase the Team2Kills by 1 Team2Kills = Team2Kills + 1; // or you can use "Team2Kills += 1; } return1; }
Alright, for example we have team 1 & team 2
we will create a variable to store the kills in Код:
new Team1Kills = 0; new Team2Kills = 0; so we will use Код:
public OnPlayerDeath(playerid, killerid, reason) { return1; } Код:
public OnPlayerDeath(playerid, killerid, reason) { if(GetPlayerTeam(killerid) == 1) // Checks if the killer is in team 1 { // if the killer in team 1 it will increase the Team1Kills by 1 Team1Kills = Team1Kills + 1; // or you can use "Team1Kills += 1; } else if(GetPlayerTeam(killerid) == 2) // Checks if the killer is in team 2 { // if the killer in team 2 it will increase the Team2Kills by 1 Team2Kills = Team2Kills + 1; // or you can use "Team2Kills += 1; } return1; } |
new BallasKills = 0; new GrovesKills = 0; new VagosKills = 0; new AztecasKills = 0;
public OnPlayerDeath(playerid, killerid, reason) { if(IsPlayerCapturing[killerid] == 1) { if(gTeam(killerid) == TEAM_BALLAS) { BallasKills = BallasKills + 1; } else if(gTeam(killerid) == TEAM_GROVES) { GrovesKills = GrovesKills + 1; } else if(gTeam(killerid) == TEAM_VAGOS) { VagosKills = VagosKills + 1; } else if(gTeam(killerid) == TEAM_AZTECAS) { AztecasKills = AztecasKills + 1; } } return 1; }
SetTimer("TurfWar",100000,0);
public TurfWar(playerid) { //here ??? return 1; }
if(TEAM_BALLAS > MAX_KILL){
GameTextForAll( "TEAM_BALLAS wins", 5000, 3 );
}
PHP код:
|
public TurfWarTimer(playerid) { if(zAttack[Beach] == 1 && BallasKills > MAX_TURF_KILLS) { zAttack[Beach] = 0; TeamCheck[Beach] == TEAM_BALLAS; SendClientMessageToAll(-1, "{FFD443}[ TurfWar ]: {FFE797}Ballas gang has won"); foreach(new i : Player) { if(gTeam[i] == TEAM_BALLAS) { SetPlayerScore(i, GetPlayerScore(i) + 5); } } } if(zAttack[Beach] == 1 && GrovesKills > MAX_TURF_KILLS) { zAttack[Beach] = 0; TeamCheck[Beach] == TEAM_GROVES; SendClientMessageToAll(-1, "{FFD443}[ TurfWar ]: {FFE797}Ballas gang has won"); foreach(new i : Player) { if(gTeam[i] == TEAM_GROVES) { SetPlayerScore(i, GetPlayerScore(i) + 5); } } } return 1; }