MatXpl Posted December 26, 2012 Share Posted December 26, 2012 how can i make script to judge maps ? ;D How to save this ? (best method) Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 What do you mean by "judge"? like/dislike? Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 You could use SQLite, would be the best way. Link to comment
MatXpl Posted December 26, 2012 Author Share Posted December 26, 2012 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 ? Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 You can make one table, then store the nick, map name, vote in a row. Link to comment
MatXpl Posted December 26, 2012 Author Share Posted December 26, 2012 can you give me a simple example ? Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 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. Link to comment
MatXpl Posted December 26, 2012 Author Share Posted December 26, 2012 thanks! is working that it not allows the player to vote for the same map twice ? (check) Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 It should only insert once for each map and nick. Link to comment
MatXpl Posted December 26, 2012 Author Share Posted December 26, 2012 ohhh, ok and how to connect with my sql server? Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 Well, that's different, you must use the MySQL functions for that. Link to comment
MatXpl Posted December 26, 2012 Author Share Posted December 26, 2012 https://wiki.multitheftauto.com/wiki/DbConnect https://wiki.multitheftauto.com/wiki/Mod ... ql_connect this when resource start ? Link to comment
Castillo Posted December 26, 2012 Share Posted December 26, 2012 Yes, that's used to connect both to a own SQLite file or a MySQL server. 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