05.04.2019, 20:05
I know it's quite different from your code, sorry for that
PHP Code:
// 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.