Jump to content

judge script


MatXpl

Recommended Posts

Posted

What do you mean by "judge"? like/dislike?

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

You could use SQLite, would be the best way.

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

ok, im going to write this

  
function vote(p,command,vote) 
local nick = getPlayerNametagText(p) 
executeSQLQuery("CREATE TABLE IF NOT EXISTS votes (nick TEXT, vote TEXT)") 
  
end 
addCommandHandler("vote",vote) 
  

it should looks like that ?

MTA:SA scripts/gamemodes/misc:

http://www.mtasa.xn.pl

Posted

You can make one table, then store the nick, map name, vote in a row.

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
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        executeSQLQuery ( "CREATE TABLE IF NOT EXISTS votes (nick TEXT, map TEXT, vote TEXT)" ) 
    end 
) 
  
function vote ( p, command, vote ) 
    local nick = getPlayerNametagText ( p ) 
    local mapName = getResourceName ( exports [ "mapmanager" ]:getRunningGamemodeMap ( ) ) 
    local check = executeSQLSelect ( "votes", "*", "nick = '".. tostring ( nick ) .."' AND map = '".. mapName .."'" ) 
    if ( type ( check ) == "table" and #check == 0 ) or not check then 
        executeSQLQuery ( "INSERT INTO votes VALUES (?,?,?)", nick, mapName, vote ) 
    end 
end 
addCommandHandler ( "vote", vote ) 

Try that.

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

It should only insert once for each map and nick.

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

Well, that's different, you must use the MySQL functions for that.

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

Yes, that's used to connect both to a own SQLite file or a MySQL server.

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.

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