I mostly understand, but when I triggered server event from client side (same resource), it can't be executed.
Okay, I have files:
:veh/client.lua, where included client GUI
:veh/server.lua, where this code will be triggered from client.lua:
addEvent("onVehicleBuyRequest", true)
addEventHandler("onVehicleBuyRequest", resourceRoot, function(model, price, px, py, pz, rx, ry, rz)
local veh = createVehicle (model, px, py, pz, rx, ry, rz)
--[blah blah blah]
outputChatBox ("Congratulations! You bought a ".. getVehicleNameFromModel(model) .."! Press F2 to see it!", source)
end)
If i wanna to call "onVehicleBuyRequest" from other resource, I will change
addEventHandler("onVehicleBuyRequest", resourceRoot, function(model, price, px, py, pz, rx, ry, rz)
to
addEventHandler("onVehicleBuyRequest", root, function(model, price, px, py, pz, rx, ry, rz)
But I don't wanna do this event available from other resource. I leave "resourceRoot". And... Script won't be executed. Why?
Edit: same problem with triggered event from serverside to clientside