Jump to content

Need help in this function


Recommended Posts

Here is what you need

local chars = {',','-','+'}  
  
function convert(player, cmd, amount) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then  
        local accountName = getAccountName(account) 
        local vip = getElementData(player, "CISvip") or 0 
        if vip ~= 0 then  
            for _,chr in ipairs(chars) do 
                amount = amount:gsub(chr,'') 
            end 
            if (amount) and tonumber(amount) then  
                if tonumber(amount) <= vip then 
                    local cash = math.ceil(amount*10000) 
                    exports.CISvip:removePlayerVIP(accountName,tonumber(amount)) 
                    exports.CISaccounts:GPM(player, cash, "converted "..amount.." VIP Hours for "..cash) 
                    outputChatBox("You have successfully converted "..amount.." VIP hours to $"..cash.."", player, 0, 255, 0) 
                else 
                    outputChatBox("You can't convert more than  you have",player,255,0,0) 
                end  
            else 
                outputChatBox("[usage]/convertviptomoney ",player,255,0,0) 
            end 
        else 
            outputChatBox("You don't have VIP hours to convert!", player, 255, 0, 0) 
        end  
    end 
end 
addCommandHandler("convertviptomoney", convert) 

Link to comment
exports.CISvip:removePlayerVIP(accountName,tonumber(amount)) 
exports.CISaccounts:GPM(player, cash, "converted "..amount.." VIP  
  
  
  
 

Changing the T to an S won't convince any practical scripter not encouraging this what so ever but if you at least going to try to post a leaked script, at-least make it convincing.

Another thing is, If you know how to create the exports and what not, you'd be able to do something such as this on your own.

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