Woovie Posted January 16, 2008 Share Posted January 16, 2008 (edited) I am working on a Gotocar. I think I am probably messing up. It has been written based on the warpto command and a command OffRoader23 wrote to do teleports. Here is what I have done so far. I have VERY little insight with LUA. But here is what I have. function consoleGoToCar ( player, commandName, player2nick ) local player2 = getPlayerFromNick ( player2nick ) local vehicle = getPlayerOccupiedVehicle(player) if vehicle ~= nil then if player == getVehicleOccupant(vehicle) then -- check if player is driver setElementPosition(vehicle, x, y, z+1.5) setElementVelocity(vehicle, 0, 0, 0) setVehicleTurnVelocity(vehicle, 0, 0, 0) setVehicleRotation(vehicle, 0, 0, r) setTimer(stopCar, 50, 4, vehicle, x, y, z, r) if ( isPlayerInVehicle ( player2 ) ) then x, y, z = getElementPosition ( player2 ) r = getPlayerRotation ( player2 ) then setElementPosition(vehicle, x+3, y+3, z+1.5) setElementRotation(vehicle, r) end end end end function stopCar(vehicle, x, y, z, r) setElementPosition(vehicle, x, y, z+1.5) setElementVelocity(vehicle, 0, 0, 0) setVehicleTurnVelocity(vehicle, 0, 0, 0) setVehicleRotation(vehicle, 0, 0, r) fixVehicle(vehicle) end Edited January 17, 2008 by Guest Link to comment
therenex Posted January 16, 2008 Share Posted January 16, 2008 you should do something like player2 = getPlayerFromNick ( player2nick) because you arent specifying what is player2 . well it does need alot more of code, this even needs some 'end's... Link to comment
Woovie Posted January 16, 2008 Author Share Posted January 16, 2008 Well of course it needs ends... And there. I knew I had forgotten something. Link to comment
Jumba' Posted January 16, 2008 Share Posted January 16, 2008 shouldn't if ( isPlayerInVehicle ) player2 ) ) then be if ( isPlayerInVehicle ( player2 ) ) then ?? Link to comment
Woovie Posted January 17, 2008 Author Share Posted January 17, 2008 I changed it to what I have now. I reread over what I had and came up with that. And how do I know if I need to end something ? Link to comment
AlienX Posted January 17, 2008 Share Posted January 17, 2008 Nearly everything needs to have an end, the "end" name is just a way of letting LUA Know that "Between Here and the End is a ". The can be alot of things, such as a function, an if statement, for loops, while loops, all stuff like that. So, if you have a IF Statement, you need to close it off with an end if ( this == that ) --Do Something end Same with loops for k=1, 100 do outputChatBox ( "Current Number: " .. k ) end List goes on and on really. Link to comment
Woovie Posted January 17, 2008 Author Share Posted January 17, 2008 Okay I understand now. Thank you! 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