OnPlayerEditDynamicObject [HELP] "Going Insane!" +Rep
#1

Ok.. I've tried absolutely everything I can think of..

I need to make it so players cannot surf on the objects when editing them (furniture) because otherwise they can fly out of their house and I don't want that.

Does any one have any ideas for me? I've probably tried most of them but it's worth a shot to have a few ideas chucked at me.
Reply
#2

Easy solution, don't use dynamic objects when doing your edition use a create object then destroy it when your edition is complete and replace with a dynamic object AND/OR create a bounding box around the work area if the player goes outside the box teleport them back inside.

@Kar Doesn't work with playerobjects.
Reply
#3

https://sampwiki.blast.hk/wiki/GetPlayerSurfingObjectID
Reply
#4

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Easy solution, don't use dynamic objects when doing your edition use a create object then destroy it when your edition is complete and replace with a dynamic object AND/OR create a bounding box around the work area if the player goes outside the box teleport them back inside.

@Kar Doesn't work with playerobjects.
CreateObject is not sufficient because when editing the object it will appear in other players houses. Hence why I'm not using the GetPlayerSurfingObjectID.

EDIT: I was going to create dynamic cubes around the interiors but this also is not sufficient because certain interiors are not that simple to cover with a cube area and therefore the problem still persists.
Reply
#5

How is the problem going to persist, they may be able to go outside but as soon as they leave that cube area guess what they teleport back in you've basically exhausted all your options now. Your just going to have to bite the bullet and do it.

There is ONE more thing I just thought of actually use OnPlayerUpdate() and keep checking the constraints of the players movement if their position changes X amount +/- in XYZ then cancel the edit. They would then be limited to camera movements only and would only be able to edit an object from the spot the started editing the object from.

@BenzoAMG - Will not work as expected I'm pretty sure the dynamic area WILL not follow the object position until an edition is saved as the editor is local.
Reply
#6

I already told you a solution for this. When the player begins to edit the object, (AKA before EditObject or EditDynamicObject is used) save the player's position, save the object's position. Create a dynamic area that is accustomed to either the object or playerid (preferably playerid), then attach that to the object itself. When the callback 'OnPlayerEnterDynamicArea' is called (from Incognito's streamer plugin), check if the area is the one attached to the object, then cancel editing (CancelEdit or whatever it is for dynamic objects...), set the player back to their position that was previously saved. Set the object back to the position that it was originally saved in. Fixed.

NOTE: When creating the dynamic area, make sure the radius isn't that large.
Reply
#7

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
I already told you a solution for this. When the player begins to edit the object, (AKA before EditObject or EditDynamicObject is used) save the player's position, save the object's position. Create a dynamic area that is accustomed to either the object or playerid (preferably playerid), then attach that to the object itself. When the callback 'OnPlayerEnterDynamicArea' is called (from Incognito's streamer plugin), check if the area is the one attached to the object, then cancel editing (CancelEdit or whatever it is for dynamic objects...), set the player back to their position that was previously saved. Set the object back to the position that it was originally saved in. Fixed.

NOTE: When creating the dynamic area, make sure the radius isn't that large.
No this does not work sorry. Thanks for the idea but I've exhausted all options possible. And trust me I've done so many different types of checks in so many different ways NONE of them work sufficiently. So I had another idea to totally eliminate the problem. I'm going to set the player editing into a spectator state whilst editing. I won't allow the object position to be updated for other players and that should sort it out. Would probably make it easier for editing also. I'll have a play and see where I get with it.

Works like an absolute charm! Why didn't I think of doing that before? Doh!

Thanks for the suggestions guys!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)