RemoveBuildingForPlayer - crash if player reconnects
#14

Quote:
Originally Posted by rt-2
View Post
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.
Reply


Messages In This Thread
RemoveBuildingForPlayer - crash if player reconnects - by Dr.Einstein - 03.01.2014, 04:41
Re: RemoveBuildingForPlayer - crash if player reconnects - by Excelize - 03.01.2014, 05:33
Re: RemoveBuildingForPlayer - crash if player reconnects - by ikey07 - 03.01.2014, 10:03
AW: RemoveBuildingForPlayer - crash if player reconnects - by BigETI - 03.01.2014, 12:57
Re: RemoveBuildingForPlayer - crash if player reconnects - by Pottus - 03.01.2014, 16:21
Re: RemoveBuildingForPlayer - crash if player reconnects - by Dr.Einstein - 03.01.2014, 18:59
Re: RemoveBuildingForPlayer - crash if player reconnects - by DaRk_RaiN - 04.01.2014, 18:50
Re: RemoveBuildingForPlayer - crash if player reconnects - by ikey07 - 04.01.2014, 20:17
Re: RemoveBuildingForPlayer - crash if player reconnects - by Pottus - 04.01.2014, 21:27
Re: RemoveBuildingForPlayer - crash if player reconnects - by rt-2 - 15.05.2017, 12:41
Re: RemoveBuildingForPlayer - crash if player reconnects - by Spmn - 15.05.2017, 15:39
Re: RemoveBuildingForPlayer - crash if player reconnects - by rt-2 - 16.05.2017, 12:24
Re: RemoveBuildingForPlayer - crash if player reconnects - by Spmn - 16.05.2017, 19:07
Re: RemoveBuildingForPlayer - crash if player reconnects - by NaS - 17.05.2017, 16:11
Re: RemoveBuildingForPlayer - crash if player reconnects - by Spmn - 17.05.2017, 19:09
Re: RemoveBuildingForPlayer - crash if player reconnects - by rt-2 - 18.05.2017, 00:54
Re: RemoveBuildingForPlayer - crash if player reconnects - by Romz - 06.10.2017, 02:19
Re: RemoveBuildingForPlayer - crash if player reconnects - by ][Noname][ - 06.10.2017, 13:31
Re: RemoveBuildingForPlayer - crash if player reconnects - by rt-2 - 02.12.2018, 19:52

Forum Jump:


Users browsing this thread: 3 Guest(s)