Jump to content

FlorinSzasz

Members
  • Posts

    136
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by FlorinSzasz

  1. You could use this resource is old but good and it works i used it when i was a beginner in scripting. https://www.youtube.com/watch?v=kazisZj-E98 https://forum.multitheftauto.com/topic/23029-rel-house-system-sql/ https://community.multitheftauto.com/index.php?p=resources&s=details&id=727
  2. Niște afiramții/formulări ce pot fi utile când dorim să aflăm informații legate de un anumit tabel sau coloane ce corespund unui tabel dintr-o bază de date. --- varianta MySQL local rez = dbPoll(dbQuery(connection,"SELECT table_name FROM information_schema.tables WHERE table_schema = '"..name.."';"),-1) -- inlocuiți name cu numele bazei de date de la care doriți să aflați informații legate de tabele -- rez o sa returneze un tabel cu denumirile tabelelor din baza de date pe care ați asociat-o cu variabila name for k,v in pairs(rez) do outputDebugString(v.table_name) end local rez = dbPoll(dbQuery(connection,"SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '"..table.."' ORDER BY ORDINAL_POSITION"),-1) -- selectam denumirea coloanelor si tipul datelor pentru tabela aflata sub variabila table for k,v in pairs(rez) do outputDebugString(v.COLUMN_NAME) outputDebugString(v.DATA_TYPE) end ---------------------- -- Pentru SQLite local rez = dbPoll(dbQuery(connection,"SELECT name FROM sqlite_master WHERE type='table';"),-1) -- aici nu mai aveti nevoie de denumirea bazei de date deoarece se returneaza tabelele din baza de date la care sunteti conectat. for k,v in pairs(rez) do if v.name ~= "sqlite_sequence" then outputDebugString(v.name) end end local rez = dbPoll(dbQuery(connection,"PRAGMA table_info("..tostring(table)..")"),-1) -- selectam date legate de coloane -- table este denumirea tabelului de la care dorim sa aflam date legate de coloane. for k,v in pairs(rez) do outputDebugString(v.name) outputDebugString(v.type) end
  3. Update 1.2 și 1.2.1 Update-ul 1.2 este dbFrame varianta pentru MySQL iar 1.2.1 este noul update pentru dbFrame pe SQLite. Ambele cuprind funcția nouă pentru drop table, optimizări au fost aduse codului. Din acest update nu mai este nevoie de restart dupa crearea unei baze de date mai mult decat atât totul se va face acum din panel, fără a mai fi nevoie de comenziile /GUIcreatetable /GUIinsert etc.
  4. This can be an option but it may look ugly even with the right color. https://wiki.multitheftauto.com/wiki/DxDrawLine3D
  5. This should help you https://wiki.multitheftauto.com/wiki/SetColShapeSize
  6. local result = dbPoll(dq,250) -- this should --be like this local result = dbPoll(dq,-1) --Also is result[1]["password"] encrypted? when you insert it into the database? passwordVerify(pass,result[1]["password"]) --------------------------------------------------- addEvent("login", true) addEventHandler("login", root, function (user, pass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE serial=?", serial) local result = dbPoll(dq,-1) if (#result > 0) then if user == result[1]["username"] then if (passwordVerify(pass,result[1]["password"])) then print("Sikeres bejelentkezés!") else print("Hibás jelszó!") end else print("Felhasználónév nem található!") end else print("Sikertelen bejelentkezés!") end end)
  7. i think there is full gamemode to look at which might make the things more complicated :)) thats why we dont get any lines of code.
  8. Update 1.1 Update de securitate orice panel poate fi accesat doar de un admin în cazul în care nu folosiți un acl.xml custom altfel intervine nevoia unor modificări suplimentare.
  9. he means the interiors table structure like what columns and data type do you have and so on.
  10. Update 1.02 niște buguri legate de funcțiile updateTable/InsertIntoTable au fost fixate și niște erori client side!
  11. UPDATE 1.01 au fost rezolvate niște buguri legate de funcția SelectFromTable() https://community.multitheftauto.com/index.php?p=resources&s=details&id=18897 Mai jos este prezentat un exemplu practic de utilizare a celor 3 funcții exportate! --Example -- create the first db or second or third ... you know -- restart the resource -- create a table for one of your databases ---my id of db is 1 (your id can be 2 or 3 it depends on how many dbs you have created and which one you want to use) ---my table name is tutorial -- username is column of reference when i select and update data! addEventHandler ('onPlayerLogin',getRootElement(),function (_,theCurrentAccount) local acc_name = getAccountName(getPlayerAccount(source)) if acc_name then -- db id 1 / table tutorial / column username / and we look for username account name! rezult = exports["dbFrame"]:SelectFromTable(1,"tutorial","username",acc_name) if rezult then for k,v in ipairs(rezult) do setPedArmor(source,v.armour) setPlayerMoney(source,v.money) setElementModel(source,v.model) end else exports["dbFrame"]:InsertIntoTable(1,"tutorial",acc_name,"username",acc_name) end end end) addEventHandler("onPlayerQuit",getRootElement(),function() local acc_name = getAccountName(getPlayerAccount(source)) if acc_name then exports["dbFrame"]:updateTable(1,"tutorial","username",acc_name,"armour,money,model",getPedArmor(source),getPlayerMoney(source),getElementModel(source)) end end)
  12. DBFrame este o resursă dedicată celor care nu au experiență în utilizarea bazelor de date sau celor care doresc o abordare diferită în utilizarea acestora. Resursa oferă un panel pentru: - inserare in tabel - update de tabel - creare de tabel - ștergerea unui rând din tabel - crearea de baze de date - pentru a vizualiza bazele de date existente - pentru a vedea denumirea coloanelor dintr-un tabel și tipul de date pe care îl reprezintă Bonus funcții exportate: updateTable() InsertIntoTable() SelectFromTable() // Funcțiie sunt explicate mai detaliat in documentul info.txt din arhiva unde sunt regăsite resursele. Link -> https://community.multitheftauto.com/index.php?p=resources&s=details&id=18897
  13. Interesting, i never had this problem. You need to add this in registerWindow function toggleControl("chatbox",false) And also add this into your dgs mouse click EventHandler function. if source == buttonExecute then -- after this line of code add the line of code i wrote below toggleControl("chatbox",true) I also want to say there is no stupidity you just want to do to much to fast, take your time and read the wiki and topics on forum. With the time you will learn faster or slower it doesnt matter, if you put a little bit of work you will learn something today, something tomorrow and so on. https://forum.multitheftauto.com/forum/123-tutorials/ https://www.youtube.com/@ngear2872/videos
  14. Client Side we have to do this Also you dont need openPanel or closePanel functions you can delete this functions and in first part of the script put all things in a function like i did. local playerPassportEdit = createMarker(-712.9, 962.5, 12.3-1.7,"cylinder",2.0,255,0,0,104) local on = 0 function registerWindow() if on == 1 then return end on = 1 window = dgs:dgsCreateWindow(((sw-800)/2)*px,((sh-600)/2)*py,800*px,600*py,"Паспорт",false) buttonExecute = dgs:dgsCreateButton(325*px,530*py,150*px,40*py,"Подтвердить",false,window,nil,nil,nil,nil,nil,nil,tocolor(255,0,0),tocolor(100,0,0),tocolor(255,0,0)) labelFirstName = dgs:dgsCreateLabel(200*px,200*py,400*px,30*py," Имя: ",false,window) editFirstName = dgs:dgsCreateEdit(200*px,220*py,400*px,30*py,"",false,window,tocolor(255,255,255),nil,nil,nil) dgs:dgsSetProperty(labelFirstName,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editFirstName,"alignment",{"center"}, {"center"}) labelLastName = dgs:dgsCreateLabel(200*px,270*py,400*px,30*py," Фамилия: ",false,window) editLastName = dgs:dgsCreateEdit(200*px,290*py,400*px,30*py,"",false,window,tocolor(255,255,255),nil,nil,nil) dgs:dgsSetProperty(labelLastName,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editLastName,"alignment",{"center"}, {"center"}) labelAge = dgs:dgsCreateLabel(200*px,340*py,400*px,30*py," Возраст: ",false,window,tocolor(255,255,255),nil,nil,nil) editAge = dgs:dgsCreateEdit(200*px,360*py,400*px,30*py,"",false,window) dgs:dgsSetProperty(labelAge,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editAge,"alignment",{"center"}, {"center"}) labelCountry = dgs:dgsCreateLabel(200*px,410*py,400*px,30*py," Страна: ",false,window,tocolor(255,255,255),nil,nil,nil,tocolor(100,100,100,100)) editCountry = dgs:dgsCreateEdit(200*px,430*py,400*px,30*py,"",false,window) dgs:dgsSetProperty(labelCountry,"alignment",{"center"}, {"center"}) dgs:dgsSetProperty(editCountry,"alignment",{"center"}, {"center"}) dgs:dgsWindowSetMovable(window,false) dgs:dgsWindowSetSizable(window,false) dgs:dgsWindowSetCloseButtonEnabled(window,false) showCursor(true) end function passportRegister ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer and source == playerPassportEdit then registerWindow() end end addEventHandler ( "onClientMarkerHit", getResourceRootElement(), passportRegister ) --------- here we need to add somehting --- addEventHandler("onDgsMouseClick",root,function(btn,state) if btn == "left" and state == "down" then if source == buttonExecute then local firstName = dgs:dgsGetText(editFirstName) local lastName = dgs:dgsGetText(editLastName) local age = dgs:dgsGetText(editAge) local country = dgs:dgsGetText(editCountry) if not string.find(firstName,"%S") then outputChatBox("Name") return end if not string.find(lastName,"%S") then outputChatBox("LastName") return end if not string.find(age,"%d") then outputChatBox("Age") return end if not string.find(country,"%S") then outputChatBox("Country") return end triggerServerEvent("playerPassportEnter",localPlayer,firstName,lastName,age,country) -- also here we need this dgs:dgsSetVisible(window,false) showCursor(false) on = 0 end end end)
  15. Data from db is static it wont change unless you want to update it. It will be always the same because players cant make any changes. If you mean you can edit the client side memo you can do this to disable that. https://wiki.multitheftauto.com/wiki/DgsMemoSetReadOnly -- client side -- you look after this line of code local CountryInfo = dgs:dgsCreateMemo(10,100,150,25,"Страна: "..rezult[1]['Country'].."",false,passport_info) --after this line you add this lines of code dgsMemoSetReadOnly(firstNameInfo,true) dgsMemoSetReadOnly(lirstNameInfo,true) dgsMemoSetReadOnly(ageInfo,true) dgsMemoSetReadOnly(CountryInfo,true)
  16. 1. To close your panel with Close button you have to use the dgs event like you did before. 2. You cant edit the data from db without a db browser or an update statement. 3.You get the data and send it to client on the marker hit event. 4. If you want to get the data from db on another function or event you can but you need to have the player who triggers that event. -- client side --a) --remove ,,local,, before the button local closeButton = dgs:dgsCreateButton(325*px,530*py,150*px,40*py,"Close",false,passport_info,nil,nil,nil,nil,nil,nil,tocolor(255,0,0),tocolor(100,0,0),tocolor(255,0,0)) -- you should have this -- closeButton = dgs:dgsCreateButton(325*px,530*py,150*px,40*py,"Close",false,passport_info,nil,nil,nil,nil,nil,nil,tocolor(255,0,0),tocolor(100,0,0),tocolor(255,0,0)) -- b) addEventHandler("onDgsMouseClick",root,function(btn,state) if btn == "left" and state == "down" then if source == closeButton then showCursor(false) dgs:dgsSetVisible(passport_info,false) on = 0 end end end) -- server side -- if you changed the column names in your db you have to replace them in the query and insert statement -- old local query = dbQuery(connect,"SELECT * FROM Users WHERE firstname=? OR lastname=? OR accountName=?",tostring(firstname),tostring(lastname),acc_name) -- new local query = dbQuery(connect,"SELECT * FROM Users WHERE FirstName=? OR LastName=? OR accountName=?",tostring(firstname),tostring(lastname),acc_name) --- also this -- old dbExec(connect,"INSERT INTO Users (accountName,firstname,lastname,age,country) VALUES(?,?,?,?,?)",acc_name,firstname,lastname,age,country) -- new dbExec(connect,"INSERT INTO Users (accountName,FirstName,LastName,Age,Country) VALUES(?,?,?,?,?)",acc_name,firstname,lastname,age,country)
  17. Server side you have to add this - > local connect = dbConnect("sqlite","Passport.db") -- we create the db -- then we create a table dbExec(connect,"CREATE TABLE IF NOT EXISTS passport (id INTEGER PRIMARY KEY AUTOINCREMENT,accountName TEXT,firstname TEXT,lastname TEXT,age INTEGER,country TEXT)") -- we add the server side event addEvent("playerPassportEnter",true) addEventHandler("playerPassportEnter",getRootElement(),function(firstname,lastname,age,country) if client then -- check if data is from client you use always client when you bring data from clinet local acc_name = getAccountName(getPlayerAccount(client)) -- get the player account name local query = dbQuery(connect,"SELECT * FROM passport WHERE firstname=? OR lastname=? OR accountName=?",tostring(firstname),tostring(lastname),acc_name) local rezult = dbPoll(query,-1) -- we select the data and then get the rezult if #rezult > 0 then -- we check if the rezult table has some data with this player account outputChatBox("[PASSPORT] This firstname or lastname is used or you already created a passport!",client,104,255,104) else -- if we dont have any data with this player we add a passport! dbExec(connect,"INSERT INTO passport (accountName,firstname,lastname,age,country) VALUES(?,?,?,?,?)",acc_name,firstname,lastname,age,country) outputChatBox("[PASSPORT] New passport has been created successfully!",client,104,255,104) end end end) -- you put your x,y,z coordinates where your marker is or where you want to create the marker -- local viewPassport = createMarker(2865.15063,-1989.56226,11.10156-1.7,"cylinder",2.0,104,255,104,104) addEventHandler('onMarkerHit',getResourceRootElement(),function(hitElement,matchingDimension) if getElementType(hitElement) == 'player' then -- check if the element which hits the marker is a player if source == viewPassport then -- we check if we hit our marker and not another marker local acc_name = getAccountName(getPlayerAccount(hitElement)) local query = dbQuery(connect,"SELECT * FROM passport WHERE accountName=?",acc_name) -- we select the data from db local rezult = dbPoll(query,-1) if #rezult > 0 then -- if we have data we sent it to client triggerClientEvent("viewPassport",hitElement,rezult) else -- if we do not have data we write a message to player outputChatBox("[PASSPORT] You dont have a passport, to see a passport you need to create one first!",hitElement,104,255,104) end end end end) Client Side we have to add this -> local on = 0 addEvent("viewPassport",true) addEventHandler("viewPassport",getRootElement(),function(rezult) if on == 1 then return outputChatBox("[PASSPORT] Your passport window is open already!",104,250,104) end on = 1 window = guiCreateWindow((sw-400)/2,(sh-400)/2,300,200,"Passport Data") guiWindowSetMovable(window,false) guiWindowSetSizable(window,false) passport_info = guiCreateMemo(10,20,380,275,"FirstName: "..rezult[1]['firstname'].."\nLastName: "..rezult[1]['lastname'].."\nAge: "..rezult[1]['age'].."\nCountry: "..rezult[1]['country'].."",false,window) guiMemoSetReadOnly(passport_info,true) close_passport = guiCreateButton(10,170,380,125,"CLOSE",false,window) showCursor(true) addEventHandler("onClientGUIClick",close_passport,close_pass,false) end) close_pass = function(button,state) if (button == "left") and (state == "up") then showCursor(false) guiSetVisible(window,false) on = 0 end end Sure on client side you can create with dgs what i made like the window,button and the memo the way you want. I used the normal gui because i am used to it and i dont use any library. Also a link to sqlite browser to check if your table is created and data is inserted into the table. https://sqlitebrowser.org/dl/
  18. Well if you have a checkpoint marker and there is not a big building around you will see a big part of the marker but if you use any other marker your object alpha should be as low as possible to see the marker.
  19. From what i know a marker is always visible. A marker is not visible if u set the alpha to 0 or you make the marker visible to a certain element or you change the marker dimension.
  20. If i am correct you should stop the server and you should open acl.xml and there look for loadstring permission and change true with false for every class.
  21. Well you have to do it like this addCommandHandler('getdata',function(player,commandName) local playersData = {} local accounts = getAccounts() if player then for k,account in ipairs(accounts) do playersData[k] = getAccountData(account,"acc:nickname") end outputChatBox(tostring(inspect(playersData)),player) end end,false,false)
  22. As a person which uses the GUI windows everytime i need a menu or list and so on if you dont want to bother with design to much go for them but if you want fancy stuff like nice a custom hud or minimap or maybe a menu then goo for Dx functions. There are some libraries which make things fancy and you have built in functions for them and you dont need to make your own. DGS -> https://wiki.multitheftauto.com/wiki/Resource:DGS CustomWidgets -> https://wiki.multitheftauto.com/wiki/Resource:CustomWidgets Modern Dx Library -> https://wiki.multitheftauto.com/wiki/Modern-Library For button clicks on gui you have an Event so is easy to track them -> https://wiki.multitheftauto.com/wiki/OnClientGUIClick For dx you have an Event too https://wiki.multitheftauto.com/wiki/OnClientClick https://forum.multitheftauto.com/topic/100217-clickable-dx-rectangletext/
  23. What pc requirements will the server/game have?(to be played)
  24. even if they bypass the anti-cheat when it comes to wall hack somehow it wont be usefull at all because if they dont gain any benefit from that only in a dm zone or gamemode and thats all. When they dont have any weapon in hand the wall hack from my point of view wont bring any advantage.
  25. if i remember correctly the AC has built in things which can detect some wall hacks if not most of them. If you think someone has xray / wallhack use this for weapons https://wiki.multitheftauto.com/wiki/GetPedWeaponMuzzlePosition and add a 3d line to it to see where they aim.
×
×
  • Create New...