Danii.- Posted December 31, 2021 Posted December 31, 2021 Hello guys! I have another problem. (/question) I am begginer in scripting, so sorry if it's a stup1d question... Is it possible to connect executeCommandHandler with an Event? Or if not do you have any ideas how to do it? It always gives me this error code: Bad argument @ 'executeCommandHandler' [Expected element at argument 2, got nil ] ( I am triggering the "fwheelset" event from the client-side with triggerServerEvent. ) function elsokerek( localPlayer, theVehicle ) local veh = getPedOccupiedVehicle ( localPlayer ) if veh then -- If valid vehicle local success = setVehicleHandling ( veh, "driveType", "fwd" ) -- Set the vehicle's drivetype if success then -- If it was succesful outputChatBox ( "oksa", source ) end end end addCommandHandler("fwd", elsokerek) addEvent("fwheelset",true) function setf ( playerSource ) executeCommandHandler ( "fwd", playerSource, "" ) end addEventHandler("fwheelset", root, setf)
Moderators IIYAMA Posted December 31, 2021 Moderators Posted December 31, 2021 30 minutes ago, Danii.- said: addEvent("fwheelset",true) function setf ( playerSource ) executeCommandHandler ( "fwd", playerSource, "" ) end addEventHandler("fwheelset", root, setf) According to the warning, playerSource is nil. Try this: addEvent("fwheelset",true) function setf ( ) executeCommandHandler ( "fwd", client, "" ) end addEventHandler("fwheelset", root, setf) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Danii.- Posted December 31, 2021 Author Posted December 31, 2021 Thanks. You're great! Now it works. 1
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