SA-MP Forums Archive
[Ajuda] OnPlayerDisconnect nao й chamado - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] OnPlayerDisconnect nao й chamado (/showthread.php?tid=478611)



OnPlayerDisconnect nao й chamado - iTzDemon - 30.11.2013

Como o titulo diz, a callback nao й chamada. Algumas dicas?

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    printf("> players: %d",GetPlayers());
    SaveAccount(playerid);
    new string[1024];
    switch(reason)
    {
        case 0: format(string, sizeof(string), "O jogador {ffffff}%s {2CF52C}[{ffffff}ID:%d{2CF52C}] caiu/crashou do servidor.[{ffffff}%d/%d{2CF52C}]", GetPlayerNameEx(playerid),playerid,GetPlayers(),GetMaxPlayers());
        case 1: format(string, sizeof(string), "O jogador {ffffff}%s {2CF52C}[{ffffff}ID:%d{2CF52C}] abandonou o servidor.[{ffffff}%d/%d{2CF52C}]", GetPlayerNameEx(playerid),playerid,GetPlayers(),GetMaxPlayers());
    }
    SendClientMessageToAll(COLOR_GREEN,string);
    if(TeamAlien[playerid] == 1) TeamAlien[playerid] = 0, Aliens--;
    if(TeamHuman[playerid] == 1) TeamHuman[playerid] = 0, Humans--;
    PlayerInfo[playerid][Kills] = 0;
    PlayerInfo[playerid][Deaths] = 0;
    PlayerInfo[playerid][Vip] = 0;
    PlayerInfo[playerid][Admin] = 0;
    PlayerInfo[playerid][Prenda] = 0;
    return 1;
}



Re: OnPlayerDisconnect nao й chamado - Juniiro3 - 30.11.2013

Faz debug na callback, talvez ela seja chamada atй uma parte e depois trave.


Re: OnPlayerDisconnect nao й chamado - iTzDemon - 30.11.2013

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    print("Foi chamada");
    return 1;
}
nem isso chama


Re: OnPlayerDisconnect nao й chamado - GReeN_WOoD - 30.11.2013

PHP код:
new string[1024]; 
Nгo precisa disto..

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
printf("> players: %d",GetPlayers());
    
SaveAccount(playerid);
    new 
Motivo[20];
    if(
reason == 0Motivo "Queda de conexгo";
    if(
reason == 1Motivo "Conta prуpria";
    if(
reason == 2Motivo "Kickado/Banido";
    new 
saiufdps[128];
    
format(saiufdpssizeof(saiufdps), "%s [ID: %d] saiu do servidor. (%s) [{ffffff}%d/%d{2CF52C}]"GetPlayerNameEx(playerid), playeridMotivoGetPlayers(),GetMaxPlayers());
    
SendClientMessageToAll(COLOR_GREEN,saiufdps);
    if(
TeamAlien[playerid] == 1TeamAlien[playerid] = 0Aliens--;
    if(
TeamHuman[playerid] == 1TeamHuman[playerid] = 0Humans--;
    
PlayerInfo[playerid][Kills] = 0;
    
PlayerInfo[playerid][Deaths] = 0;
    
PlayerInfo[playerid][Vip] = 0;
    
PlayerInfo[playerid][Admin] = 0;
    
PlayerInfo[playerid][Prenda] = 0;
    return 
1;




Re: OnPlayerDisconnect nao й chamado - iTzDemon - 30.11.2013

Quote:
Originally Posted by GReeN_WOoD
Посмотреть сообщение
PHP код:
new string[1024]; 
Nгo precisa disto..

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
printf("> players: %d",GetPlayers());
    
SaveAccount(playerid);
    new 
Motivo[20];
    if(
reason == 0Motivo "Queda de conexгo";
    if(
reason == 1Motivo "Conta prуpria";
    if(
reason == 2Motivo "Kickado/Banido";
    new 
saiufdps[128];
    
format(saiufdpssizeof(saiufdps), "%s [ID: %d] saiu do servidor. (%s) [{ffffff}%d/%d{2CF52C}]"GetPlayerNameEx(playerid), playeridMotivoGetPlayers(),GetMaxPlayers());
    
SendClientMessageToAll(COLOR_GREEN,saiufdps);
    if(
TeamAlien[playerid] == 1TeamAlien[playerid] = 0Aliens--;
    if(
TeamHuman[playerid] == 1TeamHuman[playerid] = 0Humans--;
    
PlayerInfo[playerid][Kills] = 0;
    
PlayerInfo[playerid][Deaths] = 0;
    
PlayerInfo[playerid][Vip] = 0;
    
PlayerInfo[playerid][Admin] = 0;
    
PlayerInfo[playerid][Prenda] = 0;
    return 
1;

mas nao й esse o problema cara, a callback й que nao ta a ser chamada


Re: OnPlayerDisconnect nao й chamado - GReeN_WOoD - 30.11.2013

Tenta fazer um DEBUG nas outras callbacks.. e me diz o resultado.


Re: OnPlayerDisconnect nao й chamado - iTzDemon - 30.11.2013

as outras estao sendo chamadas normalmente


Re: OnPlayerDisconnect nao й chamado - GReeN_WOoD - 30.11.2013

Coloque o nome de todas as includes que vocк estб usando aqui, talvez alguma delas esteja com um "hook".


Re: OnPlayerDisconnect nao й chamado - iTzDemon - 30.11.2013

pawn Код:
#include <a_samp>
#include <DOF2>
#include <OPSP>
#include <pbAntiCheater>
#include <sscanf2>
#include <zcmd>
#include <streamer>



Re: OnPlayerDisconnect nao й chamado - GReeN_WOoD - 30.11.2013

PHP код:
//#include <OPSP>
//#include <pbAntiCheater> 
Tente tirar os sistemas que usam estas includes, deixam as inativas usando '//'
Depois que estas includes forem retiradas, teste o OnPlayerDisconnect.

Isto serб para identificar se o problema estб nas includes, tenho quase certeza que sim, qualquer coisa contate-me skype: Sr.Pink