Jump to content

Quebec

Members
  • Posts

    8
  • Joined

  • Last visited

Quebec's Achievements

Newbie

Newbie (4/54)

0

Reputation

  1. Thank you for your answer, it works. I'm pretty new to MySQL so I didn't know how to approach this.
  2. I tried it yet it gives me a wrong result. The value in database is set to 1 (true) and in game I get the message from FALSE ouputChatBox. I know that # operator measures the length of the variable but is there a way to identify the actual value of it?
  3. This could be a very basic question but I don't know where to search the answer so I came here. In the MySQL database I have a table called accounts and I want to get value from hascharacter column (tinyint value, 0 to 1)which is located inside accounts. After that I want to check if it is true but I don't know how. Here is the code: local hasCharacter = tonumber(hasCharacter) local verificationQuery = dbQuery(db, "SELECT `hascharacter` FROM `accounts` WHERE `hascharacter` = '" .. hasCharacter .. "'") local verificationResult = dbPoll(verificationQuery, -1) if verificationResult > 0 then --this is the line which I don't know how to use properly outputChatBox('Verification value is TRUE', thePlayer, 100, 255, 100) else outputChatBox('Verification value is FALSE', thePlayer, 255, 100, 100) end
  4. I checked the database connection code again and I found the error, dbConnect had some faulty arguments. Problem got fixed, thank you!
  5. Actually I think this could be an issue, I'll check when I get back home if everything is alright in the mysql connection
  6. I'm trying to make a login system but I keep getting this error: WARNING: login-panel\login_panel_s.lua:9: dbPoll failed; No database selected ERROR: login-panel\login_panel_s.lua:10: attempt to get length of local 'result' (a boolean value) This is the code: local db = exports.dbconnection:getConnection() addEvent('login:registerAccount', true) addEventHandler('login:registerAccount', root, function(thePlayer, username, password, email) if not username or not password or not email then return false end local queryCheck = dbQuery(db, "SELECT * FROM `accounts` WHERE `username` = '" .. username .. "'") local result = dbPoll(queryCheck, -1) if #result > 0 then return outputChatBox("Acest username exista deja!") end local mtaserial = getPlayerSerial(thePlayer) local playerIP = getPlayerIP(thePlayer) local hash = passwordHash(password, "bcrypt", {}) if hash then dbExec(db, "INSERT INTO `accounts` (`username`, `password`, `ip`, `mtaserial`, `email`) VALUES (?, ?, ?, ?, ?)", username, hash, ip, mtaserial, email) outputChatBox("Contul a fost creat cu succes", thePlayer) end end)
  7. Hi! I've made a simple menu using DGS and it works just fine on F1 key press but it pops up when I start the resource. I want it to not be visible on resource start but rather on F1 key press. This is the code: DGS = exports.dgs local reguli = xmlLoadFile( "reguli.xml" ) local reguli1 = xmlNodeGetValue( reguli ) local allstars = xmlLoadFile( "allstars.xml" ) local allstars1 = xmlNodeGetValue( allstars ) local donatii = xmlLoadFile( "donatii.xml" ) local donatii1 = xmlNodeGetValue( donatii ) local window = DGS:dgsCreateWindow( 0.2, 0.3, 0.6, 0.4, "Allstars Roleplay", true, 0xFF5E0464 ) DGS:dgsWindowSetSizeable( window, false ) showCursor ( true ) DGS:dgsWindowSetCloseButtonEnabled(window, false) local tab = DGS:dgsCreateTabPanel ( 0, 0.1, 1, 1, true, window, 20, 0xFF999999 ) local tab1 = DGS:dgsCreateTab ( "Despre Allstars", tab, 1, 1, 0xFF5E0464 ) local tab2 = DGS:dgsCreateTab ( "Reguli Roleplay", tab, 1, 1, 0xFF5E0464 ) local tab3 = DGS:dgsCreateTab ( "Donatii", tab, 1, 1, 0xFF5E0464 ) memo1 = DGS:dgsCreateMemo( 0, 0, 1, 1, reguli1, true, tab2, 0xFFFFFFFF, 1, 1, nil, 0xFF333333 ) DGS:dgsMemoSetReadOnly( memo1, true ) memo2 = DGS:dgsCreateMemo( 0, 0, 1, 1, allstars1, true, tab1, 0xFFFFFFFF, 1, 1, nil, 0xFF333333 ) DGS:dgsMemoSetReadOnly( memo2, true ) memo3 = DGS:dgsCreateMemo( 0, 0, 1, 1, donatii1, true, tab3, 0xFFFFFFFF, 1, 1, nil, 0xFF333333 ) DGS:dgsMemoSetReadOnly( memo3, true ) function dgsToggleVisible() if ( DGS:dgsGetVisible (window) == true ) then DGS:dgsSetVisible (window, false ) showCursor(false) else DGS:dgsSetVisible (window, true ) showCursor(true) end end bindKey ( "F1", "down", dgsToggleVisible )
×
×
  • Create New...