Jump to content

why this didn't work


Sparrow

Recommended Posts

I've done a window with grid list and buttons to spawn/destroy and fix the vehicle.

spawn is working as well, but fix and destroy didn't work, also no errors on debugscript 3.

script:

function destroyVeh(thePlayer) 
    if (thePlayer) then 
        local theVehicle = getPedOccupiedVehicle (thePlayer) 
        if (theVehicle) then 
            destroyElement (theVehicle) 
            outputChatBox("Your vehicle has been destroyed.", thePlayer, 0, 255, 0) 
        else 
            outputChatBox("Access Denied.", thePlayer, 255, 0, 0) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", destroyButton, destroyVeh, false) 
  
function fixVeh(thePlayer) 
    if (thePlayer) then 
    local theVehicle = getPedOccupiedVehicle (thePlayer) 
        if (theVehicle) then 
            fixVehicle (theVehicle) 
            outputChatBox("Your vehicle has been fixed.", thePlayer, 0, 255, 0) 
        else 
            outputChatBox("Access Denied.", thePlayer, 255, 0, 0) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", fixButton, fixVeh, false) 

Link to comment

Because that just makes no sense.

function destroyVeh() 
    local theVehicle = getPedOccupiedVehicle (localPlayer) 
    if (theVehicle) then 
        destroyElement (theVehicle) 
        outputChatBox("Your vehicle has been destroyed.", 0, 255, 0) 
    else 
        outputChatBox("You aren't in a vehicle.", 255, 0, 0) 
    end 
end 
addEventHandler("onClientGUIClick", destroyButton, destroyVeh, false) 
  
function fixVeh() 
    local theVehicle = getPedOccupiedVehicle (localPlayer) 
    if (theVehicle) then 
        fixVehicle (theVehicle) 
        outputChatBox("Your has been fixed your vehicle.", 0, 255, 0) 
    else 
        outputChatBox("You aren't in a vehicle.", 255, 0, 0) 
    end 
end 
addEventHandler("onClientGUIClick", fixButton, fixVeh, false) 

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