Jump to content

triggerServerEvent don't want to transfer data from client to server


ShohpBEK

Recommended Posts

Hello i'm trying to make triggerServerEvent but when i try to transfer data it's show that massage : clientside element 'marker' @argument 3 

what that even mean?

 



--Client side ---
GasMarker1 =nil
GasMarker2 =nil
GasMarker3 = nil
function createGasMarker ()

outputChatBox ("تم انشاء ماركرات المحطات",28,181,23)

GasMarker1 = createMarker (619.70190429688 , 1684.1682128906 , 4.9921875, "cylinder",2.0,255,255,255)
GasMarker2 = createMarker (617.69458007813 , 1686.0867919922 , 4.9921875 ,"cylinder",2.0,255,255,255)
GasMarker3 = createMarker (621.77709960938 , 1681.1126708984 , 4.9921875, "cylinder",2.0,255,255,255)


end
addEventHandler ("onClientResourceStart", root, createGasMarker)

function setGasMarkersVisible ()

 name = "Come!"
triggerServerEvent ("setVisible", root,GasMarker1 )



end
addEventHandler("onClientResourceStart" , root, setGasMarkersVisible)

-- Server Side --
function setMarkerVisible ()

--


end
addEvent("setVisible",true)
addEventHandler ("setVisible", root, setMarkerVisible)

 

Link to comment
  • Moderators
4 hours ago, ShohpBEK said:

what that even mean?

Clientside created elements are not available on serverside.

Those markers are already invisible for other clients/players as well as the server.

Edited by IIYAMA
Link to comment
7 hours ago, DNL291 said:

Probably because at the time of trigger the value isn't defined.
What are you trying to achieve anyway?

@ShohpBEK

Brother look at line 11 you will see that GasMarker1 = createMarker 
- i'm trying to transfer this Marker to server side to because i  need it to be non-visible

4 hours ago, IIYAMA said:

Clientside created elements are not available on serverside.

Those markers are already invisible for other clients/players as well as the server.

So who i can create Client elements that could be server elements?

Link to comment
  • Moderators
2 hours ago, ShohpBEK said:

So who i can create Client elements that could be server elements?

You can't. It might be fake-able with propagation, but I don't think that is what you want.

 

 

2 hours ago, ShohpBEK said:

- i'm trying to transfer this Marker to server side to because i  need it to be non-visible

That is not going to work, the serverside function will not be able to apply the effect on an clientside element.

 

What you need to do:

Destroy the marker  <--> recreate it.

 

Link to comment
  • Moderators

Passing the marker to the server-side isn't the algorithm you are looking for, this is just an algorithm task. Not to mention that this isn't gonna work as you have already been warned.

If you explain what's the purpose of your code we can help you to achieve it in a way it should work.

Besides that, you have a bad programming practice in your code like two similar events to which will trigger at the same time, also, calling the event "onClientResourceStart" for root will activate the attached function when any resource is started on the server.

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...