Jump to content

gui???


COOKIE2

Recommended Posts

hey i found a script that allows you to buy nitro and repair

with /buy nitro /buy repair command

and i made a gui with 2 buttons 1 repair 2 nitro

how do i set that if i click 1 that i buy a repair?

price = {}

price.nitro = 5000

price.repair = 5000

addCommandHandler("buy",

function (player, command, item)

if item == "nitro" then

if getPlayerMoney(player) > price.nitro then

local vehicle = getPedOccupiedVehicle(player)

if vehicle then

addVehicleUpgrade(vehicle, 1010)

takePlayerMoney(player, price.nitro)

outputChatBox("You've bought a nitro", player, 0, 222, 0, true)

else

outputChatBox("You are not in a vehicle", player, 222, 0, 0, true)

end

else

outputChatBox("Not enough cash, nitro costs $"..price.nitro, player, 222, 0, 0, true)

end

elseif item == "repair" then

if getPlayerMoney(player) > price.repair then

local vehicle = getPedOccupiedVehicle(player)

if vehicle then

fixVehicle(vehicle)

takePlayerMoney(player, price.repair)

outputChatBox("You've bought a repair", player, 0, 222, 0, true)

else

outputChatBox("You are not in a vehicle", player, 222, 0, 0, true)

end

else

outputChatBox("Not enough cash, repair costs $"..price.repair, player, 222, 0, 0, true)

end

end

end

)

Edited by Guest
Link to comment
I guess this topic is gonna be closed soon

I guess so too, because I'm about to press the button.

COOKIE2: Please post any problems you have with a script in the right topic if it already exists. (here) Also, use [ lua][/lua] tags for your code, it's not a surprise nobody is taking the effort of helping you.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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