drk Posted February 13, 2012 Author Share Posted February 13, 2012 Wow! Top Hunter done Thanks for all again Kenix and Solidsnake. Anyone lock or move to trash this post. Link to comment
Kenix Posted February 13, 2012 Share Posted February 13, 2012 Wow! Top Hunter done 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. Link to comment
drk Posted February 14, 2012 Author Share Posted February 14, 2012 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 . Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 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. Link to comment
drk Posted February 15, 2012 Author Share Posted February 15, 2012 Function getRunningGamemodeMap should return nil if map not running and gm not running too. Map is running Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 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. Link to comment
drk Posted February 15, 2012 Author Share Posted February 15, 2012 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. Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 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 ) Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 Show steps for reproduce. Link to comment
drk Posted February 15, 2012 Author Share Posted February 15, 2012 What? I don't understand .-. Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 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 ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now