SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Bug Reports (https://forum.sa-mp.com/forumdisplay.php?f=20)
-   -   RemoveBuildingForPlayer - crash if player reconnects (https://forum.sa-mp.com/showthread.php?t=485132)

Dr.Einstein 03/01/2014 04:41 AM

RemoveBuildingForPlayer - crash if player reconnects
 
OK, so this is very weird. I have placed on OnPlayerConnect the function to remove the buildings for players. If a player loses connection and reconnects, that player's game will either crash or freeze. I did a lot of tests with this and still the game got stuck. I called the function once on OnPlayerSpawn but that still crashed me after I 'gmxed' the server. I also used a timer for this, but it gave me the same result. Moreover, I ran the function only one time for each player, meaning the first time the player connects, but the second time of connection, the server doesn't remove the objects.

PS: There are at least 600 objects that get removed.

Excelize 03/01/2014 05:33 AM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Just put it into a filterscript, it makes it much easier.(Atleast for me.)

So you can load/unload if it's bugged

ikey07 03/01/2014 10:03 AM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Remove only on spawn and once, after it, add stat which tells that player's objs is removed.

like

new Removed[MAX_PLAYERS];


OnPlayerSpawn()
{
if(!Removed[playerid])
{
//Remove script
Removed[playerid] = 1;
}


}

BigETI 03/01/2014 12:57 PM

AW: RemoveBuildingForPlayer - crash if player reconnects
 
We can't be sure, if a player has actually close his/her game or just loose his/her connection to the server and reconnects. (Sometimes bugged players can't send a quit request to the server, so they are going to be shown as "timed out"). A lot of RemoveBuildingForPlayer code can crash a player indeed, and if a player times out for a short period of time and reconnects, the script will execute RemoveBuildingForPlayer, even if the player has already the objects removed from his/her game.

It can be useful to unload "remove building" code after a player calls OnPlayerDisconnect(), but we don't have this feature yet in SA:MP.

Also a lot of "remove building" code can mess up dialog sync (a feature to prevent cheaters executing invalid/forbidden dialog IDs), making dialogs unable to use in the server.

Pottus 03/01/2014 04:21 PM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Another reason here why gmx is crappy :) anyways it's likely that your trying to remove objects too many times 600 is quite a lot to remove and it will usually start crashing players around 1000 objects.

Dr.Einstein 03/01/2014 06:59 PM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
I see, thanks for the extra info fellas. Well, at least I fixed the issue with Windows 8 players, whose game would freeze.

DaRk_RaiN 04/01/2014 06:50 PM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Yep also happened to me in my server, only about 200 removed objects.

ikey07 04/01/2014 08:17 PM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Well if you remove such area as LS docks, where is alot of same containers or lights, you can increase removed obj range, so you don't have to remove each one light/container.

Pottus 04/01/2014 09:27 PM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Quote:

Originally Posted by ikey07 (Post 2849698)
Well if you remove such area as LS docks, where is alot of same containers or lights, you can increase removed obj range, so you don't have to remove each one light/container.

Thumbs up to that suggestion, just take a look at the mapping section some of those maps could have some lines reduced by doing this.

rt-2 15/05/2017 12:41 PM

Re: RemoveBuildingForPlayer - crash if player reconnects
 
Still the main problem is that if a player loose connection for a second, it will crash him on reconnect, because if you remove the same building twice for a player he crashes, I'm trying to find a fix to it...


All times are GMT. The time now is 01:07 PM.

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