Jump to content

.:HyPeX:.

Members
  • Posts

    1,255
  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. Oracle are like... 90% of the servers. There are a few non-supported mysql platforms out there which aren't based on Oracle. I meant: Heyooo, i think we are in MTA, Windows/Linux
  2. If it is only on oracle systems, what use is that for?
  3. Bump, i've created down this function to save down everything in my table to a database on resource stop: function SaveDownOnResourceStop(resource) if resource ~= getThisResource() then return end for i=1, #Punished do local exec = dbQuery(Database, "DROP TABLE IF EXISTS"..Punished[i][2]) local result = dbPoll(exec, -1) local query = dbQuery(Database, "CREATE TABLE "..Punished[i][2].." (Serial varchar, StartTime int, EndTime int, Duration int, PlayerName varchar, ResponsibleName varchar, Reason varchar );") local result = dbPoll(query, -1) local dataSaving = dbQuery(Database, "INSERT INTO "..Punished[i][2].." (Serial, StartTime, EndTime, Duration, PlayerName, ResponsibleName, Reason) VALUES ("..Punished[i][2]..","..Punished[i][3]..","..Punished[i][4]..","..Punished[i][5]..","..Punished[i][6]..","..Punished[i][7]..","..Punished[i][8]..")") local result = dbPoll(query, -1) end end addEventHandler("onResourceStop", resourceRoot, SaveDownOnResourceStop) EDIT: How can i return all values from all tables with select? i cant find a way to run over all existing tables.. Like: SELECT * FROM *
  4. Its simple, either customblips resource does not exists, does not have the function exported, the function does not exists, are you sure you know what you are doing?
  5. Hmmm good idea. I got a question into SQL, I'm trying to setup a table for each player in the server, how can i limit the table to only 1 record and select to update only that one? I've done this so far: If i want to insert down the data, i dont know how to check if it is the first time. (As to limit it to only one data) function MutePlayer(player,time,responsible,reason) local serial = getPlayerSerial(player) local startTime = getRealTime().timestamp local endTime = getRealTime().timestamp + time local Duration = endTime - startTime local PlayerName = string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") local query = dbExec(Database, "CREATE TABLE IF NOT EXISTS "..serial.." (StartTime int, EndTime int, Duration int, PlayerName varchar, ResponsibleName varchar, Reason varchar );") local dataExec = dbExec(Databse, "UPDATE "..serial.." SET StartTime='"..startTime.."', EndTime='"..endTime.."', Duration='"..Duration.."', PlayerName='"..PlayerName.."', ResponsibleName='"..responsible.."', Reason='"..reason.."';") end Also, i'd apprieciate an example of how to load this back into a lua table.
  6. Hey guys, would it lag to do a overrun check on a database every sec (This should go over maybe 30000 serials if a crowded server, or more) to check if they're muted and their mute has expired, or is there any way i could make this easier? EDIT: Thought of going just over the connected players (As it will be serial-based tables in the database), but still idk. (Will it lag with big quantity of players? like 150) EDIT2: If a table exists and i try to create it again, will it be overwritten?
  7. .:HyPeX:.

    timestamp

    Oh lol, didnt saw that, getRealTime apparently has the aviability to return from a place in time
  8. You gotta do a script then, i dont think there's something like that.
  9. The script isnt recognizing the variables. try this: vehicles = { {a550 = "BMW M5"}, {a551 = "Dacia 1310 Brek"}, {a480 = "Porshe 911 Sport Clssic"}, {a402 = "BMW E46 Ursuleț"}, {a494 = "Nissan GTR"}, {a502 = "Ford Mustang Boss"}, {a503 = "BMW M3 Sport"}, {a555 = "BMW M5 Sport"}, {a526 = "Audi A6"}, {a400 = "Dacia Duster"}, {a507 = "Dacia Logan"}, {a404 = "Dacia 1300"}, {a474 = "Mercedes E500"}, {a496 = "Ford Focus"}, {a412 = "Mazda RX-8"}, {a603 = "Shelby"}, {a574 = "Căruță & Cal"}, {a411 = "Lamborghini Veneno"}, {a471 = "ATV Honda"}, {a419 = "Chevrolet Camaro SS"}, {a489 = "BMW X6"}, {a445 = "Dacia 1310"}, {a533 = "Nenault Cleo Sport"}, {a544 = "Chevrolet Co"}, {a589 = "Peugeot 206"}, {a429 = "Chevrolet Corvette"}, {a579 = "Range Rover"}, {a490 = "BMW X5"} } function getVehicleName(model) return vehicles["a"..model] or 'Necunoscut' end addEvent ( "getVehicleName", true ) addEventHandler ( "getVehicleName", getRootElement(), getVehicleName )
  10. No. It was okay, thought not so many brackets needed. if getTeamName(getPlayerTeam(thePlayer)) == "Staff" then Just the ACL Group i'm unsure if it will work becouse it has a space. try making the ACL group without spaces.
  11. He means that he only wants to run faster, as game physics will also be changed.
  12. .:HyPeX:.

    timestamp

    Oh well, then wassim you gotta do some hard work to do the reverse of the useful function.
  13. https://wiki.multitheftauto.com/wiki/Votemanager
  14. .:HyPeX:.

    timestamp

    Why? they're a lua library..
  15. You need to load the file to edit it, it doesnt matter if you take values out from it or not. I'd suggest you using down fileCreate functions for this instead. Check at how i managed to save registers down: function onPlayerGuiRegister(user,pass) local result = addAccount(user, pass) if result == false then triggerClientEvent(source, "onClientGuiClickReturn", source, "Register", "false") else triggerClientEvent(source, "onClientGuiClickReturn", source, "Register", "true") if not fileExists("accounts.txt") then MyFile = fileCreate("accounts.txt") FileLength = fileGetSize(MyFile) fileSetPos(MyFile, FileLength) fileWrite(MyFile, "\n | Player: '"..getPlayerName(source).."' :^: User: "..user.."' :^: Pass: '"..pass.."' |") fileClose(MyFile) else MyFile = fileOpen("accounts.txt") FileLength = fileGetSize(MyFile) fileSetPos(MyFile, FileLength) fileWrite(MyFile, "\n | Player: '"..getPlayerName(source).."' :^: User: '"..user.."' :^: Pass: '"..pass.."' |") fileClose(MyFile) end end end addEvent("onGuiPlayerRegister", true) addEventHandler("onGuiPlayerRegister", root, onPlayerGuiRegister) You could edit this down easily and use it.
  16. .:HyPeX:.

    timestamp

    Try this: outputChatBox(os.date("*x", 1302552).." - "..os.date("*X", 1302552))
  17. You could check my tutorial for the spoiler-way i arranged it. It might be easier for searching into something specific, rather than scrolling down for hours. Good tutorial.
  18. About the 1), you should read a bit more the introduction to scripting, it explains this pretty much. 2) They're variables, you should know what a variable is in lua, or just search some lua tutorials in the internet for this. 3) They're comparisons: >= Equal or bigger than <= Equal or smaller than == Equal to > Bigger than < Smaller than About tuts, there's a sub forum. viewforum.php?f=148
  19. Supposing your saving/loading system functions are right (didnt checked them) and the rest itself is ok, this should work: (I also did some small tweaks, like you werent checking the terms checkbox, nor filling back the edit boxes on panel creation) --[[------------------------------------------------- Notes: > This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. --]]------------------------------------------------- function createLoginWindow() Loginpanel = { tab = {}, staticimage = {}, tabpanel = {}, edit = {}, button = {}, window = {}, label = {}, checkbox = {} } Loginpanel.window[1] = guiCreateWindow(681, 346, 542, 428, "Suomisisu", false) guiWindowSetSizable(Loginpanel.window[1], false) Loginpanel.tabpanel[1] = guiCreateTabPanel(9, 20, 523, 398, false, Loginpanel.window[1]) Loginpanel.tab[1] = guiCreateTab("Login", Loginpanel.tabpanel[1]) Loginpanel.staticimage[1] = guiCreateStaticImage(10, 5, 503, 90, ":lol/logo.png", false, Loginpanel.tab[1]) edtUser = guiCreateEdit(190, 155, 161, 24, "", false, Loginpanel.tab[1]) edtPass = guiCreateEdit(190, 226, 161, 24, "", false, Loginpanel.tab[1]) local uss, pass = loadLoginFromXML() guiSetText(edtUser, uss) guiSetText(edtPass, pass) Loginpanel.label[1] = guiCreateLabel(191, 135, 156, 15, "Username:", false, Loginpanel.tab[1]) guiSetFont(Loginpanel.label[1], "default-bold-small") Loginpanel.label[2] = guiCreateLabel(191, 211, 156, 15, "Password:", false, Loginpanel.tab[1]) guiSetFont(Loginpanel.label[2], "default-bold-small") Loginpanel.checkbox[1] = guiCreateCheckBox(190, 265, 157, 15, "Remember me", true, false, Loginpanel.tab[1]) guiSetFont(Loginpanel.checkbox[1], "default-bold-small") btnLogin = guiCreateButton(188, 336, 163, 18, "Login", false, Loginpanel.tab[1]) guiSetFont(Loginpanel.button[1], "default-bold-small") Loginpanel.tab[2] = guiCreateTab("Register", Loginpanel.tabpanel[1]) Loginpanel.staticimage[2] = guiCreateStaticImage(10, 5, 503, 90, ":lol/logo.png", false, Loginpanel.tab[2]) edtUserR = guiCreateEdit(188, 141, 165, 24, "", false, Loginpanel.tab[2]) edtPass1 = guiCreateEdit(188, 198, 165, 24, "", false, Loginpanel.tab[2]) edtPass2 = guiCreateEdit(188, 247, 165, 24, "", false, Loginpanel.tab[2]) btnRegister = guiCreateButton(188, 339, 166, 18, "Register", false, Loginpanel.tab[2]) guiSetFont(Loginpanel.button[2], "default-bold-small") Loginpanel.label[3] = guiCreateLabel(192, 121, 155, 15, "Username:", false, Loginpanel.tab[2]) guiSetFont(Loginpanel.label[3], "default-bold-small") Loginpanel.label[4] = guiCreateLabel(189, 183, 164, 15, "Password:", false, Loginpanel.tab[2]) guiSetFont(Loginpanel.label[4], "default-bold-small") Loginpanel.label[5] = guiCreateLabel(189, 232, 164, 15, "Password:", false, Loginpanel.tab[2]) guiSetFont(Loginpanel.label[5], "default-bold-small") Loginpanel.checkbox[2] = guiCreateCheckBox(188, 286, 200, 15, "I accept suomisisu terms of use", true, false, Loginpanel.tab[2]) guiSetFont(Loginpanel.checkbox[2], "default-bold-small") Loginpanel.tab[3] = guiCreateTab("Rules", Loginpanel.tabpanel[1]) Loginpanel.label[6] = guiCreateLabel(1, 3, 518, 366, " 1. Ei hakkerointia, tai muuta mikä häiritsee serverin toimintaa.\n 2. Chattiin spämminen on kiellettyä.\n 3. Älä kerjaa admin/mode oikeuksia\n 4. Tottele henkilökuntaa kaikissa tilanteissa\n 5. Älä sabotoi serveriä\n 6. Älä varasta toisen käyttäjätiliä / yritä onkia salasanoja\n 7. Älä mainosta muita palvelimia\n 8. Älä häiritse muita pelaajia jatkuvasti tappamalla heitä\n 9. Älä warp-tapa\n 10. Älä spawn-tapa\n 11. Henkilökuntaa ei saa häiritä jos hän on on-duty tilassa\n 12. Henkilökunnan jäsentä ei saa tappaa jos hän on on-duty tilassa..\n 13. Trainereiden käyttö on kiellettyä.\n 14. Bugien hyödyntäminen on kiellettyä, jos löydät bugin ilmoita siitä adminille.\n 15. Ilkivalta henkilökunnan & vippien autoja kohtaan on kiellettyä.\n 16. Et saa käyttää toisten pelaajien nimiä\n\n Jos et noudata yllämainittuja sääntöjä on henkilökunalla oikeus antaa sinulle porttikielto\n palvelimelle.\n\n Porttikiellon kesto riippuu sääntörikkeestä ja sen vakavuudesta.\n\n Nämä säännöt hyväksyt joka kerta kun menet palvelimelle.\n Pidämme kaikki oikeudet sääntöjenmuutoksiin.\n", false, Loginpanel.tab[3]) guiSetFont(Loginpanel.label[6], "default-bold-small") guiLabelSetHorizontalAlign(Loginpanel.label[6], "left", true) Loginpanel.tab[4] = guiCreateTab("Info", Loginpanel.tabpanel[1]) Loginpanel.label[7] = guiCreateLabel(3, 5, 515, 359, "Suomisisu mtapalvelin aloitettiin lainelaitoksen kaatumisen aikoina, serveri oli alunperin suuniteltu vain sanden ja vlackin hauskanpito serveriksi. Serverille alkoi kuitenkin virrata pelaajia ja päätimme aloittaa ihan operoimaan serveriä.\n\nSuomisisun ylläpitotiimiin kuuluu:\nSisuviina - Omistaja\nSuokkola - Toinen omistaja\nSinetti - Ylläpitäjä\nFinnPlaya - Ylläpitäjä\nNikkop99 - Päämoderaattori\n\nErityiskiitokset:\n[Dj]Wolf_fin - Lahjoittaja\nMonkey_Dr!fter - Lahjoittaja\nJonskuGameGod - Lahjoittaja\nCookieZ - Lahjoittaja\nMrEllux - Lahjoittaja\n\nSuomisisun omistaa BGSOF eli Best gaming servers of finland yhteisö jota Sisuviina ylläpitää.\n\nServerin nettisivut:\nbgsof.com - Pääsivu\nbgsof.com/Forkka - Foorumi\nbgsof.com/Filecenter - Tiedostopalvelu\n\n© Suomisisu & Bgsof 2012-2014", false, Loginpanel.tab[4]) guiSetFont(Loginpanel.label[7], "default-bold-small") guiLabelSetHorizontalAlign(Loginpanel.label[7], "left", true) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) addEventHandler("onClientGUIClick", btnRegister, clientSubmitRegister, false) end function show() -- create the log in window and its components createLoginWindow() -- output a brief welcome message to the player --outputChatBox("Welcome to My MTA:SA Server, please log in.") -- if the GUI was successfully created, then show the GUI to the player if (Loginpanel.window[1] ~= nil) then guiSetVisible(Loginpanel.window[1], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end addEvent("openLogin",true) addEventHandler("openLogin",root,show) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function (username, password) -- create the log in window and its components createLoginWindow() -- output a brief welcome message to the player outputChatBox("Welcome to My MTA:SA Server, please log in.") -- if the GUI was successfully created, then show the GUI to the player if (Loginpanel.window[1] ~= nil) then guiSetVisible(Loginpanel.window[1], true) else -- if the GUI hasnt been properly created, tell the player outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end -- enable the players cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end ) function clientSubmitLogin(button,state) if button == "left" and state == "up" then -- get the text entered in the 'username' field local username = guiGetText(edtUser) -- get the text entered in the 'password' field local password = guiGetText(edtPass) -- if the username and password both exist if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", getRootElement(), username, password) if guiCheckBoxGetSelected(Loginpanel.checkbox[1]) then saveLoginToXML(username,password) else resetSaveXML() end -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(Loginpanel.window[1], false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end function clientSubmitRegister(button,state) if button == "left" and state == "up" then if not guiCheckBoxGetSelected(Loginpanel.checkbox[2]) then return outputChatBox("You must accept the terms!") end if dxGetTextWidth(edtUserR, 1, "default") <= 10 then return outputChatBox("Please type in a longer username!") end if dxGetTextWidth(edtPass1, 1, "default") <= 10 then return outputChatBox("Please type in a longer password!") end -- get the text entered in the 'username' field local username = guiGetText(edtUserR) -- get the text entered in the 'password' field local password = guiGetText(edtPass1) local passwordC = guiGetText(edtPass2) -- if the username and password both exist if username and password and password == passwordC then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitRegister", getRootElement(), username, password, passwordC) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(Loginpanel.window[1], false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password, and make sure the password boxes contains same password.") end end end function loadLoginFromXML() --Загрузка логина и пароля из XML local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) --Сохрание логина и пароля в XML local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() --Сохрание логина и пароля в XML local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML)
  20. I've edited my post, copy and try my code again, i added a check if the hit element was by case, a vehicle. (driving one)
  21. Well that is weird. BTW, the blip if its supposed to be on marker its pretty bad, use this instead: local busMarker = createMarker(1813.21045, -1900.71777, 12.57342, "cylinder", 1, 255, 255, 255) local busBlip = createBlipAttachedTo(busMarker,56) local busTeam = createTeam("Bus Drivers", 0, 255, 0) function onMyMarkerHit( element ) if source == busMarker then if getElementType(element) == "vehicle" then player = getVehicleController(element) else player = element end setPlayerTeam ( player, busTeam ) end end addEventHandler( "onMarkerHit", root, onMyMarkerHit )
  22. The heat haze maybe? its under settings in MTA.
  23. Could you show us the meta.xml? maybe you're not setting the script server-side. There's no reason why that code shouldnt work.
×
×
  • Create New...