Jump to content

Flood protecting basic Freeroam functions


Xabache

Recommended Posts

Taken from MTA Freeroam:

function repairVehicle() 
    local vehicle = getPedOccupiedVehicle(g_Me) 
    if vehicle then 
        server.fixVehicle(vehicle) 
    end 
end 

I want to make this only accessible if the damage is below 50% or it has not been accessed in the last minute by that specific user.

I found no getVehicleDamage

Link to comment

For damage below 50%, use:

getElementHealth 

For limit by minutes this should work:

repairTick = false 
  
function repairVehicle() 
    local vehicle = getPedOccupiedVehicle(g_Me) 
    if vehicle then 
        if not repairTick or repairTick < getTickCount ( ) then 
            server.fixVehicle(vehicle) 
            repairTick = getTickCount() + 60000 
        else 
            outputChatBox ( "Wait "..math.floor( ( repairTick - getTickCount() ) /1000 ) .." Seconds before repairing again !" ) 
        end 
    end 
end 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...