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
-----------------------------------------------------