justn Posted April 13, 2014 Share Posted April 13, 2014 The problem is, the player cant enter the vehicle, and he doesnt get warped into it Client: addEventHandler("onClientGUIDoubleClick",CaptainJob_Window, function(b) if b == "left" then if source == CaptainJob_Grid then Location1 = guiGridListGetSelectedItem(CaptainJob_Grid, CaptainJob_Row, CaptainJob_Location ) Money_Location = guiGridListGetSelectedItem(CaptainJob_Grid, CaptainJob_Row, CaptainJob_Money ) if ( Location1 ) then x, y, z = unpackDestinations () CaptainMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) CaptainAttachedBlip = createBlipAttachedTo(CaptainMarker,9) CaptainVehicle = createVehicle(472,2430.1584472656,-2298.5764160156,-0.55000001192093) triggerServerEvent("warpIntoBoat",localPlayer,thePlayer,CaptainVehicle) setElementVisibleTo( CaptainAttachedBlip, localPlayer, true ) setElementVisibleTo( CaptainAttachedBlip, root, false ) elseif not ( Location1 ) then outputChatBox ( "You haven't selected a location", 255, 255, 255 ) end end end end) Server: function warpIntoBoat(thePlayer,CaptainVehicle) warpPedIntoVehicle(thePlayer,CaptainVehicle) end addEvent("warpIntoBoat",true) addEventHandler("warpIntoBoat",getRootElement(),warpIntoBoat) Link to comment
manawydan Posted April 13, 2014 Share Posted April 13, 2014 because vehicle is client side, try createVehicle in server side Link to comment
manawydan Posted April 13, 2014 Share Posted April 13, 2014 wiki "say": 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. Link to comment
justn Posted April 13, 2014 Author Share Posted April 13, 2014 Now i tried this and it dont work. Server: function warpIntoBoat() CaptainVehicle = createVehicle(472,2430.1584472656,-2298.5764160156,-0.55000001192093) warpPedIntoVehicle(source,CaptainVehicle) end addEvent("warpIntoBoat",true) addEventHandler("warpIntoBoat",getRootElement(),warpIntoBoat) Client: addEventHandler("onClientGUIDoubleClick",CaptainJob_Window, function(b) if b == "left" then if source == CaptainJob_Grid then Location1 = guiGridListGetSelectedItem(CaptainJob_Grid, CaptainJob_Row, CaptainJob_Location ) Money_Location = guiGridListGetSelectedItem(CaptainJob_Grid, CaptainJob_Row, CaptainJob_Money ) if ( Location1 ) then x, y, z = unpackDestinations () CaptainMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) CaptainAttachedBlip = createBlipAttachedTo(CaptainMarker,9) triggerServerEvent("warpIntoBoat",localPlayer) setElementVisibleTo( CaptainAttachedBlip, localPlayer, true ) setElementVisibleTo( CaptainAttachedBlip, root, false ) elseif not ( Location1 ) then outputChatBox ( "You haven't selected a location", 255, 255, 255 ) end end end end) Link to comment
manawydan Posted April 13, 2014 Share Posted April 13, 2014 try use one timer in warpPedIntoVehicle and change source to client Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now