victormgons Posted October 11, 2015 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
victormgons Posted October 11, 2015 Author 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?
ozulus Posted October 11, 2015 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
MIKI785 Posted October 12, 2015 Posted October 12, 2015 The marker is created clientsided so obviously it doesnt exist on the server.
KariiiM Posted October 12, 2015 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
AMARANT Posted October 12, 2015 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.
victormgons Posted October 12, 2015 Author Posted October 12, 2015 I made all in server-side, thx for the help Solved!
KariiiM Posted October 14, 2015 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
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