victormgons Posted October 11, 2015 Share Posted October 11, 2015 (edited) Hi... I'm trying to set an ID to a marker. I set the ID in client-side, but I can't load in server-side. Client-side: id = 1 mk1 = createMarker(x,y,z-1,"cylinder",3.5,0,255,0,170) setElementData(mk1,"ID",id) Server-side: for _,mark in pairs(getElementsByType("marker")) do if getElementData(mark,"ID") then outputChatBox(ID,getRootElement()) end end But it doesn't output nothing... But if I put all in client-side, or in server-side it works, but I need it like this... Can anyone help me please? Edited October 12, 2015 by Guest Link to comment
victormgons Posted October 11, 2015 Author Share Posted October 11, 2015 When I use: for _,mark in pairs(getElementsByType("marker")) do in server-side it doesn't find the markers that I created in client-side, how can I fix it? Link to comment
ozulus Posted October 11, 2015 Share Posted October 11, 2015 Output is nothing because ID isn't defined. Use this code. It outputs marker id or false for _,mark in pairs(getElementsByType("marker")) do if getElementData(mark,"ID") then outputChatBox(getElementData(mark,"ID"),getRootElement()) else outputChatBox(getElementData(mark,"ID"),getRootElement()) end end Link to comment
MIKI785 Posted October 12, 2015 Share Posted October 12, 2015 The marker is created clientsided so obviously it doesnt exist on the server. Link to comment
KariiiM Posted October 12, 2015 Share Posted October 12, 2015 for _,mark in pairs(getElementsByType("marker")) do if getElementData(mark,"ID") then outputChatBox(ID,getRootElement()) end end You can't get the string "ID" inside getElementData without defining it Link to comment
AMARANT Posted October 12, 2015 Share Posted October 12, 2015 for _,mark in pairs(getElementsByType("marker")) do if getElementData(mark,"ID") then outputChatBox(ID,getRootElement()) end end You can't get the string "ID" inside getElementData without defining it It won't solve the problem. He won't be able to get his client-side marker on the server. Link to comment
victormgons Posted October 12, 2015 Author Share Posted October 12, 2015 I made all in server-side, thx for the help Solved! Link to comment
KariiiM Posted October 14, 2015 Share Posted October 14, 2015 It won't solve the problem. He won't be able to get his client-side marker on the server. He can with trigger Link to comment
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