Jump to content

event is not added a clientside mta


Looky

Recommended Posts

Posted

=== server=side
function markerHit(markerHit,matchingDimension)
	if (matchingDimension) then -- Make sure the player is in the same dimension as the marker (so they're actually going into it).
        outputChatBox("You have just entered a marker.",source,255,255,0) -- Output that they are.
        triggerClientEvent ( source, "startMaking", source, markerdata )
	end 
end
addEventHandler("onPlayerMarkerHit", root,markerHit)
----

--Client=side
function startMake(data)
    markerdata = data
    print(inspect(data))
    addEventHandler ("onClientRender", localPlayer, isInMarker )
end

addEvent("startMaking", true)
addEventHandler("startMaking", localPlayer, startMake)
-----

Where I made a mistake?

  • Moderators
Posted (edited)

@Looky

Either:

  • You have an error in your client code. (which stops the code from starting) Check the debug console.
  • The clientside script isn't set in the meta.xml as clientside. (but as "server" - side or without type which is also serverside)
  • You hit the marker before your client script has been loaded. (happens when your download transfer bar is visible)
  • If serverside is in another resource as clientside. Both resources have to be running.

 

Info: This line decides if the event is added or not.

addEvent("startMaking", true)

 

 

Edited by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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