new inviterid = e_DuelInfo[playerid][E_DUEL_STARTER];
if(e_DuelInfo[inviterid][E_DUEL_LINEUP] == 1) {
format(string, sizeof(string), "[DUEL - 1vs1]: {FFFFFF}%s has won the duel against %s.", GetName(killerid), GetName(playerid));
SpawnUser(playerid);
SpawnUser(killerid);
e_DuelInfo[inviterid][E_DUEL_INVITED] = 0;
e_DuelInfo[inviterid][E_DUEL_ACCEPTED] = 0;
e_DuelInfo[playerid][E_DUEL_INVITED] = 0;
e_DuelInfo[playerid][E_DUEL_ACCEPTED] = 0;
}
if(e_DuelInfo[inviterid][E_DUEL_LINEUP] == 2) {
...
}
if(e_DuelInfo[inviterid][E_DUEL_LINEUP] == 3) {
...
}
E_DUEL_OPPONENT[3],
E_DUEL_TEAMMATE[2],
Hello! I would define two global variables, once per duelling team, and increase it for every player in a team; when dying if players are in a duel team decrease the variable. Once it's 0 the duel is over and the other team won.
|
// I will suppose that there are 2 duelling teams
#define TEAM_DUEL_ONE 0
#define TEAM_DUEL_TWO 1
#define MAX_DUEL_TEAMS 2
new InviterID,
InvitedID,
bool: IsPlayerInvitedToDuel[MAX_PLAYERS],
PlayersInTeam[MAX_DUEL_TEAMS]; // <- this will be important
// Somewhere, command or anything else after the duel invitation gets accepted
InviterID = playerid;
InvitedID = invitedid;
IsPlayerInvitedToDuel[playerid] = true;
IsPlayerInvitedToDuel[invitedid] = true;
PlayersInTeam[TEAM_DUEL_ONE]++; // playerid just joined team 1!
PlayersInTeam[TEAM_DUEL_TWO]++; // invitedid just joined team 2!
// Here we will ask to playerid and invitedid to add 2 players in their duelling team
// When someone accepts to join their squad increment PlayersInTeam and switch IsPlayerInvitedToDuel to true condition
// Now under OnPlayerDeath if IsPlayerInvitedToDuel[playerid] == true decrement PlayersInTeam[dead player team]
// If PlayersInTeam[TEAM_DUEL_ONE] <= 0 TEAM_DUEL_TWO wins and viceversa.
I know it's quite different from your code, sorry for that
PHP Code:
|