Jump to content

Make Client-side Object Visible Server-side


Recommended Posts

  • Moderators
If you want object movement made client-side be visible for all players, then do it for all players. MTA doesn't need to have a function for attaching elements to bones. You can already make it yourself. Actually, it would be better to create such attaching system and then use it for helmet. Attaching system could be done in this way:

Attachments would be set by changing element data. Something like:

setElementData(object,"attached_player",player) 
setElementData(object,"attached_boneid",boneid) 

This could be done server-side. Then in client side onClientRender you could loop through all objects, check attachment data and if it exists, get the position of player bone and put an object there.

And after creating attachments system, you could use it for helmets. What's more, you could use it for other stuff without the need to rewrite the code.

So it's the client who update the position for his player. I like that ! ^^ so the server does almost anything. Very good idea :idea:

Einheit-101 :arrow: make your system by this way

Link to comment

I hope you understand how it works, and that some people learned something and stop spreading "single copmuter - server is the only true way - SAMP type of thinking" ;)

PS: this may be esential:

server

addEventHandler ( "onPlayerQuit", getRootElement(),function() 
    helmlist[source] = nil 
end ) 

client

addEventHandler( "onClientPlayerQuit", getRootElement(), function() 
    helmart[source] = nil 
    destroyElement(helm[source]) 
    helm[source] = nil 
end ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...