Jump to content

Repair Vehicle


TheRock254

Recommended Posts

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        Swindow = guiCreateWindow(256, 207, 331, 290, "User Panel", false) 
        guiWindowSetSizable(Swindow , false) 
        guiSetProperty(Swindow , "CaptionColour", "FFF7E307") 
        repair = guiCreateButton(148, 38, 88, 94, "Repair", false, Swindow ) 
        addEventHandler ( "onClientGUIClick", repair, repa, false )      
    end 
) 
  
function repa () 
triggerServerEvent ("repairvehicle", localPlayer) 
end 

 

function repaircar(player) 
    local vehicle = getPedOccupiedVehicle(player) 
    local money = getPlayerMoney(player) 
    if (money >= 30) then 
        if getElementHealth(vehicle) < 1000 then 
            fixVehicle(vehicle) 
            takePlayerMoney(player, 30) 
        else 
            outputChatBox("#text!", player, 255, 0, 0, true) 
        end 
    else 
        outputChatBox("text", player, 255, 0, 0, true) 
    end 
end 
addEvent ("repairvehicle", true) 
addEventHandler ( "repairvehicle", getRootElement(), repaircar ) 

QX4WpZ.png

Where is the problem?

Link to comment
  • Other Languages Moderators
function repaircar() 
    local vehicle = getPedOccupiedVehicle(source) 
    if vehicle then 
        local money = getPlayerMoney(source) 
        if (getPlayerMoney(source) >= 30) then 
            if getElementHealth(vehicle) < 1000 then 
                fixVehicle(vehicle) 
                takePlayerMoney(source, 30) 
            else 
                outputChatBox("#text!", source, 255, 0, 0, true) 
            end 
        else 
            outputChatBox("text", source, 255, 0, 0, true) 
        end 
    end 
end 
addEvent("repairvehicle", true) 
addEventHandler("repairvehicle", root, repaircar) 

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