Jump to content

[HELP]My payday script is not work![HELP]


Juukoo

Recommended Posts

Hey, my payday script is not work. The script gives only error to debugscript and nothing is happening.

debugscript: ERROR: Payday\server.lua:14: bad argument #1 to 'gsub' (string expected, got boolean)

Thanks!

  
  
  
  
function giveMoney () 
    players = getElementsByType ("player") 
    for k, pelaaja, auto in ipairs(players) do 
        onlineTime = getElementData(pelaaja, "online") 
        if onlineTime == false then 
            return false 
        else 
            h = gettok(onlineTime, 1, " ") 
            m = gettok(onlineTime, 2, " ") 
            m = string.gsub(m, "min", "") 
            h = string.gsub(h, "h", "") 
            h = tonumber(h) 
            m = tonumber(m) 
            if m < 1 then 
                return false 
            else 
                if h > 0 then 
                    m = h*180+m 
                    raha = m*1.667 
                    raha = math.floor(raha) 
                    players = getElementsByType ("player") 
                    outputChatBox ("You been online for " .. onlineTime .. " and got " .. raha .. "$ for it!", pelaaja, 255, 255, 255, true) 
                    givePlayerMoney (pelaaja, raha) 
                else 
                    raha = m*1.667 
                    raha = math.floor(raha) 
                    players = getElementsByType ("player") 
                    outputChatBox ("You been online for " .. m .. "min and got " .. raha .. "$ for it!", pelaaja, 255, 255, 255, true) 
                    givePlayerMoney (pelaaja, raha) 
                end 
            end 
        end 
    end 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), timer) 

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