Posts: 232
Threads: 36
Joined: Oct 2012
Reputation:
0
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.
Posts: 352
Threads: 33
Joined: May 2013
Reputation:
0
Just put it into a filterscript, it makes it much easier.(Atleast for me.)
So you can load/unload if it's bugged
Posts: 1,167
Threads: 57
Joined: Jul 2010
Reputation:
0
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;
}
}
Posts: 1,046
Threads: 29
Joined: Mar 2010
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.
Posts: 232
Threads: 36
Joined: Oct 2012
Reputation:
0
I see, thanks for the extra info fellas. Well, at least I fixed the issue with Windows 8 players, whose game would freeze.
Posts: 973
Threads: 10
Joined: Sep 2012
Reputation:
0
Yep also happened to me in my server, only about 200 removed objects.
Posts: 1,167
Threads: 57
Joined: Jul 2010
Reputation:
0
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.
Posts: 342
Threads: 34
Joined: Jun 2011
Reputation:
0
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...
Posts: 513
Threads: 4
Joined: Jun 2015
Reputation:
0
Had around 100 buildings removed on my server. Players barely crashed when they reconnected after connection loss.
Posts: 342
Threads: 34
Joined: Jun 2011
Reputation:
0
Thats very nice ideas guys.
Thank you,
Posts: 1,042
Threads: 46
Joined: Jun 2013
This bug is still present. It is necessary that Kalcor made after reconnect so that the remote objects returned to their places. Players complain, I do not know how to solve this problem.
It would also be cool to add a function that checks if the objects are removed from the player or not. In this case, it would be possible to simply check and, if necessary, delete objects on the connection.