Jump to content

Artisz

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by Artisz

  1. This part of the resource I understand. Thanks for the guide. But when I clicked one of the generated draw text, how can I choose the correct one, what I clicked on? I don't want to use the basic gui, because it is ugly in a custom dxdraw inteface.
  2. What you wrote, I don't understand, sorry, but I am bad in English. But you linked this gridlist, and I saw that the gridlist a gui. So what if I set the grid list alpha 0, and create label above it. It can be working, isn't it? I ask this because now I can't try it. If it is working, than how can I solve the scrolling? Sorry for the problems..
  3. Hi! I want to create a member list with guiLabel or dxDrawText(nevermind, just working). But I can't make that the created Label has an own ID what is the player ID, that when I click the player name, I got hes informations. I don't know what I did... Here is the code: local memberlist = {} local player_cache = {} function Test() player_cache = getElementsByType("player") for k,v in ipairs(player_cache) do local slot = nil for k = 1, 200 do if (memberlist[k]==nil) then local name = getPlayerName(v) local slot = k - 1 memberlist[slot] = guiCreateLabel(400,60 + slot * (30) ,700,50,name,false) addEventHandler("onClientGUIClick",memberlist[slot],handleButtonClick) break end end end end function handleButtonClick(button,state) if (button == "left" and state == "up") then outputChatBox(tostring(slot)) end end When I click my name label, I got: "nil", and I think when there is more the 1 online player, then I can click just the latest player's label(I don't know, I can't try this at the moment, just a long time ago)
  4. It's working! Thanks guys, you're awesome:D
  5. I use dxdrawtext because the chat doesn't appear. I got this: It's not can be the problem?: local selectedSkin = table.concat(selectedTable, _, skinPlace)
  6. Missing? But I put all the .png files in the folder, and I wrote them in the meta.xml
  7. Thanks for help, but I still have some problem. I don't know why it is do it: Here is the code with the line 460: maleSkins = {0, 1, 2, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 57, 58, 59, 60, 61, 62, 66, 67, 68, 70, 71, 72, 73, 78, 79, 80, 81, 82, 83, 84, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 132, 133, 134, 135, 136, 137, 142, 143, 144, 146, 147, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 200, 202, 203, 204, 206, 209, 210, 212, 213, 217, 220, 221, 222, 223, 227, 228, 229, 230, 234, 235, 236, 239, 240, 241, 242, 247, 248, 249, 250, 252, 253, 254, 255, 258, 259, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 290, 291, 292, 293, 294, 295, 296, 297, 299, 300, 301, 302, 303, 305, 306, 307, 308, 309, 310, 311, 312} femaleSkins = {9, 10, 11, 12, 13, 31, 38, 39, 40, 41, 53, 54, 55, 56, 63, 64, 69, 75, 76, 77, 85, 87, 88, 89, 90, 91, 92, 93, 129, 130, 131, 138, 139, 140, 141, 145, 148, 150, 151, 152, 157, 169, 172, 178, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 201, 205, 207, 211, 214, 215, 216, 218, 219, 224, 225, 226, 231, 232, 233, 237, 238, 243, 244, 245, 246, 251, 256, 257, 263, 298, 304} local selectedTable = maleSkins local skinPlace = 1 elseif (source == char_male) then selectedTable = maleSkins elseif (source == char_female) then selectedTable = femaleSkins elseif (source == char_arrow_right) then skinPlace = skinPlace + 1 elseif (source == char_arrow_left) then skinPlace = skinPlace - 1 --It has an OnClientRender handler: function skinSelector() local selectedSkin = table.concat(selectedTable, _, skinPlace) if (tonumber(selectedSkin) > 9) then dxDrawImage(50,50,60,60,"kep/0"..selectedSkin..".png",atlatszo_charmaker) --Line 460 else dxDrawImage(50,50,360,120,"kep/00"..selectedSkin..".png",atlatszo_charmaker) end end
  8. Yeah, that's what I want, thanks:D I have no script, because I don't know have can I make. I just know that there are two tables, for example: local maleskins = {1,3,5,7} local femaleskins = {0,2,4,6} And there is two button, a male and a female button, where we can choose, what table are we want to use. After that, whitin the choosen table we can change the skin. I don't want to write it for me, just help start this. If you can help me, I'd be happy. Sorry for my English!
  9. Hi! How can choose a table, and within that how can I choose the next, or prev skin(with arrows)? I want to sorted the skins based on gender and skin color.
  10. Hi! I downloaded the colorpicker resource from here, and I want to make with this a customizable HUD, but I have some problems. I could make that in colopicker set an element's color from the hud with set/getElementData, but I want to do that set the elements's color separately. And I don't know what is the problem. addEventHandler( 'onClientRender', root, function() q1 = getElementData(localPlayer, "R1") w1 = getElementData(localPlayer, "G1") e1 = getElementData(localPlayer, "B1") q2 = getElementData(localPlayer, "R2") w2 = getElementData(localPlayer, "G2") e2 = getElementData(localPlayer, "B2") felso_hatter = dxDrawRectangle ( 997,10,358,76, tocolor ( q1, w1, e1, 150 ) ) also_hatter = dxDrawRectangle ( 997,10,3,76, tocolor ( q2, w2, e2, 150 ) ) end) function szin1() exports.cpicker:openPicker(1, color, "HUD Színválasztó: Felso Háttér") addEventHandler("onColorPickerChange", root, pick1) end addCommandHandler("felsohatter", szin1) function szin2() exports.cpicker:openPicker(2, color, "HUD Színválasztó: Alsó Háttér") addEventHandler("onColorPickerChange", root, pick2) end addCommandHandler("alsohatter", szin2) function pick1(element, hex, r, g, b) setElementData(localPlayer, "R1", r) setElementData(localPlayer, "G1", g) setElementData(localPlayer, "B1", b) end function pick2(element, hex, r, g, b) setElementData(localPlayer, "R1", r) setElementData(localPlayer, "G2", g) setElementData(localPlayer, "B3", b) end
  11. Hi again! In the panel there is the members name, but when there are more member's than one, I can click just the latest member's name. I have an idea: To the label, add id(I don't know how can I write itxD). How can I do this? local forgatni = 0 local player_cache = {} local elem = 0 player_cache = getElementsByType("player") for k,v in ipairs(player_cache) do local name = getPlayerName(v):gsub("_", " ") if (k > forgatni and elem < 14) then elem = elem + 1 memberlist = guiCreateLabel(400,60 + elem * (30) ,700,50,name,false,bg) end end It is just a test, so the members are the online players!
  12. Oh. It is very simple:D Thanks!
  13. Hi! Sorry for my English! I want to create a welcome text in more row, but this way is difficult: text["welcome1"] = guiCreateLabel(400,70,5000,5000,"Welcome to the Faction Panel!",false,bg) text["welcome2"] = guiCreateLabel(315,130,5000,5000,"Here, you can customize your faction!",false,bg) Are there any easier solution?
  14. Nevermind. I solved the problem. I misspelled this two lines: setElementData(source, "CharSkin", accData.charactername) setPlayerName (source, tostring(getPlayerData(source, "CharName")))
  15. Hi! (Sorry for my English!) I want to create an RP login system with mysql. I can save my basic details: Username, password, serial, admin, etc. I want to save the player name too, but I have problems. First, in the system, need to give the username and the password twice. If it is ok, we go to a character creator window, where now there is just the character name's input, nothing else. Somehow I could save the given name in mysql. When I firs logging in to the server, it is running correct, my name is changing. But after a relog, I don't know, what is happening. It writes: false is now known as nil nil is now known as false But in the mysql has no problem. Register, mysql insert: addEvent("onPlayerAttemptFinish",true) addEventHandler("onPlayerAttemptFinish",root, function(name) if (exports["main"]:singleQuery("SELECT charactername FROM accounts WHERE charactername=? LIMIT 1",string.lower(name))) then exports.infobox:showBox (root,"error","Username has already taken!") else local charname = string.gsub(tostring(name), " ", "_") local safecharname = (charname) local x,y,z = 1450.32421875, -2287.287109375, 13.546875 username = getElementData(source, "accountUsername") password1 = getElementData(source, "accountPassword") if (dbExec(kapcsolat, "INSERT INTO accounts (username,password,mtaserial,registerdate,ip,admin,warns,money,monitored, charactername) VALUES (?,?,?,?,?,?,?,?,?,?)",string.lower(username),sha256(password1),getPlayerSerial(source), getRealTime(), getPlayerIP (source),0,0,0,0, tostring(safecharname))) then setElementData(source, "CharName", safecharname) triggerClientEvent(source,"switchToLogin",source) end end end) Login addEvent("onPlayerAttemptLogin",true) addEventHandler("onPlayerAttemptLogin",root, function(username,password) if (exports["main"]:singleQuery("SELECT * FROM accounts WHERE username=? LIMIT 1",string.lower(username))) then local accData = exports["main"]:singleQuery("SELECT * FROM accounts WHERE username=? AND password=? LIMIT 1",string.lower(username),sha256(password)) if (accData) then setElementData(source,"accountID",accData.id) setElementData(source,"accountUsername",accData.username) setElementData(source, "adminlevel", accData.admin) setElementData(source, "adminduty", 0) setElementData(source, "skinid", accData.skin) setElementData(source, "money", accData.money) setElementData(source, "dimension", accData.dimension_id) setElementData(source, "CharSkin", accData.charactername) setPlayerName (source, tostring(getPlayerData(source, "CharName"))) setElementModel(source, getElementData(source, "skinid")) fadeCamera(source,false,1.0,0,0,0) setTimer(fadeCamera,2000,1,source,true,1.0,0,0,0) setCameraTarget(source,source) showChat(source,true) showPlayerHudComponent(source,"radar",true) showPlayerHudComponent(source,"area_name",true) --spawnPlayer(source,accData.x,accData.y,accData.z+1,accData.rotation,accData.skin,accData.interior,accData.dimension,accData.team) spawnPlayer (source, 0, 0, 5, 0, math.random (0,288), 0, 0, spawnTeam)
  16. I found the "sg_functions" folder, there is a mysql.lua with the mysql connection. The login script server.lua(there is the problem), start with this line: local mysql = exports.mysql No i changed it: local mysql = exports.sg_functions And now I get this Error: ERROR: sg_login\server.lua:28: attempt to concatenate a boolean value The 28th line: end, {player,username,md5password}, mysql:getConnection(), ("SELECT * FROM characters WHERE charactername='" .. safecharname .. "' AND account='" .. mysql:escape_string(id) .. "' AND cked = 0")
  17. But there is no mysql in the resource folder
  18. I don't think so that I know what you saidxD Sorry I try to close the dbQuery parenthesis like this: dbQuery(function(qh, player, username, md5password) local a, b, c = dbPoll(qh, 0) if b > 0 then outputChatBox("Neked már van accountod") regisztalhat = false return end end, {player,username,md5password}, mysql:getConnection(), ("SELECT * FROM characters WHERE charactername='" .. safecharname .. "' AND account='" .. mysql:escape_string(id) .. "' AND cked = 0") ) And now I get this Error: sg_login\server.lua:1: exports: Call to non-running server resource (mysql) [string "?"] And if I delete this changing, I get this error again, don't matter, what I am doing. So I did something wrong, I guess. And what am I doing with this line? {player,username,md5password}, mysql:getConnection(), ("SELECT * FROM characters WHERE charactername='" .. safecharname .. "' AND account='" .. mysql:escape_string(id) .. "' AND cked = 0") I don't understand.
  19. Hi guys! I just want to practice the mysql save, and I downloaded a mod, where there is direct mistakes, and I can't fint they. In principle they are just erratums(or whatxD). I written the whole server.lue file, because I don't know where is the error And the Error messages: http://kepfeltoltes.hu/160109/78780345N ... es.hu_.png Sorry for bad English! local mysql = exports.mysql local postable = {} local regisztalhat = true function playerRegister(player, username, password, password2) local md5password = md5(password) if(password~=password2)then triggerClientEvent("info",player,"A felhasználónév túl rövid!", "red") return end if(string.len(username)<5)then triggerClientEvent("info",player,"A felhasználónév túl rövid!", "red") return end if(string.len(password)<5)then triggerClientEvent("info", player, "A jelszó túl rövid!", "red") return end serial = getPlayerSerial(player) dbQuery(function(qh, player, username, md5password) local a, b, c = dbPoll(qh, 0) if b > 0 then outputChatBox("Neked már van accountod") regisztalhat = false return end end, {player,username,md5password}, mysql:getConnection(), ("SELECT * FROM characters WHERE charactername='" .. safecharname .. "' AND account='" .. mysql:escape_string(id) .. "' AND cked = 0") dbQuery(function(qh, player, username, md5password) local result, rows, errorMsg = dbPoll(qh, 0) if not regisztalhat then return end if rows > 0 then exports.sg_box:addNotification("Ez a felhasználónév már foglalt!","red") else local _, id = mysql:query_free("INSERT INTO accounts SET serial = '".. serial .."', username = '"..tostring(username).."', password = '"..tostring(md5password).."'", true) exports.sg_box:addNotification("Sikeresen regisztráltál!","green") end end, {player,username,md5password}, mysql:getConnection(), "SELECT * FROM accounts WHERE username = ? LIMIT 1", username) end) addEvent("playerRegister", true) addEventHandler("playerRegister", getRootElement(), playerRegister) function playerLogin(player, username, password) password = md5(password) local query = mysql:singleQuery("SELECT * FROM accounts WHERE username = ? AND password = ? LIMIT 1", username, password) if query then --local querys = mysql:singleQuery("SELECT serial FROM accounts WHERE username = ? LIMIT 1", username) outputChatBox("[socialGaming] #FFFFFFSikeres bejelentkezés!",player,169,139,101,true) setElementData(player, "accountID", query.id) acc = getElementData(player, "accountID") CharSelect(acc, player) setElementData(player, "adminlevel", query.admin) else outputChatBox("[socialGaming] #FFFFFFSikertelen bejelentkezés!",player,177,9,45,true) end end addEvent("playerLogin", true) addEventHandler("playerLogin", getRootElement(), playerLogin) addEvent("createCharacter", true) addEventHandler("createCharacter", getRootElement(), function(p, nev, kor, suly, magassag, leiras, gender, color) acc = getElementData(p, "accountID") local qh = dbQuery( mysql:getConnection(), "SELECT `charactername` FROM `karakterek` WHERE `charactername` = ?", tostring(a)) local result = dbPoll ( qh, -1 ) local count = 0 local pw u = nil if result then for _, row in ipairs ( result ) do u = string.lower(row["charactername"]) end if u ~= nil then exports.sg_box:createSmallNotification(client,"Már van ilyen karakter név, kérlek válassz másikat!", 1) return end end dbFree( qh ) local user = getElementData(client, "username") qhh = dbExec( mysql:getConnection(), "INSERT INTO `karakterek` SET `charactername` = ?, `id` = ?, `skin` = 1, `kor` = ?, `suly` = ?, `magassag` = ?, `leiras` = ?, `gender` = ?,`color` = ? ", nev, acc, kor, suly, magassag, leiras, gender, color) if qhh then CharSelect(acc, p) end end) local postable = {} function CharSelect(acc, source) local accid = getElementData(source,"accountID") local qh = dbQuery(mysql:getConnection(),"SELECT * FROM karakterek WHERE id = ? LIMIT 1", accid) local result, lineNumber = dbPoll ( qh, -1 ) if(result) then if(lineNumber > 0) then for _, rows in ipairs( result ) do postable = {} level = rows["level"] xp = rows["xp"] jatszottpercek = rows["spentTime"] nev = rows["charactername"] anev = rows["adminnick"] fraki = rows["faction"] frakir = rows["factionrank"] factionleader = rows["factionleader"] skin = rows["skin"] dutyskin = rows["dutyskin"] induty = rows["inDuty"] kor = rows["kor"] suly = rows["suly"] mag = rows["magassag"] job = rows["job"] desc = rows["leiras"] gender = rows["gender"] health = rows["health"] bankmoney = rows["bankmoney"] keszpenz = rows["keszpenz"] money = rows["money"] color = rows["color"] pajzs = rows["pajzs"] ehesseg = rows["ehesseg"] maxvehicles = rows["maxvehicles"] hasznaltkocsislot = rows["hasznaltkocsislot"] premiumPont = rows["premiumPont"] adminduty = rows["adminduty"] adminlevel = rows["adminlevel"] pozicio = fromJSON(rows["pozicio"]) postable = {pozicio[1],pozicio[2],pozicio[3],pozicio[4]} halal = rows["isDead"] end setPlayerName(source, string.gsub(nev, " ", "_")) setElementData(source, "charactername", nev) setElementData(source, "adminduty", 0) setElementData(source, "adminnick", anev) spawnPlayer(source, postable[1], postable[2], postable[3], postable[4]) setElementData(source, "logedin", true) setElementData(source, "jatszottpercek", jatszottpercek) setElementData(source, "faction", fraki) setElementData(source, "factionrank", frakir) setElementData(source, "factionleader", factionleader) setElementData(source, "age", kor) setElementData(source, "gender", gender) setElementData(source, "bankmoney", bankmoney) setElementData(source, "keszpenz", keszpenz) setElementData(source, "adminduty", adminduty) setElementData(source, "adminlevel", adminlevel) setElementData(source, "premiumPont", premiumPont) setElementData(source, "xp", xp) setElementData(source, "level", level) if halal == 1 then setElementHealth(source, 0) else setElementHealth(source, health) end setElementData(source, "money", money) setElementData(source, "color", color) setPedArmor(source, pajzs) setElementData(source, "weight", suly) setElementData(source, "height", mag) setElementData(source, "desc", desc) setElementData(source, "job:id", job) setElementData(source, "ehesseg", ehesseg) setElementData(source, "maxvehicles", maxvehicles) setElementData(source, "hasznaltkocsislot", hasznaltkocsislot) setElementData(source, "normalskin", skin) setElementData(source, "dutyskin", dutyskin) setElementData(source, "inDuty", induty) if getElementData(source, "inDuty") then actualskin = getElementData(source, "dutyskin") else actualskin = getElementData(source, "normalskin") end setElementModel(source, actualskin) --color health ehesseg pajzs spentTime faction factionrank factionleader maxVeh maxInt setCameraTarget(source) triggerClientEvent(source,"succes", source) else triggerClientEvent(source,"characterCreation", source) end end end addEventHandler("onPlayerQuit", getRootElement(), function() if getElementData(source, "logedin") then savePlayer(source) end end) function savePlayer(p) if isElement(p) then local x,y,z = getElementPosition(p) local rot = getPedRotation(p) local dbid = tonumber(getElementData(p, "accountID")) or 0 local admin = tonumber(getElementData(p, "adminlevel")) or 0 local position = toJSON({x,y,z,rot}) local orak = getElementData(p, "jatszottpercek") or 0 local faction = getElementData(p, "faction") or 0 local hp = getElementHealth(p) local bankmoney = getElementData(p, "bankmoney") local keszpenz = getElementData(p, "keszpenz") local money = getElementData(p, "money") local armor = getPedArmor(p) local ehesseg = getElementData(p, "ehesseg") local skin = getElementData(p, "normalskin") local duty = getElementData(p, "inDuty") local dutyskin = getElementData(p, "dutyskin") local job = getElementData(p, "job:id") local maxvehicles = getElementData(p, "maxvehicles") or 4 local hasznaltkocsislot = getElementData(p, "hasznaltkocsislot") or 0 local premiumPont = getElementData(p, "premiumPont") or 0 local xp = getElementData(p, "xp") or 0 local level = getElementData(p, "level") or 0 dbExec(mysql:getConnection(), "UPDATE karakterek SET pozicio = ?, spentTime = ?, faction = ?, health = ?, bankmoney = ?, money = ?, pajzs = ?, ehesseg = ?, skin = ?, job = ? WHERE ID = ?", position, spentTime, faction, hp, bankmoney, money, armor, ehesseg, skin, job, dbid) dbExec(mysql:getConnection(), "UPDATE karakterek SET maxvehicles = ?,hasznaltkocsislot = ?,premiumPont = ?, inDuty = ?, dutyskin = ?, keszpenz = ? WHERE ID = ?", maxvehicles,hasznaltkocsislot,premiumPont, duty, dutyskin,keszpenz,dbid) dbExec(mysql:getConnection(), "UPDATE accounts SET admin = ? WHERE ID = ?",admin,xp,level,dbid) dbExec(mysql:getConnection(), "UPDATE karakterek SET xp=?,level=? WHERE ID = ?",xp,level,dbid) end end addEvent("savePlayer", true) addEventHandler("savePlayer", getRootElement(), savePlayer) function saveAllPlayer() local count = 0 for i, p in ipairs(getElementsByType("player")) do if (getElementData(p, "logedin") or false) then savePlayer(p) count = count + 1 end end outputDebugString("Ellett mentve "..count.." jatekos adata!") end saveAllPlayer() setTimer(saveAllPlayer, 1000*60*10, 0) addCommandHandler("saveall",saveAllPlayer) addEvent("checkPlayerBanState", true) addEventHandler("checkPlayerBanState", getRootElement(), function(player) local serial = getPlayerSerial(player) local query = dbQuery(mysql:getConnection(),"SELECT * FROM banlist WHERE serial=?",serial) local qh = dbPoll(query, -1) local playerSerial, timeStamp, bannedBy, reason if #qh > 0 then for k, data in ipairs (qh) do
×
×
  • Create New...