Jump to content

triggerServerEvent problem


Tox

Recommended Posts

hello everyone, i am trying to make a garbage collector job i'm having some problems that i don't understand why. so my event "garbage.warpPedIntoVehicle" won't work and i don't know why, if i get it out of the chunk it works ok but with this it just returns false

client

    
local Garbage = {} 
 local x, y, z = getMarkerPosition () 
    localPlayer:setModel(309) 
    Garbage.vehicle = createVehicle (408, x-2, y, z+2) 
     
    inMission = true 
     
    if isElement (Garbage.vehicle) then 
        if triggerServerEvent("garbage.warpPedIntoVehicle", localPlayer, Garbage.vehicle) then  
            outputChatBox ("aye") 
        else 
            outputChatBox ("nay2") 
        end  
    else 
        outputChatBox ("nay") 
    end  
     

server

addEvent ("garbage.warpPedIntoVehicle", true)  
addEventHandler ("garbage.warpPedIntoVehicle", root,  
    function (vehicle) 
        outputChatBox ("aye2") 
        warpPedIntoVehicle (client, vehicle) 
    end 
)  

Link to comment

"Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only."

Why do you even create the vehicle clientsided?

Or use setElementModel?

Link to comment
"Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only."

Why do you even create the vehicle clientsided?

Or use setElementModel?

well, let's say i tried to make code smaller. but uh i thought it was synced, thanks

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