Kar Posted April 2, 2019 Share Posted April 2, 2019 Okay, so I noticed when doing Quote mp.players.local.shared = {}; Idk if its because its an object, it doesn't get synced. But doing Quote mp.players.local.variable = true; Gets synced between players fine. Thus, if I want to do Quote mp.players.local.shared = {}; mp.players.local.shared.isTyping = true; This won't work when looping through players for example, Quote mp.events.add({ 'render' : (nametags) => { nametags.forEach( (nametag) => { let [player, x, y, distance] = nametag; if(player.shared.isTyping) { // } } } }); Will throw an error on the if statement line. Can we have variable objects and it's entries (keys & values) synced between players? Or is this too much of a bottleneck? Link to comment Share on other sites More sharing options...
ragempdev Posted April 2, 2019 Share Posted April 2, 2019 Are you sure "mp.players.local.variable = true;" actually gets synced (automatically)? If you want to get it synced, you should use shared data (get/setVariable). Link to comment Share on other sites More sharing options...
Kar Posted April 2, 2019 Author Share Posted April 2, 2019 (edited) It appeared to work, when I print another players' object, I can see extra variables that I added client side. Maybe its unintended situation... So let's say for example, I want to p2p sync when a player is typing... I have to send that data to the server and then ragemp syncs that everytime? I just see that getting effy with many players... but I guess I'll take that path. Edited April 2, 2019 by Kar Link to comment Share on other sites More sharing options...
materia Posted April 14, 2019 Share Posted April 14, 2019 No thats the way. Nothing else would the rage server do. It would send it from the client you were changing the variable to the server and the server would share the change of the client with all connected players. Just make an event on the server you call from a client changing a value like mp.events.add("changeData", function(thisPlayer, thisData, thisValue) { thisPlayer.setVariable(thisData, thisValue); }); and the client which starts typing will do something like: mp.events.callRemote("changeData", "isTyping", true); when he starts typing. Link to comment Share on other sites More sharing options...
Kar Posted April 15, 2019 Author Share Posted April 15, 2019 I understand, I know how to do the stuff, I already do it which is why I am suggesting or asking about this. Also using that for something like typing is too slow (client - server - clients). Try the stuff pls and understand why I am complaining. Variables seem to sync between clients anyway, intendedly or unintendedly. You can literally just do `mp.players.local.isTyping` and then check that whereever against other players. Link to comment Share on other sites More sharing options...
ragempdev Posted April 15, 2019 Share Posted April 15, 2019 5 hours ago, Kar said: You can literally just do `mp.players.local.isTyping` and then check that whereever against other players. It's just a random match, the client really won't do that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now