Jump to content

Cadu12

Retired Staff
  • Posts

    827
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Cadu12

  1. Cadu12

    dbPoll

    You're welcome.
  2. Cadu12

    dbPoll

    http://www.w3schools.com/sql/sql_orderby.asp
  3. Cadu12

    dbPoll

    function updateRank() for i, v in ipairs(getElementsByType("player")) do if getElementData(v, "guest_") ~= 1 then local res = sqlC:query("SELECT * FROM accounts WHERE username='"..getElementData(v, "username_").."'") if res then local result = mysql_fetch_assoc(res) local rank = sqlC:query("SELECT * FROM accounts WHERE points>='" .. result["points"].."'") local r = mysql_fetch_assoc(rank) if r then setElementData(v, "Rank", r["points"]) end end end end end
  4. libmysql.dll is only in "server" folder, and mta_mysql.dll is only in "modules" folder.
  5. Esqueça que criar novo table no table? Por exemplo: local tables = {} tables["frutas"] = { "maca", "laranja", "banana", "melancia", "ameixa" } for i, nome_fruta in ipairs(tables["frutas"]) do outputChatBox(nome_fruta) end (Nao testei)
  6. It's just compiled Lua using LuaC. no just put it in gameplay and try it on the game and see .. MOJRM-511 is a hack he's trying to hack by this code . What is your problem? I dont see his problem. Can you post a screenshot about his script, please?
  7. Stole script. We wont help who is steal.
  8. It worked for me, in my host. It's mysql_fetch_assoc
  9. function loginHandler(username,password) local result = mysql_query(handler, "SELECT * FROM accounts WHERE accname='" .. username .. "' AND accpassword='" .. password .. "'") local row = mysql_fetch_assoc(result) if(result)then outputChatBox("You have successfully logged in!", client, 0, 255, 0) setElementData(client, "logged", 1) setElementData(client, "account:admin", tonumber(row["admin"])) local AStatus = tonumber(row["admin"]) if (AStatus == 1) then outputChatBox("You are playing as a PR Moderator.", client, 0, 0, 255) elseif (AStatus == 2) then outputChatBox("You are playing as a PR Administrator.", client, 0, 0, 255) elseif (AStatus == 3) then outputChatBox("Welcome back, Phoenix.", client, 0, 0, 255) end return true else outputChatBox("Your username and/or password is incorrect!", client, 255, 0, 0) triggerClientEvent(client, "displayLogin", getRootElement()) return false end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) Try my code, I tested in my localhost.
  10. Try use https://wiki.multitheftauto.com/wiki/Mod ... _fetch_row Should work
  11. Cadu12

    Command

    You're welcome
  12. Im not sure, but maybe use "row[1]["admin"]" at 2 and 3 lines.
  13. Hmm, try my code, if it didnt worked, try debug with outputChatLog
  14. Cadu12

    Command

    restriction = {} function findPlayer(namepart) for i, player in ipairs(getElementsByType("player")) do local name = getPlayerName(player) local name2 = string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") if string.find(name:lower(), namepart:lower(), 1, true) then return player, name elseif string.find(name2:lower(), namepart:lower(), 1, true) then return player, name end end return false end function luck(player, cmd, who) if (not restriction[player]) then restriction[player] = {} end if not restriction[player][cmd] then if who then local target = findPlayer ( who ) if target then outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 say: Lucky "..getPlayerName(target).."!", root, 255, 255, 255, true) restriction[player][cmd] = true setTimer(function () restriction[player][cmd] = false end, 5000, 1) end else outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 say: Lucky!", root, 255, 255, 255, true) restriction[player][cmd] = true setTimer(function () restriction[player][cmd] = false end, 5000, 1) end else outputChatBox("#FF0000You must wait #FFFFFF5 seconds#FF0000 to write this command again.", player, 255, 255, 255, true) end end addCommandHandler("lu", luck)
  15. Cadu12

    Command

    Try my code, im fixed it for you.
  16. Cadu12

    Command

    restriction = {} function luck(player, cmd, who) if (not restriction[player]) then restriction[player] = {} end if not restriction[player][cmd] then if tostring(who) then local target = getPlayerFromName ( who ) if target then outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 say: Lucky "..getPlayerName(target).."!", root, 255, 255, 255, true) restriction[player][cmd] = true setTimer(function () restriction[player][cmd] = false end, 5000, 1) end else outputChatBox("#FFFFFF".. getPlayerName(player) .."#5DACD1 say: Lucky!", root, 255, 255, 255, true) restriction[player][cmd] = true setTimer(function () restriction[player][cmd] = false end, 5000, 1) end else outputChatBox("#FF0000You must wait #FFFFFF5 seconds#FF0000 to write this command again.", player, 255, 255, 255, true) end end addCommandHandler("lu", luck) Nick with colors wont work, you have to make your own getPlayerFromName.
  17. setElementData(client, "logged", 1) setElementData(client, "account:admin", tonumber(row["admin"]) or 3) local AStatus = tonumber(row["admin"]) or 3 if (AStatus == 1) then outputChatBox("You are playing as a PR Moderator.", client, 0, 0, 255) elseif (AStatus == 2) then outputChatBox("You are playing as a PR Administrator.", client, 0, 0, 255) elseif (AStatus == 3) then outputChatBox("Welcome back, Phoenix.", client, 0, 0, 255) end Did you forget about tonumber? ;/
  18. row[1]["accname"] or row["accname"] Not tested it.
  19. I thought it was "password" column, sorry, did it worked?
  20. Hmm, is there 'password' column in your mysql(?), try check it.
  21. function loginHandler(username,password) local row = mysql_query(handler, "SELECT * FROM accounts WHERE accname='" .. username .. "' AND password='" .. password .. "'") if row then outputChatBox("You have successfully logged in!", client, 0, 255, 0) mysql_free_result(row) return true else outputChatBox("Your username and/or password is incorrect!", client, 0, 255, 0) triggerClientEvent(client, "displayLogin", getRootElement()) return false end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler)
  22. We don't accept request here. Also stop posting for request.
  23. local row = mysql_query( handler, "SELECT * FROM `accounts` WHERE accname = '"..username.."' AND password = '" .. password .. "'" ); if( mysql_num_rows( row ) == 1 ) then return true else return false end
×
×
  • Create New...