SA-MP Forums Archive
OnPlayerDisconnect gets called... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDisconnect gets called... (/showthread.php?tid=411012)



OnPlayerDisconnect gets called... - Skimmer - 27.01.2013

Hello SA-MP Community,

i started to scripted my own Deathmatch Server. Everything was going without any problem, but since today i got a little bug and i started to hate it. I can't fix it, tried too many things.

The problem is, if i join the server and when i spawn and press ANY Key (like LMB, SPACE etc. without W, A, S, E) the server says that i've disconnected the server so i added a client message below onplayerdisconnect, so if anyone quits the server will send message to all. Every 2 - 3 seconds the server says i'm disconnected, but I'M NOT DISCONNECTED, i still walking, connected etc.

I use MySQL and Textdraws on my script. I also have a system so if someone press LMB and JUMP key the server will close a textdraw on his screen.

I can't post any script right now, because i don't know WHERE the problem is.


Re: OnPlayerDisconnect gets called... - zDevon - 27.01.2013

Post your OnPlayerKeyStateChange callback. It sounds like something in there is causing the server to crash, and in turn you are disconnected.


AW: OnPlayerDisconnect gets called... - Skimmer - 27.01.2013

Sure, i use also an own include and i use OnPlayerKeyStateChange callback there with hooking.
On my Gamemode i don't have anything and here's my include.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_FIRE) || PRESSED(KEY_JUMP))
    {
        TextDrawHideForPlayer(playerid, Stats[playerid]);
    }
    return CallLocalFunction("menu_OnPlayerDisconnect", "iii", playerid, newkeys, oldkeys);
}

#if defined _ALS_OnPlayerKeyStateChange
    #undef OnPlayerKeyStateChange
#else
    #define _ALS_OnPlayerKeyStateChange
#endif
#define OnPlayerKeyStateChange menu_OnPlayerKeyStateChange
forward menu_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
Nothing too much and i don't see any error there.


AW: OnPlayerDisconnect gets called... - Skimmer - 28.01.2013

Sorry, but i need to bump. I don't have too much time.


AW: OnPlayerDisconnect gets called... - Skimmer - 28.01.2013

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
Sure, i use also an own include and i use OnPlayerKeyStateChange callback there with hooking.
On my Gamemode i don't have anything and here's my include.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_FIRE) || PRESSED(KEY_JUMP))
    {
        TextDrawHideForPlayer(playerid, Stats[playerid]);
    }
    return CallLocalFunction("menu_OnPlayerDisconnect", "iii", playerid, newkeys, oldkeys);
}

#if defined _ALS_OnPlayerKeyStateChange
    #undef OnPlayerKeyStateChange
#else
    #define _ALS_OnPlayerKeyStateChange
#endif
#define OnPlayerKeyStateChange menu_OnPlayerKeyStateChange
forward menu_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
Nothing too much and i don't see any error there.
pawn Код:
return CallLocalFunction("menu_OnPlayerDisconnect", "iii", playerid, newkeys, oldkeys);
Lol, i really didn't see it. There is menu_OnPlayerDisconnect i just changed it and it works now really thank you.