Jump to content

Top Wins function help


mtamaster97

Recommended Posts

hello here is the code that i need to fix

  
function topmap( player, command ) 
    local map = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) ) 
    local tableOrder = { } 
    for i, v in ipairs ( getAccounts ( ) ) do 
    table.insert ( 
        tableOrder, 
        { 
            name = getAccountData ( v, "nick") or getAccountName(v), 
            data = getAccountData ( v, map) or 0 
        } 
            ) 
    end 
    table.sort ( 
        tableOrder, 
        function ( a, b ) 
            return ( tonumber ( a.data ) or 0 ) > ( tonumber ( b.data ) or 0 ) 
        end 
                ) 
    triggerClientEvent ( "returnTable", getRootElement(), tableOrder ) 
end 
addEventHandler ( "onMapStarting", root, topmap) 
  
function refresh(thePlayer) 
    local account = getPlayerAccount(source) 
    setAccountData(account, "nick", getPlayerName(source) ) 
end 
addEventHandler("onPlayerConnect", getRootElement(), refresh) 
addEventHandler("onPlayerWasted", getRootElement(), refresh) 
addEventHandler("onPlayerChangeNick", getRootElement(), refresh) 
addEventHandler("onPlayerLogin", getRootElement(), refresh) 
  

my friend gave me but it doesn't store wins nowhere

he don't know how to do it either

Link to comment
  • Moderators
my friend gave me but it doesn't store wins nowhere

Yeah indeed, the code doesn't even try to store the wins from what you pasted.

You just pasted a piece of code that loads the winners ordered by number of wins for the current map and send the whole table to the client-side to be displayed I guess.

If you don't have any other function to show us, then you are not asking for help, but you are currently asking for someone to make it for you. And I'm sorry but it will likely not happen.

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