Код:
public OnPlayerDisconnect(playerid, reason)
{
if (EnDuelo[playerid]==1)
{
for (new i=1; i<=ARENAS; i++)
{
if ((Duelos[i][DesaId] == playerid || Duelos[i][DesafiadoId] == playerid) && (Duelos[i][Libre]==1))
{
Duelos[i][Libre] = 0;
EnDuelo[Duelos[i][DesaId]] = 0;
EnDuelo[Duelos[i][DesafiadoId]] = 0;
if (playerid == Duelos[i][DesaId])
{
new string2[128];
format(string2,sizeof(string2),"Duelo Info: %s A Abandonado El Servidor En Medio De Un duelo, %s Es El Ganador Por Default.",PlayerName2(playerid),PlayerName2(Duelos[i][DesafiadoId]));
SendClientMessageToAll(COLOR_DUELO,string2);
PlayerInfo[playerid][Dlose] ++;
PlayerInfo[Duelos[i][DesafiadoId]][Dwin] ++;
switch (i)
{
case 1: {SetPlayerPos(Duelos[i][DesafiadoId],2626.5664,1206.4237,28.0004); SetPlayerFacingAngle(Duelos[i][DesafiadoId],274.9405); SetPlayerVirtualWorld(Duelos[i][DesafiadoId], 0);}
case 2: {SetPlayerPos(Duelos[i][DesafiadoId],-1562.8058,310.9799,53.4609); SetPlayerFacingAngle(Duelos[i][DesafiadoId],278.5559); SetPlayerVirtualWorld(Duelos[i][DesafiadoId], 0);}
case 3: {SetPlayerPos(Duelos[i][DesafiadoId],-2030.9362,-425.7924,71.554); SetPlayerFacingAngle(Duelos[i][DesafiadoId],145.0746); SetPlayerVirtualWorld(Duelos[i][DesafiadoId], 0); GivePlayerWeapon(Duelos[i][DesafiadoId],46,1);}
case 4: {SetPlayerPos(Duelos[i][DesafiadoId],2792.4976,-1455.7574,40.048); SetPlayerFacingAngle(Duelos[i][DesafiadoId],353.4433); SetPlayerVirtualWorld(Duelos[i][DesafiadoId], 0);}
}
for (new j=0; j<= MAX_PLAYERS; j++)
{
if (ViendoDuelo[j] == i)
{
new str2[256];
format(str2,sizeof(str2),"~r~%s ~w~Es El Ganador Del Duelo",PlayerName2(Duelos[i][DesafiadoId]));
GameTextForPlayer(j,str2,5000,0);
ViendoDuelo[j] =-1;
}
}
}
if (playerid == Duelos[i][DesafiadoId])
{
new string2[128];
format(string2,sizeof(string2),"Duelo Info: %s A Abandonado El Servidor En Medio De Un Duelo, %s Es El Ganador Por Default.",PlayerName2(playerid),PlayerName2(Duelos[i][DesaId]));
SendClientMessageToAll(COLOR_DUELO,string2);
PlayerInfo[playerid][Dlose] ++;
PlayerInfo[Duelos[i][DesaId]][Dwin] ++;
switch (i)
{
case 1: {SetPlayerPos(Duelos[i][DesaId],2626.5664,1206.4237,28.0004); SetPlayerFacingAngle(Duelos[i][DesaId],274.9405); SetPlayerVirtualWorld(Duelos[i][DesaId], 0);}
case 2: {SetPlayerPos(Duelos[i][DesaId],-1562.8058,310.9799,53.4609); SetPlayerFacingAngle(Duelos[i][DesaId],278.5559); SetPlayerVirtualWorld(Duelos[i][DesaId], 0);}
case 3: {SetPlayerPos(Duelos[i][DesaId],-2030.9362,-425.7924,71.554); SetPlayerFacingAngle(Duelos[i][DesaId],145.0746); SetPlayerVirtualWorld(Duelos[i][DesaId], 0); GivePlayerWeapon(Duelos[i][DesaId],46,1);}
case 4: {SetPlayerPos(Duelos[i][DesaId],2792.4976,-1455.7574,40.048); SetPlayerFacingAngle(Duelos[i][DesaId],353.4433); SetPlayerVirtualWorld(Duelos[i][DesaId], 0);}
}
for (new j=0; j<= MAX_PLAYERS; j++)
{
if (ViendoDuelo[j] == i)
{
new str2[256];
format(str2,sizeof(str2),"~r~%s ~w~Es El Ganador Del Duelo",PlayerName2(Duelos[i][DesaId]));
GameTextForPlayer(j,str2,5000,0);
ViendoDuelo[j] =-1;
SetPlayerVirtualWorld(j, 0);
}
}
}
Duelos[i][DesaId] = -1;
Duelos[i][DesafiadoId] = -1;
Duelos[i][ArmasId] = -1;
return 1;
}
}
}
PlayerInfo[playerid][Noduelo] = false;
return 1;
}