LucasBaker Posted May 11, 2013 Share Posted May 11, 2013 Well I made this script for when the player enter / repair, the script causes the vehicle to be repaired within 15 seconds, I would like to know what you want is wrong here -- Script Criado por Miller function repararVeiculo(player, command, source) outputChatBox ( "Estamos reparando seu veículo aguarde 15 Segundos!", getRootElement(), 255, 0, 0, true ) setTimer(repararVeiculo, 15000, 1) player = getRandomPlayer() vehicles = getElementsByType ("vehicle") for vehicleKey, vehicleValue in ipairs(vehicles) do fixVehicle ( vehicleValue) end end addCommandHandler("reparar",repararVeiculo) Link to comment
Castillo Posted May 11, 2013 Share Posted May 11, 2013 That doesn't really make much sense, the timer is used to execute the same function executed by the command, and you have getRandomPlayer, which is not required, also, you are looping all vehicles, no idea what for. What you must do is: get the vehicle from the player that used the command, then check if he actually has one, if so, set the timer to repair it. Link to comment
xXMADEXx Posted May 11, 2013 Share Posted May 11, 2013 I believe this is what your trying to make: function repararVeiculo(player, command, source) outputChatBox ( "Estamos reparando seu veículo aguarde 15 Segundos!", player, 255, 0, 0, true ) if (getPedOccupiedVehicle(player)) then car = getPedOccupiedVehicle(player) setTimer( function () fixVehicle(car) end, 15000, 1 ) else return end end addCommandHandler("reparar",repararVeiculo) 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