sourena92982 Posted May 18 Share Posted May 18 Hi im created a resource with meta.xml server.lua and client.lua im making this resource for spawning vehichles with a easy command my codes are this : function mveh(theplayer,cmd) x,y,z = getElementPositon( thePlayer) veh = createVehicle ( 400 , x , y, z) end addCommandHandler("veh",mveh) i run command /veh in the game and nothing happen please help me Link to comment
Nico834 Posted May 19 Share Posted May 19 (edited) Hey The name of the first argument in the function is theplayer with lowercase letters, and when running the subsequent getElementPosition function, you refer to a variable called thePlayer as the first parameter, which does not exist, because you created it earlier with lowercase letters, and Lua is a case sensitive language. The corrected code: function mveh(thePlayer,cmd) x,y,z = getElementPositon( thePlayer) veh = createVehicle ( 400 , x , y, z) end addCommandHandler("veh",mveh) Regards, Nico. Edited May 19 by Nico834 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