Bebras Posted September 15, 2013 Share Posted September 15, 2013 Okay, i'm a complete beginner(like this is my 2nd command code..), and i was trying to create a client-side command with the code: function displayPosition() local x,y,z = getEelementPosition(localPlayer); outputChatbox("X:"..x.."Y:"..y.."Z:"..z,0,255,0); end addCommandHandler("pos",displayPosition); I added this line to my meta file: <script src="clientCommand.lua" type="client" /> What is wrong, because it doesn't work? Again, i'm a beginner and any feedback will be appreciated Link to comment
bandi94 Posted September 15, 2013 Share Posted September 15, 2013 (edited) function displayPosition() local x,y,z = getElementPosition(getLocalPlayer()) outputChatBox("X:"..x.."Y:"..y.."Z:"..z,0,255,0) end addCommandHandler("pos",displayPosition) P.S : you dont need to put ";" in LUA , like in C++ indicating that is end of the line. Edited September 15, 2013 by Guest Link to comment
Castillo Posted September 15, 2013 Share Posted September 15, 2013 You wrote the function names wrong. is getElementPosition and outputChatBox. Link to comment
Bebras Posted September 15, 2013 Author Share Posted September 15, 2013 Great, thanks ! Why did you change it to "getLocalPlayer"? Isn't it predefined and asigned to variable "localPlayer" And just because i have an open topic: a command that spawns a vehicle should be server-sided right? For the vehicle to be synced? Link to comment
Castillo Posted September 15, 2013 Share Posted September 15, 2013 getLocalPlayer and localPlayer is both same thing. And, if you create a vehicle client side, you won't be able to drive it, and it won't be synced. 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