Jump to content

triggered serverside event onPlayer(resource)Start, but event is not added serverside


Zuher Laith

Recommended Posts

Hi
I'm getting a error on debugscript each time I start the resource,

Spoiler

Error output:

Quote

[13:15:14] ERROR: Client (Zuher) triggered serverside event onPlayer(ResourceName)Start, but event is not added serverside

Code:


-- client side:
function initGUI()
		triggerServerEvent( "vendInit", resourceRoot );
end
addEventHandler( "onClientResourceStart", resourceRoot, initGUI )

-- server side
function vendInit( )
    -- code and stuff
end
addEvent( "vendInit", true )
addEventHandler( "vendInit", resourceRoot, vendInit )

 

could anyone explain to me the cause of this error ?
Thanks for any help ..

Link to comment
  • Moderators

A triggerServerEvent is used to communicate with the server. It is required that the event is added serverside before used.

addEvent("onPlayer(ResourceName)Start", true)

The addEvent function will make sure that the event is added. (serverside in your case)

  • The first argument is the event name "onPlayer(ResourceName)Start".
  • The second argument will enable events from a different side (client/server). If set to false you can't use triggerServerEvent/triggerClientEvent, only triggerEvent to activate it.

For more information: https://wiki.multitheftauto.com/wiki/AddEvent

  • Thanks 1
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...