Danii.- Posted December 31, 2021 Share 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) Link to comment
Moderators IIYAMA Posted December 31, 2021 Moderators Share 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) Link to comment
Danii.- Posted December 31, 2021 Author Share Posted December 31, 2021 Thanks. You're great! Now it works. 1 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