SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 15/05/2017, 03:39 PM   #11
Spmn
Huge Clucker
 
Join Date: Jun 2015
Location: Romania
Posts: 461
Reputation: 91
Default Re: RemoveBuildingForPlayer - crash if player reconnects

Quote:
Originally Posted by rt-2 View Post
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
Spmn is offline   Reply With Quote
Old 16/05/2017, 12:24 PM   #12
rt-2
Huge Clucker
 
rt-2's Avatar
 
Join Date: Jun 2011
Location: Montréal, Québec, Canada
Posts: 240
Reputation: 18
Default Re: RemoveBuildingForPlayer - crash if player reconnects

Quote:
Originally Posted by Spmn View Post
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 http://wiki.sa-mp.com/wiki/RemoveBuildingForPlayer is wrong?

Anyway does anyone found a way to avoid re-removing buildings for players?
Thank you,
rt-2
__________________
rt-2
My hardcore first person 1994 simulation in development:
SA Advance Roleplay
rt-2 is offline   Reply With Quote
Old 16/05/2017, 07:07 PM   #13
Spmn
Huge Clucker
 
Join Date: Jun 2015
Location: Romania
Posts: 461
Reputation: 91
Default Re: RemoveBuildingForPlayer - crash if player reconnects

Had around 100 buildings removed on my server. Players barely crashed when they reconnected after connection loss.
Spmn is offline   Reply With Quote
Old 17/05/2017, 04:11 PM   #14
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: Germany
Posts: 1,040
Reputation: 254
Default Re: RemoveBuildingForPlayer - crash if player reconnects

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 http://wiki.sa-mp.com/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.
__________________
NaS is offline   Reply With Quote
Old 17/05/2017, 07:09 PM   #15
Spmn
Huge Clucker
 
Join Date: Jun 2015
Location: Romania
Posts: 461
Reputation: 91
Default Re: RemoveBuildingForPlayer - crash if player reconnects

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.
Spmn is offline   Reply With Quote
Old 18/05/2017, 12:54 AM   #16
rt-2
Huge Clucker
 
rt-2's Avatar
 
Join Date: Jun 2011
Location: Montréal, Québec, Canada
Posts: 240
Reputation: 18
Default Re: RemoveBuildingForPlayer - crash if player reconnects

Thats very nice ideas guys.
Thank you,
__________________
rt-2
My hardcore first person 1994 simulation in development:
SA Advance Roleplay
rt-2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] :: Anti-Reconnect Script. Avoid Auto Reconnects made by * tools! iPLEOMAX Includes 18 27/12/2013 01:53 PM
zGaming - reconnects. JizZy00 Scripting Help 1 25/05/2013 05:19 PM
Weapons after player reconnects ajwar Scripting Help 0 24/02/2013 05:34 PM
Player Crash DonWade Server Support 0 25/04/2012 11:19 PM
[Client Crash] RemoveBuildingForPlayer BigETI Bug Reports 0 08/04/2012 11:19 PM


All times are GMT. The time now is 01:28 AM.


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