yurifoborghi Posted May 25, 2011 Share Posted May 25, 2011 I'm creating a script than fix all cars in the server (A race server). I have a script than fix 1 only car, but I want to fix all. This is the script than fix 1 only car: ------------------------------------------------------------ function st3reo6 (thePlayer, commandName, ...) player = findPlayer(...) if not player then outputChatBox("* /fix: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) fixVehicle(vehicle) outputChatBox( getPlayerName(thePlayer).. " Fix Vehicle " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("fix", st3reo6) function findPlayer(namepart) for i, player in ipairs(getElementsByType("player")) do local name = getPlayerName(player) if string.find(name:lower(), namepart:lower(), 1, true) then return player, name end end return false end ----------------------------------------------------- Link to comment
BriGhtx3 Posted May 25, 2011 Share Posted May 25, 2011 (edited) Edit : Sorry, didn't understand the question Edited May 25, 2011 by Guest Link to comment
karlis Posted May 25, 2011 Share Posted May 25, 2011 addCommandHandler("fixall",function() for _,v in pairs(getElementsByType("vehicle")) do fixVehicle(v) end end) 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