Jump to content

Buying script with timelimit (buy a thing every min)


spAik

Recommended Posts

Hi,

I try to make a nos command...it should allow the player to only allow to buy it every 60secs. But its not working. Whats wrong? :P

Accountdata "cash" exists. Elementdata Limit should also exist ;X

function BuyNos (player, command) 
local account = getPlayerAccount(player) 
    if (getAccountData(account,"cash") > 3000) and (getElementData(player,"Limit") = 0) then 
        local auto = getPedOccupiedVehicle(player) 
        local nick = getPlayerName(player) 
        addVehicleUpgrade(auto,1010) 
        setAccountData(account, "cash", getAccountData(account,"cash") - 3000 ) 
        setElementData(player, "Limit", 1) 
        outputChatBox("#FFFFFF" .. nick .. " #ff0000bought nitro for $3000! #FFFFFF(/nitro)", getRootElement(), 255, 85, 0, true) 
        SetTimer(resetlimit, 60000, 1 , player) 
    else  
        outputChatBox("#FF0000Not enough money.", player, 255, 85, 0, true) 
    end 
end  
addCommandHandler("nitro", BuyNos) 
  
function resetlimit (player) 
setElementData(player,"Limit",0) 
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...