Spice Posted July 12, 2015 Share Posted July 12, 2015 (edited) -- server function Vehicle (Model) local x, y, z = getElementPosition(source) local war = createVehicle (Model, x, y, z) warpPedIntoVehicle (thePlayer, war) end addEvent ( "create", true ) addEventHandler ( "create", root, Vehicle) --Client Model = guiGridListGetItemText ( grid1, guiGridListGetSelectedItem ( grid1 ), 1 ) triggerServerEvent ( "create", resourceRoot, Model ) [22:51:54] WARNING: Pilot\server.lua:18: Bad argument @ 'warpPedIntoVehicle' [Ex pected ped at argument 1, got nil] Why it's not wokring Edited July 12, 2015 by Guest Link to comment
GTX Posted July 12, 2015 Share Posted July 12, 2015 What are you trying to do? What does veh variable return? Any errors? We need more informations. Link to comment
Spice Posted July 12, 2015 Author Share Posted July 12, 2015 What are you trying to do? What does veh variable return? Any errors? We need more informations. Done Link to comment
GTX Posted July 12, 2015 Share Posted July 12, 2015 Variable thePlayer is not defined and you're passing resourceRoot via triggerServerEvent. Server: function Vehicle (Model) local x, y, z = getElementPosition(source) local war = createVehicle (Model, x, y, z) warpPedIntoVehicle (source, war) end addEvent ( "create", true ) addEventHandler ( "create", root, Vehicle) Client: Model = guiGridListGetItemText ( grid1, guiGridListGetSelectedItem ( grid1 ), 1 ) triggerServerEvent ( "create", localPlayer, Model ) Link to comment
Spice Posted July 12, 2015 Author Share Posted July 12, 2015 Variable thePlayer is not defined and you're passing resourceRoot via triggerServerEvent.Server: function Vehicle (Model) local x, y, z = getElementPosition(source) local war = createVehicle (Model, x, y, z) warpPedIntoVehicle (source, war) end addEvent ( "create", true ) addEventHandler ( "create", root, Vehicle) Client: Model = guiGridListGetItemText ( grid1, guiGridListGetSelectedItem ( grid1 ), 1 ) triggerServerEvent ( "create", localPlayer, Model ) Thanks man but [23:00:46] WARNING: Pilot\server.lua:18: Bad argument @ 'warpPedIntoVehicle' [Ex pected vehicle at argument 2, got boolean] Link to comment
GTX Posted July 12, 2015 Share Posted July 12, 2015 function Vehicle (Model) local x, y, z = getElementPosition(source) local war = createVehicle (Model, x, y, z) setTimer(warpPedIntoVehicle, 100, 1, source, war) end addEvent ( "create", true ) addEventHandler ( "create", root, Vehicle) Link to comment
Spice Posted July 12, 2015 Author Share Posted July 12, 2015 still the same error, i think war returns true not the vehicle Link to comment
GTX Posted July 12, 2015 Share Posted July 12, 2015 How? Is the vehicle created? Try this: function Vehicle (Model) local x, y, z = getElementPosition(source) local war = createVehicle (tonumber(Model), x, y, z) setTimer(warpPedIntoVehicle, 100, 1, source, war) end addEvent ( "create", true ) addEventHandler ( "create", root, Vehicle) Link to comment
Spice Posted July 12, 2015 Author Share Posted July 12, 2015 How? Is the vehicle created? Try this: function Vehicle (Model) local x, y, z = getElementPosition(source) local war = createVehicle (tonumber(Model), x, y, z) setTimer(warpPedIntoVehicle, 100, 1, source, war) end addEvent ( "create", true ) addEventHandler ( "create", root, Vehicle) The vehicle don't get created 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