SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Bug Reports (https://forum.sa-mp.com/forumdisplay.php?f=20)
-   -   Server crashes when kicking a player inside OnPlayerStateChange (https://forum.sa-mp.com/showthread.php?t=662952)

Graber 16/01/2019 08:36 PM

Server crashes when kicking a player inside OnPlayerStateChange
 
When using Kick(playerid) inside OnPlayerStateChange, and the newstate is PLAYER_STATE_DRIVER, the server crashes:

0.3.DL Windows:
Code:

[22:11:08] [debug] Server crashed due to an unknown error
[22:11:08] [debug] Native backtrace:
[22:11:08] [debug] #0 004874d1 in ?? () in samp-server.exe
[22:11:08] [debug] #1 004950b3 in ?? () in samp-server.exe
[22:11:08] [debug] #2 777fb8d0 in ?? () in C:\WINDOWS\SYSTEM32\ntdll.dll

After making some internal debugging, it seems this happens because the server tries to use the player's pointer after calling the callback, but the pointed memory was already freed because the player was kicked.

rorrobryan 17/01/2019 06:41 PM

Re: Server crashes when kicking a player inside OnPlayerStateChange
 
It may be that you save the data wrong or you need to add a folder of logs in scriptfiles

Kaliber 18/01/2019 11:59 AM

Re: Server crashes when kicking a player inside OnPlayerStateChange
 
You have to use a small timer, to delay the kick :)


All times are GMT. The time now is 02:53 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.