disconnect duel
#1

hey guys im trying to script a duel gm

ive done all of it... but 1 last code i need

when both players are in a duel, & 1 player disonnects leaves

the other player just gets left there... no score given and no spawn player


is there a code i can put on .... onplayerdisconnect

like InDuel[playerid] = 0; ... this does not work


can anyone help me.... if not i will search around , thx
Reply
#2

pawn Код:
new DuelOpponent[MAX_PLAYERS];
When the duel starts you save the playerid of the opponent in the variable of the current player:
pawn Код:
DuelOpponent[playerid] = opponentID;
Then, at OnPlayerDisconnect:
pawn Код:
if(InDuel[playerid == 1)
{
    new opponentID = DuelOpponent[playerid];
    //do all the stuff to 'opponentID' to get him out of the duel, give money, spawn, etc...
}
Reply
#3

On Top
pawn Код:
new DuelPlayer1, DuelPlayer2, InDuel[MAX_PLAYERS];
in your duel accepting code.
pawn Код:
DuelPlayer1 = playerid;
DuelPlayer2 = targetid;
under onplayerdisconnect.
pawn Код:
if(InDuel[playerid] == 1)
{
new string[128];
new Pname[MAX_PLAYER_NAME],Tname[MAX_PLAYER_NAME];
GetPlayerName(DuelPlayer1,Pname,sizeof(Pname));
GetPlayerName(DuelPlayer2,Tname,sizeof(Tname));

format(string, sizeof(string), "[Duel]: Duel Between %s and %s Ended Reason: Player Disconnected.",Pname, Tname);
SendClientMessageToAll(-1,string);
if(DuelPlayer1 == playerid)SpawnPlayer(DuelPlayer2), InDuel[DuelPlayer2] = 0;//Dont Touch This
if(DuelPlayer2 == playerid)SpawnPlayer(DuelPlayer1), InDuel[DuelPlayer1] = 0;//Dont Touch This
}
InDuel[playerid] = 0;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)