Jump to content

No money for Wins! Help <~~


MariaNN

Recommended Posts

As a player wins the map is not got money for DD and Race. Please Help my!

        end 
            local pAlive = getAliveRacePlayers() 
            local pDead = getDeadRacePlayers() 
            local WinS = tonumber(getAccountData(account,"highestWinstreak")) 
            if WinS < WinStreak then 
                setAccountData(account,"highestWinstreak",WinStreak) 
            end 
            if WinStreak >= 2 then 
                local WinStreakToExport = WinStreak 
                call(getResourceFromName("race"), "setWinStreakOnMessege", WinStreakToExport) 
            end 
            local cashToWin = tonumber((moneyEarnPart*getPlayerCount())*WinStreak) 
            local playerCash = tonumber(getAccountData(account,"cash")) 
            if not (cashToWin < 0) then 
                setAccountData(account,"cash",playerCash+cashToWin) 
            end 
            local points = math.floor(((pAlive + pDead)*pDead)*WinStreak) 
            if not (points < 0) then 
                local playerPoints = getAccountData(account,"points") 
                setAccountData(account,"points",playerPoints+points) 
            end 
            addStat(account,"mapsWon",1) 
            if mapType == "DM" then 
                addStat(account,"DMwins",1) 
            elseif mapType == "DD" then 
                addStat(account,"DDwins",1) 
            end 
            outputChatBox ("#ff4400* #FFFFFFYou won the map, earned #ff4400$" .. tostring(cashToWin) .." #FFFFFFand #ff4400"..points.." #FFFFFFexp. [x#ff4400"..WinStreak.."#ffffff]",winner,255,255,255,true) 
            scoreboardRefresh(winner) 
        else 
            outputChatBox("#ff4400* #FFFFFFNot enough players to earn money - #ff44003 #FFFFFFrequired.",winner,255,255,255,true) 
        end 
        local thePlayer = winner 
        scoreboardRefresh(thePlayer) 
    end 

Link to comment
------------------------------------------------------------------------------------------------------------- 
--  Original file by NeXTreme. Thanks for you'r awesome resource.                                          --
--                                                                                                         --
--  This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.--
--  [url=http://creativecommons.org/licenses/by-nc-nd/3.0/ ]http://creativecommons.org/licenses/by-nc-nd/3.0/ [/url]                                                     --
--                                                                                                         --
--  Edited by Xiti. All right reserved. Copyright 2012.                                                --
-------------------------------------------------------------------------------------------------------------
 
-- String.random characters
chars = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0"}
 
 
 
 
 
 
 
 
local dataTable = {
    "cash",
    "points",
    "firstTimeJoin",
    "totalTimesJoined",
    "mapsWon",
    "totalToptimes",
    "totalHunters",
    "mapsPlayed",
    "totalBets",
    "totalBetsWon",
    "totalDeaths",
    "totalPlayingTimeMinutes",
    "totalPlayingTimeHours",
    "totalReactionTests",
    "highestWinstreak",
    "totalSpins",
    "DMwins",
    "DMplayed",
    "DDwins",
    "DDplayed",
    "buyedMaps",
    "firstRed",
    "firstGreen",
    "firstBlue",
    "secoundRed",
    "secoundGreen",
    "secoundBlue",
    "headRed",
    "headGreen",
    "headBlue",
    "policeLights",
    "discoLights",
    "poisonColor",
    "blackColor",
    "policeEnabled",
    "discoEnabled",
    "poisonEnabled",
    "blackEnabled",
    "firstEnabled",
    "secoundEnabled",
    "headEnabled",
    "donatorEnabled",
    "donatorTime",
}
 
textDataTable = {"nick"}
playerTableStats = {}
respawnFix = {}
hunterFix = {}
 
 
 
-----------
-- Settings
-----------
betTimeLimit = 40       -- Duration of the betting period in seconds.
minPlayers = 5          -- Minimum required players to bet.        
mapCost = 1000          -- The price for setting maps.     
vehicleColor = 5000 
headlightColor = 10000  
nitroColor =  7000
discoLightsCost = 1000
VIPcolor = 12000
moneyEarnPart = 30      -- The amount of money to calculate with to get the final money to give to the player.
 
 
reactionMin = 200       -- Minimum money for the reaction test
reactionMax = 500       -- Maximum money for the reaction test
reactionDuration = 20   -- Duration of the reaction test in seconds
reactionMinRedo = 300   -- Minimum amount of time to pass before a new reaction test is started in seconds
reactionMaxRedo = 400   -- Maximum amount of time to pass before a new reaction test is started in seconds
reactionLength = 10     -- Number of characters to use in the reaction test
 
 
function onResourceStart()
    mapIsAlreadySet = false
    reactionString = ""
    reactionMoney = 0
    mapType = ""
    mapName = ""
    mapBlock = ""
    setTimer(newReactionTest,math.random(reactionMinRedo*1000,reactionMaxRedo*1000),1)
end
 
 
-- Disable voting
function disableVote()
    cancelEvent()
end
 
----------------------------
-- Refresh Players
----------------------------
 
function triggerRebuildPlayerGridlist(thePlayer)
    local loggedPlayers = {}
    for i,player in ipairs(getElementsByType("player")) do
        if not (isGuestAccount(getPlayerAccount(player))) then
            table.insert(loggedPlayers, tostring(getPlayerName(player)))
        end
        setTimer(callClientFunction,1000,1,getRootElement(),"refreshConnectedPlayers",loggedPlayers)
    end
end
addEventHandler("onPlayerChangeNick",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerLogin",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerJoin",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerLogout",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerQuit",getRootElement(),triggerRebuildPlayerGridlist)
 
----------------------------------
-- Tables System based on Accounts
----------------------------------
function createNewTables()
    local account = getPlayerAccount(source)
    if not (isGuestAccount(account)) then
        for i, data in ipairs(dataTable) do
            if not (getAccountData(account, data)) then
                setAccountData(account, data, "0")
                outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(source)).." to 0")
            end
        end
    end
    if not (isGuestAccount(account)) then
        for i, data in pairs(textDataTable) do
            if not (getAccountData(account, data)) then
                setAccountData(account, data, getPlayerName(source))
            end
        end
    end
end
addEventHandler("onPlayerLogin", getRootElement(), createNewTables)
 
addCommandHandler("resetStats",
function (player, cmd, arg1)
    if (arg1) then
        local account = getPlayerAccount(player)
        if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then
            local target = getPlayerWildcard(arg1)
            if (target) then
                local account = getPlayerAccount(target)
                if not (isGuestAccount(account)) then
                    for i, data in ipairs(dataTable) do
                        setAccountData(account, data, "0")
                        outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(target)).." to 0")
                    end
                end
                if not (isGuestAccount(account)) then
                    for i, data in pairs(textDataTable) do
                    end
                end
            end
        end
    end
end)
 
 
 
function checkLoggedPlayer()
    for id,thePlayer in pairs(getElementsByType("player")) do
        local account = getPlayerAccount(thePlayer)
        if not (isGuestAccount(account)) then
            onPlayerLoginHandler(thePlayer)
        end
    end
end
 
-------------------------------------------
-- Userpanel - handle requests from clients
-------------------------------------------
 
function timesJoin()
    setElementData(source,"join","joined")
    scoreboardRefresh(source)
end
addEventHandler("onPlayerJoin",getRootElement(),timesJoin)
 
 
-- Stats view
function getPlayerStats(triggeringPlayer,thePlayer)
    local account = getPlayerAccount(thePlayer)
    if not (isGuestAccount(account)) then
        playerTableStats[1] = getPlayerName(thePlayer)
        playerTableStats[1] = tonumber(getAccountData(account,"cash"))
        playerTableStats[2] = tonumber(getAccountData(account,"points"))
        playerTableStats[4] = tonumber(getAccountData(account,"totalHunters"))
        playerTableStats[3] = tonumber(getAccountData(account,"totalToptimes"))
        playerTableStats[5] = tonumber(getAccountData(account,"mapsPlayed"))
        playerTableStats[6] = tonumber(getAccountData(account,"mapsWon"))
        playerTableStats[7] = tonumber(getAccountData(account,"totalDeaths"))
        playerTableStats[8] = tonumber(getAccountData(account,"highestWinstreak"))
        playerTableStats[9] = tonumber(getAccountData(account,"totalSpins"))
        playerTableStats[10] = tonumber(getAccountData(account,"totalBets"))
        playerTableStats[11] = tonumber(getAccountData(account,"totalSpins"))
        playerTableStats[12] = "00:00"
        minutes = tonumber(getAccountData(account,"totalPlayingTimeMinutes"))
        hours = tonumber(getAccountData(account,"totalPlayingTimeHours"))
        if hours < 10 then
            hours = "0"..hours
        end
        if minutes < 10 then
            minutes = "0"..minutes
        end
        playerTableStats[12] = ""..hours..":"..minutes.."" -- Total Playing Time
        playerTableStats[13] = tonumber(getAccountData(account,"totalTimesJoined"))
        callClientFunction(triggeringPlayer,"buildPlayerData",playerTableStats,thePlayer)
    end
end
 
 
-- Maps
function getServerMaps(loadList)
    local tableOut = {}
    if loadList then
        local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode" , getResourceFromName("race"))
        for i,map in ipairs (maps) do
            tableOut[i] = getResourceInfo(map, "name") or getResourceName(map)
        end
        table.sort(tableOut, sortCompareFunction)
    end
    callClientFunction(loadList,"createMapList", tableOut)
end
 
function sortCompareFunction(s1, s2)
    if type(s1) == "table" and type(s2) == "table" then
        s1, s2 = s1.name, s2.name
    end
    s1, s2 = s1:lower(), s2:lower()
    if s1 == s2 then
        return false
    end
    local byte1, byte2 = string.byte(s1:sub(1,1)), string.byte(s2:sub(1,1))
    if not byte1 then
Link to comment

That's dashboard

------------------------------------------------------------------------------------------------------------- 
--  Original file by NeXTreme. Thanks for you'r awesome resource.                                          --
--                                                                                                         --
--  This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.--
--  [url=http://creativecommons.org/licenses/by-nc-nd/3.0/ ]http://creativecommons.org/licenses/by-nc-nd/3.0/ [/url]                                                     --
--                                                                                                         --
--  Edited by Xiti. All right reserved. Copyright 2012.                                                --
-------------------------------------------------------------------------------------------------------------
 
-- String.random characters
chars = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0"}
 
 
 
 
 
 
 
 
local dataTable = {
    "cash",
    "points",
    "firstTimeJoin",
    "totalTimesJoined",
    "mapsWon",
    "totalToptimes",
    "totalHunters",
    "mapsPlayed",
    "totalBets",
    "totalBetsWon",
    "totalDeaths",
    "totalPlayingTimeMinutes",
    "totalPlayingTimeHours",
    "totalReactionTests",
    "highestWinstreak",
    "totalSpins",
    "DMwins",
    "DMplayed",
    "DDwins",
    "DDplayed",
    "buyedMaps",
    "firstRed",
    "firstGreen",
    "firstBlue",
    "secoundRed",
    "secoundGreen",
    "secoundBlue",
    "headRed",
    "headGreen",
    "headBlue",
    "policeLights",
    "discoLights",
    "poisonColor",
    "blackColor",
    "policeEnabled",
    "discoEnabled",
    "poisonEnabled",
    "blackEnabled",
    "firstEnabled",
    "secoundEnabled",
    "headEnabled",
    "donatorEnabled",
    "donatorTime",
}
 
textDataTable = {"nick"}
playerTableStats = {}
respawnFix = {}
hunterFix = {}
 
 
 
-----------
-- Settings
-----------
betTimeLimit = 40       -- Duration of the betting period in seconds.
minPlayers = 5          -- Minimum required players to bet.        
mapCost = 1000          -- The price for setting maps.     
vehicleColor = 5000 
headlightColor = 10000  
nitroColor =  7000
discoLightsCost = 1000
VIPcolor = 12000
moneyEarnPart = 30      -- The amount of money to calculate with to get the final money to give to the player.
 
 
reactionMin = 200       -- Minimum money for the reaction test
reactionMax = 500       -- Maximum money for the reaction test
reactionDuration = 20   -- Duration of the reaction test in seconds
reactionMinRedo = 300   -- Minimum amount of time to pass before a new reaction test is started in seconds
reactionMaxRedo = 400   -- Maximum amount of time to pass before a new reaction test is started in seconds
reactionLength = 10     -- Number of characters to use in the reaction test
 
 
function onResourceStart()
    mapIsAlreadySet = false
    reactionString = ""
    reactionMoney = 0
    mapType = ""
    mapName = ""
    mapBlock = ""
    setTimer(newReactionTest,math.random(reactionMinRedo*1000,reactionMaxRedo*1000),1)
end
 
 
-- Disable voting
function disableVote()
    cancelEvent()
end
 
----------------------------
-- Refresh Players
----------------------------
 
function triggerRebuildPlayerGridlist(thePlayer)
    local loggedPlayers = {}
    for i,player in ipairs(getElementsByType("player")) do
        if not (isGuestAccount(getPlayerAccount(player))) then
            table.insert(loggedPlayers, tostring(getPlayerName(player)))
        end
        setTimer(callClientFunction,1000,1,getRootElement(),"refreshConnectedPlayers",loggedPlayers)
    end
end
addEventHandler("onPlayerChangeNick",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerLogin",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerJoin",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerLogout",getRootElement(),triggerRebuildPlayerGridlist)
addEventHandler("onPlayerQuit",getRootElement(),triggerRebuildPlayerGridlist)
 
----------------------------------
-- Tables System based on Accounts
----------------------------------
function createNewTables()
    local account = getPlayerAccount(source)
    if not (isGuestAccount(account)) then
        for i, data in ipairs(dataTable) do
            if not (getAccountData(account, data)) then
                setAccountData(account, data, "0")
                outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(source)).." to 0")
            end
        end
    end
    if not (isGuestAccount(account)) then
        for i, data in pairs(textDataTable) do
            if not (getAccountData(account, data)) then
                setAccountData(account, data, getPlayerName(source))
            end
        end
    end
end
addEventHandler("onPlayerLogin", getRootElement(), createNewTables)
 
addCommandHandler("resetStats",
function (player, cmd, arg1)
    if (arg1) then
        local account = getPlayerAccount(player)
        if (isObjectInACLGroup("user." ..getAccountName(account), aclGetGroup("Admin"))) then
            local target = getPlayerWildcard(arg1)
            if (target) then
                local account = getPlayerAccount(target)
                if not (isGuestAccount(account)) then
                    for i, data in ipairs(dataTable) do
                        setAccountData(account, data, "0")
                        outputDebugString("Setting data: "..tostring(data).." for player: "..tostring(getPlayerName(target)).." to 0")
                    end
                end
                if not (isGuestAccount(account)) then
                    for i, data in pairs(textDataTable) do
                    end
                end
            end
        end
    end
end)
 
 
 
function checkLoggedPlayer()
    for id,thePlayer in pairs(getElementsByType("player")) do
        local account = getPlayerAccount(thePlayer)
        if not (isGuestAccount(account)) then
            onPlayerLoginHandler(thePlayer)
        end
    end
end
 
-------------------------------------------
-- Userpanel - handle requests from clients
-------------------------------------------
 
function timesJoin()
    setElementData(source,"join","joined")
    scoreboardRefresh(source)
end
addEventHandler("onPlayerJoin",getRootElement(),timesJoin)
 
 
-- Stats view
function getPlayerStats(triggeringPlayer,thePlayer)
    local account = getPlayerAccount(thePlayer)
    if not (isGuestAccount(account)) then
        playerTableStats[1] = getPlayerName(thePlayer)
        playerTableStats[1] = tonumber(getAccountData(account,"cash"))
        playerTableStats[2] = tonumber(getAccountData(account,"points"))
        playerTableStats[4] = tonumber(getAccountData(account,"totalHunters"))
        playerTableStats[3] = tonumber(getAccountData(account,"totalToptimes"))
        playerTableStats[5] = tonumber(getAccountData(account,"mapsPlayed"))
        playerTableStats[6] = tonumber(getAccountData(account,"mapsWon"))
        playerTableStats[7] = tonumber(getAccountData(account,"totalDeaths"))
        playerTableStats[8] = tonumber(getAccountData(account,"highestWinstreak"))
        playerTableStats[9] = tonumber(getAccountData(account,"totalSpins"))
        playerTableStats[10] = tonumber(getAccountData(account,"totalBets"))
        playerTableStats[11] = tonumber(getAccountData(account,"totalSpins"))
        playerTableStats[12] = "00:00"
        minutes = tonumber(getAccountData(account,"totalPlayingTimeMinutes"))
        hours = tonumber(getAccountData(account,"totalPlayingTimeHours"))
        if hours < 10 then
            hours = "0"..hours
        end
        if minutes < 10 then
            minutes = "0"..minutes
        end
        playerTableStats[12] = ""..hours..":"..minutes.."" -- Total Playing Time
        playerTableStats[13] = tonumber(getAccountData(account,"totalTimesJoined"))
        callClientFunction(triggeringPlayer,"buildPlayerData",playerTableStats,thePlayer)
    end
end
 
 
-- Maps
function getServerMaps(loadList)
    local tableOut = {}
    if loadList then
        local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode" , getResourceFromName("race"))
        for i,map in ipairs (maps) do
            tableOut[i] = getResourceInfo(map, "name") or getResourceName(map)
        end
        table.sort(tableOut, sortCompareFunction)
    end
    callClientFunction(loadList,"createMapList", tableOut)
end
 
function sortCompareFunction(s1, s2)
    if type(s1) == "table" and type(s2) == "table" then
        s1, s2 = s1.name, s2.name
    end
    s1, s2 = s1:lower(), s2:lower()
    if s1 == s2 then
        return false
    end
    local byte1, byte2 = string.byte(s1:sub(1,1)), string.byte(s2:sub(1,1))
    if not byte1 then
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...