SA-MP Forums Archive
Kicking ip because they didn't logon to the game - 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: Kicking ip because they didn't logon to the game (/showthread.php?tid=564272)



Kicking ip because they didn't logon to the game - SpikY_ - 20.02.2015

Maybe you get to know what's actually my problem is by reading title!
When a player connect to server, The server get freezes and the player Couldn't Connect. it just say " Connected. Joining the game... " But after sometime! It says " Server Closed the Connection "
I think it is a problem of infinite loops. this problem occur with me once, i really don't know how to fix it!

is there is any code which prevent this error? if yes, then suggest me the codes so i can search it in my gamemode!
After reading This, i really didn't get the solution!


Re: Kicking ip because they didn't logon to the game - arad55 - 20.02.2015

Show your OnPlayerConnect public.


Re: Kicking ip because they didn't logon to the game - Maximus0 - 20.02.2015

Mellnik has stated a code that shows where you are getting the loop thrown.

Quote:
Originally Posted by Mellnik
View Post
There is another way to combat this using crashdetect.
Put this at the very top of your GM and use CTRL+H to replace any for by for___loop.

pawn Code:
#include <crashdetect>

#define for___loop(%1;%2;%3) \
    PrintAmxBacktrace(); \
    for(%1;%2;%3)
   
#define while___loop(%1) \
    PrintAmxBacktrace(); \
    while(%1)
This prints the call stack everytime a loop gets called. So as soon as you run into this problem simply open your server log and look for the last backtrace.

Code:
[03:34:13] [debug] AMX backtrace:
[03:34:13] [debug] #0 native PrintAmxBacktrace () [6cf42e23] from crashdetect.DLL
[03:34:13] [debug] #1 00001fa8 in main () at C:\server\gamemodes\test.pwn:30
The line number now directs you to the infinite loop in your script (Don't forget to compile with -d3 parameter)
Add this code on your script.