Jump to content

pls help me (buy)


raulrobi

Recommended Posts

Posted
price = {}
price.nitro = 100
price.repair = 100
 
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 
)

something like that (not tested)

Posted
I think this is the newer way to get scripts written for themselfs, just say "Sorry" and "Im lazy" alot :roll:

At least he is being honest.

To my vision, xbost's script should work just fine.

Posted
I think this is the newer way to get scripts written for themselfs, just say "Sorry" and "Im lazy" alot :roll:

At least he is being honest.

To my vision, xbost's script should work just fine.

True, but saying your lazy and not even have the intention to learn LUA, is just wrong imo than asking others to do it for you.

Posted

Hmm, my thoughts:

If you are lazy - just keep beeing a "player" and don't bother anyone.

If you are newbie - try to think by yourself, use google, help pages, wikis, ask for help on forums.

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