Jump to content

Where to save top hunter data


drk

Recommended Posts

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Posted
Wow! Top Hunter done xD Thanks for all again Kenix and Solidsnake. Anyone lock or move to trash this post.

No problem :)

Anyone lock or move to trash this post.

No , because maybe someguy have the same problem.

Posted

Hey all again. I'm having a problem with the top hunter again. Yesterday, the top hunter is working perfectly. Today, when I start my test server again and started the resource I get False in all values again :( I get error: Bad argument @ 'getResourceName' and Attempt to concatenate local 'map' ( a nil value ).

Error lines: --Bad argument @ 'getResourceName'

        return getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 

--Attempt to concatenate local 'map' ( a nil value )

            local result = executeSQLQuery ( "SELECT player, time FROM Top WHERE map = '" ..map.. "'" ) 

map variable:

local map = currentMapName( ) 

I tried to change from a function to only exports.mapmanager:getRunningGamemodeMap() but don't work too.

If I get Top in any map it works perfect, but until I get top I get these errors .

Posted
return getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 

Function getRunningGamemodeMap should return nil if map not running and gm not running too.

--> Error lines: --Bad argument @ 'getResourceName'

And next errors associated with this.

I think you need call function currentMapName with timer ( 100 ms for example ).

Because i see now resource mapmanager and event 'onGamemodeMapStart' triggered firstly and then currentGamemodeMap variable set map resource.

Posted
I think you need call function currentMapName with timer ( 100 ms for example ).

Because i see now resource mapmanager and event 'onGamemodeMapStart' triggered firstly and then currentGamemodeMap variable set map resource.

Show code where you call function currentMapName.

Posted
    addEventHandler( 'onGamemodeMapStart',root, 
        function () 
                  local map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 
            local result = executeSQLQuery ( "SELECT player, time FROM Top WHERE map = '" ..map.. "'" ) 
            if (not result or #result == 0) then 
                executeSQLQuery( "INSERT INTO Top VALUES ('"..map.."','No one', '"..tonumber(100)..":"..tonumber(100).."')" ) 
                setElementData( root,'playerName',"No one" ) 
                setElementData( root,'timeMT',tonumber(100)..":"..tonumber(100) ) 
                triggerClientEvent('clientStart',root) 
            else 
                setElementData( root,'playerName',tostring( result[1]['player'] ) ) 
                setElementData( root,'timeMT',tostring( result[1]['time'] ) ) 
                triggerClientEvent('clientStart',root) 
            end 
        end 
    ) 

I'm not using your function but I get the same.

Posted
addEventHandler( 'onGamemodeMapStart',root, 
    function ( ) 
        local map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 
        while not map do 
            map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 
        end 
        local result = executeSQLQuery ( "SELECT player, time FROM Top WHERE map = '" ..map.. "'" ) 
        if not result or #result == 0 then 
            executeSQLQuery( "INSERT INTO Top VALUES ('"..map.."','No one', '"..tostring( 100 )..":"..tostring( 100 ).."')" ) 
            setElementData( root,'playerName',"No one" ) 
            setElementData( root,'timeMT',tostring( 100 )..":"..tostring( 100 ) ) 
            triggerClientEvent( 'clientStart',root ) 
        else 
            setElementData( root,'playerName',tostring( result[1]['player'] ) ) 
            setElementData( root,'timeMT',tostring( result[1]['time'] ) ) 
            triggerClientEvent( 'clientStart',root ) 
        end 
    end 
) 

Posted

Try it.

  
addEvent( 'onMapStarting',true ) 
addEventHandler( 'onMapStarting',root, 
    function ( ) 
        local map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 
        while not map do 
            map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) 
        end 
        local result = executeSQLQuery ( "SELECT player, time FROM Top WHERE map = '" ..map.. "'" ) 
        if not result or #result == 0 then 
            executeSQLQuery( "INSERT INTO Top VALUES ('"..map.."','No one', '"..tostring( 100 )..":"..tostring( 100 ).."')" ) 
            setElementData( root,'playerName',"No one" ) 
            setElementData( root,'timeMT',tostring( 100 )..":"..tostring( 100 ) ) 
            triggerClientEvent( 'clientStart',root ) 
        else 
            setElementData( root,'playerName',tostring( result[1]['player'] ) ) 
            setElementData( root,'timeMT',tostring( result[1]['time'] ) ) 
            triggerClientEvent( 'clientStart',root ) 
        end 
    end 
) 

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