Dazee Posted September 10, 2015 Share Posted September 10, 2015 WARNING: job_limodriver\limodriver_veh_c.lua:40: Bad argument @ 'warpPedIntoVehicle'[Expected ped at argument 1, got nil] I get that error in debugscript when i try to spawn a vehicle and it does spawn it but never warps the player in the car GUIEditor = { gridlist = {}, window = {}, button = {} } function openLimoVeh() GUIEditor.window[1] = guiCreateWindow(683, 306, 305, 359, "Job Vehicle Spawner", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(10, 23, 284, 282, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Vehicles", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Limo", false, false) GUIEditor.button[1] = guiCreateButton(20, 311, 98, 38, "Spawn Vehicle", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(186, 311, 98, 38, "Close", false, GUIEditor.window[1]) showCursor(true) addEventHandler("onClientGUIClick",getRootElement(),onClickBtnClose) addEventHandler("onClientGUIClick",getRootElement(),onClickBtnSpawnVeh) end addEvent("openLimoVehMenu",true) addEventHandler("openLimoVehMenu",getRootElement(),openLimoVeh) function onClickBtnClose(button,state) if (button == "left" and state == "up") then if (source == GUIEditor.button[2]) then guiSetInputEnabled(false) guiSetVisible(GUIEditor.window[1], false) destroyElement(GUIEditor.window[1]) showCursor(false) removeEventHandler("onClientGUIClick",getRootElement(),onClickBtnClose) end end end function delayed() local vehList = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if vehList == nil or vehList == false then outputChatBox("You need to select a vehicle!",0,255,255) elseif vehList == "Limo" then local x,y,z = getElementPosition(getLocalPlayer()) local limoJobVeh = createVehicle ( 409, x, y, z + 3 ) warpPedIntoVehicle(source,limoJobVeh) end end addEvent("delayedVehSpawn",true) addEventHandler("delayedVehSpawn",getRootElement(),delayed) function onClickBtnSpawnVeh(button,state) if (button == "left" and state == "up") then if (source == GUIEditor.button[1]) then triggerEvent("delayedVehSpawn",getLocalPlayer()) end end end Link to comment
HUNGRY:3 Posted September 10, 2015 Share Posted September 10, 2015 GUIEditor = { gridlist = {}, window = {}, button = {} } function openLimoVeh() GUIEditor.window[1] = guiCreateWindow(683, 306, 305, 359, "Job Vehicle Spawner", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(10, 23, 284, 282, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Vehicles", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Limo", false, false) GUIEditor.button[1] = guiCreateButton(20, 311, 98, 38, "Spawn Vehicle", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(186, 311, 98, 38, "Close", false, GUIEditor.window[1]) showCursor(true) addEventHandler("onClientGUIClick",getRootElement(),onClickBtnClose) addEventHandler("onClientGUIClick",getRootElement(),onClickBtnSpawnVeh) end addEvent("openLimoVehMenu",true) addEventHandler("openLimoVehMenu",getRootElement(),openLimoVeh) function onClickBtnClose(button,state) if (button == "left" and state == "up") then if (source == GUIEditor.button[2]) then guiSetInputEnabled(false) guiSetVisible(GUIEditor.window[1], false) destroyElement(GUIEditor.window[1]) showCursor(false) removeEventHandler("onClientGUIClick",getRootElement(),onClickBtnClose) end end end function delayed() local vehList = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if vehList == nil or vehList == false then outputChatBox("You need to select a vehicle!",0,255,255) elseif vehList == "Limo" then local x,y,z = getElementPosition(getLocalPlayer()) local limoJobVeh = createVehicle ( 409, x, y, z + 3 ) warpPedIntoVehicle(getLocalPlayer(),limoJobVeh) end end addEvent("delayedVehSpawn",true) addEventHandler("delayedVehSpawn",getRootElement(),delayed) function onClickBtnSpawnVeh(button,state) if (button == "left" and state == "up") then if (source == GUIEditor.button[1]) then triggerEvent("delayedVehSpawn",getLocalPlayer()) end end Link to comment
KariiiM Posted September 10, 2015 Share Posted September 10, 2015 (edited) GUIEditor = { gridlist = {}, window = {}, button = {} } function openLimoVeh() GUIEditor.window[1] = guiCreateWindow(683, 306, 305, 359, "Job Vehicle Spawner", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(10, 23, 284, 282, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Vehicles", 0.9) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "Limo", false, false) GUIEditor.button[1] = guiCreateButton(20, 311, 98, 38, "Spawn Vehicle", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(186, 311, 98, 38, "Close", false, GUIEditor.window[1]) showCursor(true) addEventHandler("onClientGUIClick",getRootElement(),onClickBtnClose) addEventHandler("onClientGUIClick",getRootElement(),onClickBtnSpawnVeh) end addEvent("openLimoVehMenu",true) addEventHandler("openLimoVehMenu",getRootElement(),openLimoVeh) function onClickBtnClose(button,state) if (button == "left" and state == "up") then if (source == GUIEditor.button[2]) then guiSetInputEnabled(false) guiSetVisible(GUIEditor.window[1], false) destroyElement(GUIEditor.window[1]) showCursor(false) removeEventHandler("onClientGUIClick",getRootElement(),onClickBtnClose) end end end function delayed() local vehList = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 1 ) if vehList == nil or vehList == false then outputChatBox("You need to select a vehicle!",0,255,255) elseif vehList == "Limo" then local x,y,z = getElementPosition(getLocalPlayer()) local limoJobVeh = createVehicle ( 409, x, y, z + 3 ) warpPedIntoVehicle(localPlayer,limoJobVeh) end end addEvent("delayedVehSpawn",true) addEventHandler("delayedVehSpawn",getRootElement(),delayed) function onClickBtnSpawnVeh(button,state) if (button == "left" and state == "up") then if (source == GUIEditor.button[1]) then triggerEvent("delayedVehSpawn",getLocalPlayer()) end end Edit: sorry i didn't see the preview post i didn't refresh the page Edited September 10, 2015 by Guest Link to comment
Dazee Posted September 10, 2015 Author Share Posted September 10, 2015 Tried that man it dont work for some reason it was like that in the beginning. Link to comment
KariiiM Posted September 10, 2015 Share Posted September 10, 2015 Tried that man it dont work for some reason it was like that in the beginning. just try to replace warpPedIntoVehicle(source,limoJobVeh) to warpPedIntoVehicle(localPlayer,limoJobVeh) Link to comment
JR10 Posted September 10, 2015 Share Posted September 10, 2015 You might need a delay between creating the vehicle and warping the ped into it. local limoJobVeh = createVehicle ( 409, x, y, z + 3 ) setTimer(warpPedIntoVehicle, 500, 1, localPlayer,limoJobVeh) 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