Jump to content

Where to save top hunter data


drk

Recommended Posts

Posted

How can I convert miliseconds to seconds ( ms outputed by getTimePassed() )??

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

Posted
function msToSeconds( int ) 
    if type( int ) == 'number' then 
        return int/1000 
    end 
    return false 
end 

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

msToSeconds ( time ) ? time = exports.race:getTimePassed()

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

It's possible to set the text of a dx text in server side ?

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted (edited)

No.

You need use setElementData/getElementData.

Algorithm.

Map started -> sql request if map have in table then setElementData -> get data -> draw in( onClientRender ).

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Now it working, but when I change the map and put the other again it don't gets my top. Appear: No one :S

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
Now it working, but when I change the map and put the other again it don't gets my top. Appear: No one :S

Show code.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

How can I compare the time passed with the top time ?

                local time = exports.race:getTimePassed( ) 
                local min, sec = convertTime(time) 
  
                --if time is better than the top 1 
                theTime = executeSQLQuery( "SELECT time FROM Top WHERE map = '" ..mapName.. "'" ) 
                if time >= theTime[1]['time'] then 
                triggerEvent('onGotTop',source) 
  
                --update top 
                executeSQLQuery( "UPDATE Top SET player= '"..player.."', time= '"..min..":"..sec.."' WHERE map='"..mapName.."'" ) 

I don't know how I can compare because theTime[1]['time'] is a string :S

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

You can split the string and then compare it.

Use:

split 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local data = split(theTime[1]['time'], ':') 
if data[1] then print(data[1]) end 
if data[2] then print(data[2]) end 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
                local min, sec = convertTime(time) 
  
                --if time is better than the top 1 
                theTime = executeSQLQuery( "SELECT time FROM Top WHERE map = '" ..mapName.. "'" ) 
                local old = split(theTime[1]['time'],':') 
                if old[1] < time and old[2] < time then 
                triggerEvent('onGotTop',source) 
  
                --update top 
                executeSQLQuery( "UPDATE Top SET player= '"..player.."', time= '"..min..":"..sec.."' WHERE map='"..mapName.."'" ) 

But time variable is only one, if I compare with min and sec it will return string and I will get error "Attempt to compare string with number" :S

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
                local min, sec = convertTime(time) 
  
                --if time is better than the top 1 
                theTime = executeSQLQuery( "SELECT time FROM Top WHERE map = '" ..mapName.. "'" ) 
                local old = split(theTime[1]['time'],':') 
                if (tonumber(old[1]) < min and tonumber(old[2]) < sec) then 
                triggerEvent('onGotTop',source) 
  
                --update top 
                executeSQLQuery( "UPDATE Top SET player= '"..player.."', time= '"..min..":"..sec.."' WHERE map='"..mapName.."'" ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thanks dude. It worked.

Now I can solve my level system script error xD

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

How can I get the map name without using onGamemodeMapStart?

Because when a player joins the player get Top name: False Time: False because no map has been started for the local.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

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

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

\õ/ MTA SA Wiki have this functions in Resources page?

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

Ye, thanks for all. I will start searching there before create a topic or reply with a noob question xD

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

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