RemoveBuildingForPlayer - crash if player reconnects -
Dr.Einstein - 03.01.2014
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.
Re: RemoveBuildingForPlayer - crash if player reconnects -
Excelize - 03.01.2014
Just put it into a filterscript, it makes it much easier.(Atleast for me.)
So you can load/unload if it's bugged
Re: RemoveBuildingForPlayer - crash if player reconnects -
ikey07 - 03.01.2014
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;
}
}
AW: RemoveBuildingForPlayer - crash if player reconnects -
BigETI - 03.01.2014
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.
Re: RemoveBuildingForPlayer - crash if player reconnects -
Pottus - 03.01.2014
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.
Re: RemoveBuildingForPlayer - crash if player reconnects -
Dr.Einstein - 03.01.2014
I see, thanks for the extra info fellas. Well, at least I fixed the issue with Windows 8 players, whose game would freeze.
Re: RemoveBuildingForPlayer - crash if player reconnects -
DaRk_RaiN - 04.01.2014
Yep also happened to me in my server, only about 200 removed objects.
Re: RemoveBuildingForPlayer - crash if player reconnects -
ikey07 - 04.01.2014
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.
Re: RemoveBuildingForPlayer - crash if player reconnects -
Pottus - 04.01.2014
Quote:
Originally Posted by ikey07
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.
Re: RemoveBuildingForPlayer - crash if player reconnects -
rt-2 - 15.05.2017
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...
Re: RemoveBuildingForPlayer - crash if player reconnects -
Spmn - 15.05.2017
Quote:
Originally Posted by rt-2
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...
|
Not really... Crashes happen only when a certain amount of removed buildings is reached. So, your players get crashed only because you remove a lot of objects, and when they reconnect, that amount is doubled and most likely that limit is reached
Re: RemoveBuildingForPlayer - crash if player reconnects -
rt-2 - 16.05.2017
Quote:
Originally Posted by Spmn
Not really... Crashes happen only when a certain amount of removed buildings is reached. So, your players get crashed only because you remove a lot of objects, and when they reconnect, that amount is doubled and most likely that limit is reached
|
So you mean that "When removing the same object for a player, they will crash. Commonly, players crash when reconnecting to the server because the server removes buildings on OnPlayerConnect." from
https://sampwiki.blast.hk/wiki/RemoveBuildingForPlayer is wrong?
Anyway does anyone found a way to avoid re-removing buildings for players?
Thank you,
rt-2
Re: RemoveBuildingForPlayer - crash if player reconnects -
Spmn - 16.05.2017
Had around 100 buildings removed on my server. Players barely crashed when they reconnected after connection loss.
Re: RemoveBuildingForPlayer - crash if player reconnects -
NaS - 17.05.2017
Quote:
Originally Posted by rt-2
So you mean that "When removing the same object for a player, they will crash. Commonly, players crash when reconnecting to the server because the server removes buildings on OnPlayerConnect." from https://sampwiki.blast.hk/wiki/RemoveBuildingForPlayer is wrong?
Anyway does anyone found a way to avoid re-removing buildings for players?
Thank you,
rt-2
|
You can "test" whether or not objects were removed.
Remove a building that has a collision for players joining the server that did NOT have a timeout the last time he left (just like usual).
If someone joins who timed out the last time he left, teleport him onto that building. After a second or two, check the player's position. If the player is still on the object, call your RemoveBuildingForPlayer code. If he falls through, the buildings were already removed (the player didn't crash, but loose connection).
It's ugly, not 100% reliable but technically the only way to find out whether or not a building exists client side.
Make sure the player doesn't pause and there is enough time for syncing before checking, then it should all work well.
I do this on my server and did not have any issues with this (local as well as real server), except players can use hacks/mods to teleport/freeze them.
I run this test during the very first spawn, if the camera is placed/pointed somewhere else it won't even be visible - it just takes 3 seconds. You can show the Rules or similar during this time period.
Re: RemoveBuildingForPlayer - crash if player reconnects -
Spmn - 17.05.2017
I used a similar approach on a stunt server and it worked flawless:
1) teleport the player on
this object, right above the sea level
2) wait 1-2 seconds (IIRC, I made use of player's ping and/or fps for more accurate results)
3) use GetPlayerAnimationIndex() to detect if player was swimming or not
-> if player isn't swimming -> call remove building code, INCLUDING that object
-> else -> skip
I also had a library based on this, but I can't find it right now.
Re: RemoveBuildingForPlayer - crash if player reconnects -
rt-2 - 18.05.2017
Thats very nice ideas guys.
Thank you,
Re: RemoveBuildingForPlayer - crash if player reconnects -
Romz - 06.10.2017
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.
Re: RemoveBuildingForPlayer - crash if player reconnects -
][Noname][ - 06.10.2017
Code:
int RemovedBuilduing[1000];
int CountRemove;
void Remove(int objectid)
{
RemovedBuilduing[CountRemove]=objectid;
CountRemove++;
}
When CountRemove reach 1000 there is memory leak
it's how Kalcor did this function
Re: RemoveBuildingForPlayer - crash if player reconnects -
rt-2 - 02.12.2018
Quote:
Originally Posted by ][Noname][
Code:
int RemovedBuilduing[1000];
int CountRemove;
void Remove(int objectid)
{
RemovedBuilduing[CountRemove]=objectid;
CountRemove++;
}
When CountRemove reach 1000 there is memory leak
it's how Kalcor did this function
|
Is it fixed in the new DL version, because that would be very interesting.
I don't think this is even possible to fix in a fixes.inc fashion.