-
Posts
130 -
Joined
-
Last visited
Everything posted by 2013martin1212
-
Scripter/Mapert/Modelezöt keresek
2013martin1212 replied to 2013martin1212's topic in Hungarian / Magyar
remek scriptekhez ertesz vagy a maperkodashoz ? -
Hello all , I now turn to that way to start to learn lua and now i start my first login panel , but i stok please help me figure out what i make wrong This is my server file function loginHandler(username,password) -- check that the username and password are correct if username == "user" and password == "apple" then -- the player has successfully logged in, so spawn them if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server.", client) end else -- if the username or password are not correct, output a message to the player outputChatBox("Invalid username and password. Please re-connect and try again.",client) end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler) and this is my client file function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) -- define new X and Y positions for the first label X = 0.0825 Y = 0.2 -- define new Width and Height values for the first label Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window) guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) -- alter the Y value, so the second label is slightly below the first Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) -- set the maximum character length for the username and password fields to 50 guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) -- make the window invisible guiSetVisible(wdwLogin, false) end addEventHandler("onClientGUIClick", btnLogin, createLoginWindow, false) addEventHandler("onClientResourceStart", getResourceRootElement(), function () -- 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 (wdwLogin ~= nil) then guiSetVisible(wdwLogin, 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) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, 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
-
there is my sourceS function devmode () setDevelopmentMode (false) end addCommandHandler("devmode", devmode) and there is my meta but it doesnt work for me because it says it
-
I cant figure out to how to turn off the development mode on my server , because if any one type in to the chat /showcol and show me the red colision to the player and the cars etc.
-
function disableVehicleCollisionsNearPlayer(thePlayer, maxDistance) local playerX, playerY, playerZ = getElementPosition(thePlayer) local vehicles = getElementsByType("vehicle") for k,v in ipairs(vehicles) do local vehicleX, vehicleY, vehicleZ = getElementPosition(v) -- get the distance between the player and the vehicle: local distance = getDistanceBetweenPoints3D(vehicleX, vehicleY, vehicleZ, playerX, playerY, playerZ) if (distance <= maxDistance) then -- disable collisions for the vehicle setElementCollisionsEnabled(v, false) end end end And how to make this for a player spawn protect version ?
-
Hello all i have a question if its posible to make a non colision zone on the map to the player can be spawn there or afk etc ?
-
local x,y = guiGetScreenSize() -- Get players resolution and this way u can use it with the function dxDrawRectangle ( x/3.8, y/3.8, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) -- Create our black transparent MOTD background Rectangle.
-
i figure out addEventHandler('onClientResourceStart', resourceRoot, function() shader = dxCreateShader('shader.fx') terrain = dxCreateTexture('img/PJ_Flash1.bmp') dxSetShaderValue(shader, 'gTexture', terrain) engineApplyShaderToWorldTexture(shader, 'flash1body256') end ) i this is the right way
-
i am not the best in lua but i think the script is beter in this way [lua]function toggle_police_chief(admin, cmd, account_to_add_or_remove) local accName = getAccountName(getPlayerAccount(admin)) if not isObjectInACLGroup ("user."..accName, aclGetGroup ("Admin")) elseif not isObjectInACLGroup ("user."..accName, aclGetGroup ("Moderator")) then return end
-
Sziasztok! Sokmindent nemfogok leírni,csak azt hogy scriptert keresünk egy tervben készülő MTA szerverhez. Elvárások: - Adatbázis ismeretek (MySQL) - LUA Programnyelv ismerete - Terhelhetőség - Teamspeak 3 - Akivitás - Kreativitás Mit nyújtunk? -Fiatalos munkakörnyezet -Fejlődési lehetőség -Fizetés a project elkészítése végén mindenkinek a megbeszéltek szerint. -Együtmüködés a további dolgaidban! Egyedül lennék fejlesztő? - Nem! - Csapatban fogsz dolgozni! Jelentkezni nálam! P.üzenetben vagy a csapat facebook oldalán : https://www.facebook.com/pages/Core-Game-System/829289257160363 Nem csak fejlesztőt keresünk hanem mappereket, modellezőket és webmestert is!
-
but how ?
-
Hello all i have a very different questions its possible to make some way like in some cars that hase paint job and create more types or change the old style and make the other cars as well which cars doesnt have at all ?
-
This script is works when i have a character in my sql table but if i dont then i want to log in doesnt bring me to the character picker resource and i cant find the wrong place why and doesnt give me anything in the debugscript There is my login sourceS local mysql = exports.cG_MySQL function logThePlayer(thePlayer, userName, passWord) if thePlayer and userName and passWord then if getElementType(thePlayer) == "player" then local account = mysql:db_Query("SELECT * FROM accounts WHERE userName='" .. userName .. "'") for i, sor in ipairs(account) do if sor["passWord"] == passWord then local lastLogin = getRealTime() if tostring(lastLogin.month+1):len() < 2 then lastLogin.month = "0" .. tostring(lastLogin.month)+1 end if tostring(lastLogin.monthday):len() < 2 then lastLogin.monthday = "0" .. tostring(lastLogin.monthday) end local lastLoginText = tostring(lastLogin.year+1900 .. "-" .. lastLogin.month .. "-" .. lastLogin.monthday) mysql:db_Exec("UPDATE accounts SET pLastLogin='" .. lastLoginText .. "' WHERE userName='" .. userName .. "'") mysql:db_Exec("UPDATE accounts SET pIP='" .. getPlayerIP(thePlayer) .. "' WHERE userName='" .. userName .. "'") mysql:db_Exec("UPDATE accounts SET pSerial='" .. getPlayerSerial(thePlayer) .. "' WHERE userName='" .. userName .. "'") local character = mysql:db_Query("SELECT * FROM characters WHERE accountName ='" .. userName .. "'") setElementData(thePlayer, "acc:adminLevel", sor["adminLevel"]) --outputChatBox("a") if character then outputChatBox("a") for i, sor in ipairs(character) do setElementData(thePlayer, "acc:userName", userName) setPlayerMoney(thePlayer, sor["pMoney"]) spawnPlayer(thePlayer, sor["pX"], sor["pY"], sor["pZ"], sor["pRot"], sor["pSkin"], sor["pInt"], sor["pDim"]) setElementData(thePlayer, "acc:legalChange", true) setPlayerName(thePlayer, sor["characterName"]) setCameraTarget(thePlayer, thePlayer) --setElementData(thePlayer "acc:legalChange", false) triggerClientEvent(thePlayer, "hideLGP", getRootElement()) local itemTable = sor["pItems"]:gsub(",", "") outputChatBox(itemTable:gsub(itemTable:sub(-1), "")) for i, k in ipairs(itemTable) do setElementData(thePlayer, "acc:pItems" .. i, k) outputChatBox(i .. " slot iteme: " .. k) end end else triggerClientEvent(thePlayer, "addChar", getRootElement()) triggerClientEvent(thePlayer, "hideLGP", getRootElement()) end end end end end end addEvent("logIn", true) addEventHandler("logIn", getRootElement(), logThePlayer) And there is my character picker local sX, sY = guiGetScreenSize() local gW, gH = 300, 425 local eW, eH = 250, 25 local malevSkins = {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} local femalevSkins = {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 cSkin = 1 local font = guiCreateFont("nyil.ttf", 20) local gP = guiCreateWindow(10, (sY-gH)/2, gW, gH, "Karakter létrehozás", false) local aB = guiCreateButton(gW/2-150/2, gH-30, 150, 25, "Létrehozás", false, gP) local fL = guiCreateLabel(gW/2-dxGetTextWidth("Karakter neve:")/2, 25, eW, eH, "Karakter neve:", false, gP) local fE = guiCreateEdit((gW-eW)/2, 50, eW, eH, "Krobi", false, gP) local nL = guiCreateLabel(gW/2-dxGetTextWidth("Neme:")/2, 80, eW, eH, "Neme:", false, gP) local fR = guiCreateRadioButton(gW/2-20, 95, 50, 15, "Férfi", false, gP) local nR = guiCreateRadioButton(gW/2-20, 110, 50, 15, "Nő", false, gP) local kL = guiCreateLabel(gW/2-dxGetTextWidth("Kezdőpont:")/2, 135, eW, eH, "Kezdőpont:", false, gP) local lsS = guiCreateCheckBox(75, 155, 50, 15, "LS", true, false, gP) local lvS = guiCreateCheckBox(135, 155, 50, 15, "LV", false, false, gP) local sfS = guiCreateCheckBox(195, 155, 50, 15, "SF", false, false, gP) local sL = guiCreateLabel(gW/2-dxGetTextWidth("Kinézet:")/2, 185, eW, eH, "Kinézet:", false, gP) local bG = guiCreateLabel(100, 200, 20, 35, "<", false, gP) local jG = guiCreateLabel(185, 200, 20, 35, ">", false, gP) local pPed = createPed(0, 2186.09937, -1156.86914, 1029.79688, -90) guiSetVisible(gP, false) setElementInterior(pPed, 15) guiRadioButtonSetSelected(fR, true) guiSetFont(bG, font) guiSetFont(jG, font) guiWindowSetMovable(gP, false) guiWindowSetSizable(gP, false) function showCharacterCreate() showCursor(true) setCameraMatrix(2190.66138, -1156.88782, 1029.79688,2186.09937, -1156.86914, 1029.79688) guiSetVisible(gP, true) setElementInterior(localPlayer, 15) end addEvent("addChar", true) addEventHandler("addChar", getRootElement(), showCharacterCreate) function clickOnThings() if source == lsS then guiCheckBoxSetSelected(lsS, true) guiCheckBoxSetSelected(lvS, false) guiCheckBoxSetSelected(sfS, false) elseif source == lvS then guiCheckBoxSetSelected(lvS, true) guiCheckBoxSetSelected(lsS, false) guiCheckBoxSetSelected(sfS, false) elseif source == sfS then guiCheckBoxSetSelected(sfS, true) guiCheckBoxSetSelected(lsS, false) guiCheckBoxSetSelected(lvS, false) elseif source == fR or source == nR then cSkin = 1 if source == fR then setElementModel(pPed, malevSkins[cSkin]) else setElementModel(pPed, femalevSkins[cSkin]) end elseif source == bG then if guiRadioButtonGetSelected(fR) then if cSkin > 1 then cSkin = cSkin - 1 setElementModel(pPed, malevSkins[cSkin]) end elseif guiRadioButtonGetSelected(nR) then if cSkin > 1 then cSkin = cSkin - 1 setElementModel(pPed, femalevSkins[cSkin]) end end elseif source == jG then if guiRadioButtonGetSelected(fR) then if cSkin < #malevSkins then cSkin = cSkin + 1 setElementModel(pPed, malevSkins[cSkin]) end elseif guiRadioButtonGetSelected(nR) then if cSkin < #femalevSkins then cSkin = cSkin + 1 setElementModel(pPed, femalevSkins[cSkin]) end end elseif source == aB then if guiGetText(fE) ~= "" then triggerServerEvent("addChar", getRootElement(), localPlayer, guiGetText(fE),setElementModel(pPed), guiRadioButtonGetSelected(fR), guiCheckBoxGetSelected(lsS), guiCheckBoxGetSelected(lvS), guiCheckBoxGetSelected(sfS)) else end end end addEventHandler("onClientGUIClick", getRootElement(), clickOnThings)
-
Please some one help me to create a server like this :https://www.youtube.com/watch?v=5-wCpnlLitA
-
[HELP]I start to make an inventory system on my own :D
2013martin1212 replied to 2013martin1212's topic in Scripting
Gr0x are you should no about the devgaming or other words valhalla rp gamemode i want to make an inventory like that -
I start to make an inventory on my own with the wiki , but i figure out its not that easy like i think on the start It looks like now : http://kepfeltoltes.hu/150618/mta-screen_2015-06-17_07-38-49_www.kepfeltoltes.hu_.png I have some resource done ,but i dont how to do it now please some one help me sourceC: local sX, sY = guiGetScreenSize() local iX, iY = sX/2, sY/2 local gW, gH = 536, 291 local alap = guiCreateStaticImage(sX-gW-10, iY-gH/2, gW, gH, "inventory.png", false) function renderItems() local pItem1, pItem2, pItem3, pItem4, pItem5, pItem6, pItem7, pItem8, pItem9, pItem10, pItem11, pItem12, pItem13, pItem14, pItem15, pItem16, pItem17, pItem18, pItem19, pItem20, pItem21, pItem22, pItem23, pItem24, pItem25, pItem26, pItem27, pItem28, pItem29, pItem30, pItem31, pItem32, pItem33, pItem34, pItem35, pItem36, pItem37, pItem38, pItem39, pItem40, pItem41, pItem42, pItem43, pItem44, pItem45, pItem46, pItem47, pItem48, pItem49, pItem50 = getElementData(localPlayer, "acc:pItem1") or 0, getElementData(localPlayer, "acc:pItem2") or 0, getElementData(localPlayer, "acc:pItem3") or 0, getElementData(localPlayer, "acc:pItem4") or 0, getElementData(localPlayer, "acc:pItem5") or 0, getElementData(localPlayer, "acc:pItem6") or 0, getElementData(localPlayer, "acc:pItem7") or 0, getElementData(localPlayer, "acc:pItem8") or 0, getElementData(localPlayer, "acc:pItem9") or 0, getElementData(localPlayer, "acc:pItem10") or 0, getElementData(localPlayer, "acc:pItem11") or 0, getElementData(localPlayer, "acc:pItem12") or 0, getElementData(localPlayer, "acc:pItem13") or 0, getElementData(localPlayer, "acc:pItem14") or 0, getElementData(localPlayer, "acc:pItem15") or 0, getElementData(localPlayer, "acc:pItem16") or 0, getElementData(localPlayer, "acc:pItem17") or 0, getElementData(localPlayer, "acc:pItem18") or 0, getElementData(localPlayer, "acc:pItem19") or 0, getElementData(localPlayer, "acc:pItem20") or 0, getElementData(localPlayer, "acc:pItem21") or 0, getElementData(localPlayer, "acc:pItem22") or 0, getElementData(localPlayer, "acc:pItem23") or 0, getElementData(localPlayer, "acc:pItem24") or 0, getElementData(localPlayer, "acc:pItem25") or 0, getElementData(localPlayer, "acc:pItem26") or 0, getElementData(localPlayer, "acc:pItem27") or 0, getElementData(localPlayer, "acc:pItem28") or 0, getElementData(localPlayer, "acc:pItem29") or 0, getElementData(localPlayer, "acc:pItem30") or 0, getElementData(localPlayer, "acc:pItem31") or 0, getElementData(localPlayer, "acc:pItem32") or 0, getElementData(localPlayer, "acc:pItem33") or 0, getElementData(localPlayer, "acc:pItem34") or 0, getElementData(localPlayer, "acc:pItem35") or 0, getElementData(localPlayer, "acc:pItem36") or 0, getElementData(localPlayer, "acc:pItem37") or 0, getElementData(localPlayer, "acc:pItem38") or 0, getElementData(localPlayer, "acc:pItem39") or 0, getElementData(localPlayer, "acc:pItem40") or 0, getElementData(localPlayer, "acc:pItem41") or 0, getElementData(localPlayer, "acc:pItem42") or 0, getElementData(localPlayer, "acc:pItem43") or 0, getElementData(localPlayer, "acc:pItem44") or 0, getElementData(localPlayer, "acc:pItem45") or 0, getElementData(localPlayer, "acc:pItem46") or 0, getElementData(localPlayer, "acc:pItem47") or 0, getElementData(localPlayer, "acc:pItem48") or 0, getElementData(localPlayer, "acc:pItem49") or 0, getElementData(localPlayer, "acc:pItem50") or 0 --[[local itemRender1 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem1 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender2 = dxDrawImage(sX-441, iY-118, 42, 42, 'pictures/' ..pItem2 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender3 = dxDrawImage(sX-395, iY-118, 42, 42, 'pictures/' ..pItem3 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender4 = dxDrawImage(sX-349, iY-118, 42, 42, 'pictures/' ..pItem4 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender5 = dxDrawImage(sX-303, iY-118, 42, 42, 'pictures/' ..pItem5 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender6 = dxDrawImage(sX-257, iY-118, 42, 42, 'pictures/' ..pItem6 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender7 = dxDrawImage(sX-211, iY-118, 42, 42, 'pictures/' ..pItem7 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender8 = dxDrawImage(sX-165, iY-118, 42, 42, 'pictures/' ..pItem8 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender9 = dxDrawImage(sX-119, iY-118, 42, 42, 'pictures/' ..pItem9 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender10 = dxDrawImage(sX-73, iY-118, 42, 42, 'pictures/' ..pItem10 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender11 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem11 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender12 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem12 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender13 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem13 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender14 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem14 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender15 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem15 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender16 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem16 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender17 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem17 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender18 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem18 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender19 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem19 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender20 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem20 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender21 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem21 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender22 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem22 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender23 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem23 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender24 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem24 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender25 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem25 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender26 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem26 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender27 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem27 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender28 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem28 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender29 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem29 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender30 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem30 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender31 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem31 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender32 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem32 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender33 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem33 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender34 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem34 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender35 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem35 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender36 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem36 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender37 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem37 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender38 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem38 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender39 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem39 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender40 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem40 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender41 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem41 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender42 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem42 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender43 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem43 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender44 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem44 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender45 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem45 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender46 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem46 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender47 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem47 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender48 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem48 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender49 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem49 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true) local itemRender50 = dxDrawImage(sX-488, iY-118, 42, 42, 'pictures/' ..pItem50 .. '.png', 0, 0, 0, tocolor(255, 255, 255), true)]] end addEventHandler("onClientRender", getRootElement(), renderItems) and my sourceS local file = fileCreate("anyad.lua") for i = 1, 50 do fileWrite(file, "local itemRender" .. i .." = dxDrawImage(sX-488, iY-118, 43, 43, 'pictures/' ..pItem" .. i .." .. '.png', 0, 0, 0, tocolor(255, 255, 255), true)\n") end And now i get lost please some one help me how to make functions for the image etc. I dont say that to some one make it for me because i want to learn it
-
Thanks iAxel its works fine now
-
Hello all i have a login system and i want to save all my data in a mysql form mysql sourceS: local addressS = "127.0.0.1" local userName = "SH24161_default" local passWord = "eRi1UuWbkbMW9z" local dbName = "SH24161_default" local port = 3306 local connection = dbConnect("mysql", "dbname=" .. dbName .. ";host=" .. addressS, userName, passWord ) if not connection then outputDebugString("Nem sikerült a MySQL csatlakozás.", 3, 255, 0, 0) else outputDebugString("Sikerült a MySQL csatlakozás.", 3, 255, 0, 0) end My login sourceS data: local mysql = exports.cG_MySQL function logThePlayer(thePlayer, userName, passWord) if thePlayer and userName and passWord then if getElementType(thePlayer) == "player" then local account = mysql:db_Query("SELECT * FROM accounts WHERE userName='" .. userName .. "'") for i, sor in ipairs(account) do if sor["passWord"] == passWord then local lastLogin = getRealTime() if tostring(lastLogin.month+1):len() < 2 then lastLogin.month = "0" .. tostring(lastLogin.month)+1 end if tostring(lastLogin.monthday):len() < 2 then lastLogin.monthday = "0" .. tostring(lastLogin.monthday) end local lastLoginText = tostring(lastLogin.year+1900 .. "-" .. lastLogin.month .. "-" .. lastLogin.monthday) mysql:db_Exec("UPDATE accounts SET pLastLogin='" .. lastLoginText .. "' WHERE userName='" .. userName .. "'") mysql:db_Exec("UPDATE accounts SET pIP='" .. getPlayerIP(thePlayer) .. "' WHERE userName='" .. userName .. "'") mysql:db_Exec("UPDATE accounts SET pSerial='" .. getPlayerSerial(thePlayer) .. "' WHERE userName='" .. userName .. "'") local character = mysql:db_Query("SELECT * FROM characters WHERE accountName ='" .. userName .. "'") setElementData(thePlayer, "acc:adminLevel", sor["adminLevel"]) outputChatBox("a") if character then outputChatBox("a") for i, sor in ipairs(character) do setElementData(thePlayer, "acc:userName", userName) setPlayerMoney(thePlayer, sor["pMoney"]) spawnPlayer(thePlayer, sor["pX"], sor["pY"], sor["pZ"], sor["pRot"], sor["pSkin"], sor["pInt"], sor["pDim"]) setElementData(thePlayer, "acc:legalChange", true) setPlayerName(thePlayer, sor["characterName"]) setCameraTarget(thePlayer, thePlayer) --setElementData(thePlayer "acc:legalChange", false) triggerClientEvent(thePlayer, "hideLGP", getRootElement()) local itemTable = sor["pItems"]:gsub(",", "") outputChatBox(itemTable:gsub(itemTable:sub(-1), "")) for i, k in ipairs(itemTable) do setElementData(thePlayer, "acc:pItem" .. i, k) outputChatBox(i .. " slot iteme: " .. k) end end else triggerClientEvent(thePlayer, "createChar", getRootElement()) triggerClientEvent(thePlayer, "hideLGP", getRootElement()) end end end end end end addEvent("logIn", true) addEventHandler("logIn", getRootElement(), logThePlayer) What else i need to ad to save my data and read the data and log in to the server please help i am new in the mysql and i want to learn but the wiki is doesnt help me to many
-
the database connection type is mysql but the original connection in the DayZ gamemode is sql and i want that to move to mysql but i cant the mysql , sql is not my best scripting language i can be work with html php css java , some lua but not mysq :*(
-
Hello all i want to change the original script which i get copyright to use it to the "you were paid " message hase shown in the chatbox and not in the 3d text in the top pls help me thanks addEventHandler ( "onClientMarkerHit", flightPath.elements.FlightMarkerExtra, function ( p ) if ( p == localPlayer and isPedInVehicle ( p ) ) then local c = getPedOccupiedVehicle ( p ) if ( getVehicleType ( c ) ~= "Plane" ) then return end if ( getElementData ( c, "NGAntiRestart:VehicleJobRestriction" ) == nil ) then return end if ( getVehicleController ( c ) ~= p ) then return end if ( pilot.VehicleSpeed ( c ) > 10 ) then outputChatBox("Enter the marker at a slower pace.",255,0,0) end pilot.destroyFlightPath ( ) local m = 4500 triggerServerEvent ( "NGJobs->GivePlayerMoney", localPlayer, localPlayer, m, "You were paid $"..tostring(m).." for completing the flight path!" ) triggerServerEvent ( "NGJobs->SQL->UpdateColumn", localPlayer, localPlayer, "completeflights", "AddOne" ) end end ) end end
-
i have this code from some scripter he was let me to use it -------------------------------------------- if ( tostring ( get ( "CONNECTION_TYPE" ) ):lower() == "mysql" ) then outputConsole ( "Attempting to connect as MySQL... Please wait") db = dbConnect( "mysql", "dbname="..tostring(get("DATABASE_NAME"))..";host="..tostring(get("MYSQL_HOST"))..";port="..tostring(get("MYSQL_PORT"))..";unix_socket=/opt/lampp/var/mysql/mysql.sock", tostring(get("MYSQL_USER")), tostring(get("MYSQL_PASS")), "share=1;autoreconnect=1" ); elseif ( tostring ( get ( "CONNECTION_TYPE" ) ):lower() == "sqlite" ) then db = dbConnect ( "sqlite", tostring(get("DATABASE_NAME")) .. ".sql" ); else error ( tostring(get("CONNECTION_TYPE")) .. " is an invalid SQL connection -- valid: mysql, sqlite" ); end if not db then print ( "The database has failed to connect") return else print ( "Database has been connected") end function db_query ( ... ) local data = { ... } return dbPoll ( dbQuery ( db, ... ), - 1 ) end function db_exec ( ... ) return dbExec ( db, ... ); end --[[ Columns: id INT, name TEXT, password TEXT, ip TEXT, serial TEXT, ]] db_exec ( [[CREATE TABLE IF NOT EXISTS accounts ( id INT, name TEXT, password TEXT, ip TEXT,serial TEXT)]] ); local weapStats_ = { ['9mm'] = 0, ['silenced'] = 0, ['deagle'] = 0, ['shotgun'] = 0, ['combat_shotgun'] = 0, ['micro_smg'] = 0, ['mp5'] = 0, ['ak47'] = 0, ['m4'] = 0, ['tec-9'] = 0, ['sniper_rifle'] = 0 } function createAccount ( account ) if ( account and type ( account ) == 'string' ) then local plr = getPlayerFromAccount ( account ) local autoIP = "unknown" local autoSerial = "unknown" local weapStats = toJSON ( weapStats_ ) if plr and isElement ( plr ) then autoSerial = getPlayerSerial ( plr ) autoIP = getPlayerIP ( plr ) outputDebugString ( "NGSQL: Creating account "..account.." for player "..getPlayerName ( plr ).." (Serial: "..autoSerial.." || IP: "..autoIP..")" ) else outputDebugString ( "NGSQL: Creating account "..account.." for player N/A (Serial: None || IP: None)" ); end local today = exports['NGPlayerFunctions']:getToday ( ) return db_exec ( [[iNSERT INTO `accounts` (`id`, `name`, `password`, `ip`, `serial` ) VALUES ( ?, ?, ?, ?, ? );]], account, '0', '0', '100', '0', '0', '0', '0', '0', '0', 'UnEmployed', 'UnEmployed', '0', '0', '0', '[ [ ] ]', 'None', 'None', 'None', today, autoSerial, autoIP, '0', '0', weapStats, toJSON ( { } ), '28', 'None', nil, toJSON ( { } ) ) end return false end function getPlayerFromAccount ( accnt ) if accnt and type ( accnt ) == 'string' then for i, v in ipairs ( getElementsByType ( 'player' ) ) do if ( getAccountName ( getPlayerAccount ( v ) ) == accnt ) then return v; end end end return false end function savePlayerData ( p, loadMsg, deleteTime ) if ( p and getElementType ( p ) == 'player' ) then if ( not isGuestAccount ( getPlayerAccount ( p ) ) ) then if ( loadMessage == nil ) then loadMessage = true end if ( deleteTime == nil ) then deleteTime = false end local account = getAccountName ( getPlayerAccount ( p ) ) local x, y, z = getElementPosition ( p ) local money, health = getPlayerMoney ( p ), getElementHealth ( p ) local armor, skin = getPedArmor ( p ), getElementModel ( p ) local int, dim = getElementInterior ( p ), getElementDimension ( p ) local job = getElementData ( p, "Job" ) local pt = exports['NGPlayerFunctions']:getPlayerPlaytime ( p ) local team = "UnEmployed" local wl = getElementData ( p, "WantedPoints" ) or 0 local rank = tostring ( getElementData ( p, "Job Rank" ) ) local group = tostring ( getElementData ( p, "Group" ) ) local gRank = tostring ( getElementData ( p, "Group Rank" ) ) local jt = exports['NGPolice']:isPlayerJailed ( p ) or 0 local weapons = { } local today = exports['NGPlayerFunctions']:getToday ( ) local kills = tonumber ( getElementData ( p, "NGSQL:Kills" ) ) or 0 local deaths = tonumber ( getElementData ( p, "NGSQL:Deaths" ) ) or 0 local weapstats = toJSON ( getElementData ( p, "NGSQL:WeaponStats" ) or weapStats_ ) local items = tostring ( toJSON ( getElementData ( p, "NGUser:Items" ) or { } ) ) local unemloyedSkin = tostring ( getElementData ( p, "NGUser.UnemployedSkin" ) ) or 28 local vip = tostring ( getElementData ( p, "VIP" ) ) local vipexp = tostring ( getElementData ( p, "NGVIP.expDate" ) ) local plrtosrvrsettings = tostring ( toJSON ( getElementData ( p, "PlayerServerSettings" ) or { } ) ) if ( getElementData ( p, "NGEvents:IsPlayerInEvent" ) ) then health = 0 dim = 0 end if ( getPlayerTeam ( p ) ) then team = getTeamName ( getPlayerTeam ( p ) ) end if not armor then armor = 0 end if ( not jt ) then jt = 0 end for i=1,12 do weapons = { getPedWeapon ( p, i ), getPedTotalAmmo ( p, i ) } end local weapons = toJSON ( weapons ) local ip = getPlayerIP ( p ) local serial = getPlayerSerial ( p ) if loadMsg then outputDebugString ( "NGSQL: Attempting to save account "..account.." (Player: "..getPlayerName ( p )..") userdata." ) end if ( deleteTime ) then exports['NGPlayerFunctions']:deletePlayerPlaytime ( p ) end return db_exec ( "UPDATE userdata SET userid=?, key=?, value=?, type=?, ", userid, key, value, type ) end end end function loadPlayerData ( p, loadMsg ) local acc = getAccountName ( getPlayerAccount ( p ) ) local data = account_exist ( acc ) if ( data and type ( data ) == 'table' ) then for i, v in ipairs ( data ) do if ( v['Username'] == acc ) then if ( loadMsg == nil ) then loadMesg = true end local userid = tonumber ( v['userid'] ) or 0 local key = tonumber ( v['key'] ) or 0 local value = tonumber ( v['value'] ) or 0 local type = tonumber ( v['type'] ) or 0 if ( not exports.nggroups:doesGroupExist ( group ) ) then group = "None" else if ( not exports.nggroups:isRankInGroup ( group, groupRank ) ) then groupRank = "None" end end if ( group:lower ( ) == "none" ) then groupRank = "None" end spawnPlayer ( p, x, y, z, 0, skin, interior, dimension ) setElementData ( p, "Job Rank", rank ) if ( jt > 0 ) then exports['NGPolice']:jailPlayer ( p, jt, false ) end setElementData ( p, "NGSQL:Kills", kills ) setElementData ( p, "NGSQL:Deaths", deaths ) setElementData ( p, "Job", job ) setPedArmor ( p, armor ) givePlayerMoney ( p, money ) exports['NGPlayerFunctions']:setPlayerPlaytime ( p,pt ) setElementData ( p, "WantedPoints", wl ) setElementData ( p, "Group", group ) setElementData ( p, "Group Rank", gRank ) setElementData ( p, "NGSQL:WeaponStats", weapstats ) setElementData ( p, "NGUser:Items", items ) setElementData ( p, "NGUser.UnemployedSkin", unemployedSkin ) setElementData ( p, "VIP", vip ) setElementData ( p, "NGVIP.expDate", vipexp ) setElementHealth ( p, health ) setElementData ( p, "PlayerServerSettings", srvrsettings ) if ( srvrsettings.walkStyle ) then setPedWalkingStyle ( p, srvrsettings.walkStyle) end exports.NGVIP:checkPlayerVipTime ( p ) for i, v in ipairs ( weapons ) do giveWeapon ( p, v[1], v[2] ) end if ( team and getTeamFromName ( team ) ) then setPlayerTeam ( p, getTeamFromName ( team ) ) end if ( loadMsg ) then outputDebugString ( "NGSQL: Loading "..acc.." account data (Player: "..getPlayerName ( p )..")" ) end return true end end end return false end function account_exist ( acc ) if ( acc ) then local q = db_query ( "SELECT * FROM accountdata WHERE Username='"..acc.."' LIMIT 1" ) if ( type ( q ) == 'table' ) then if ( #q > 0 ) then return q end return false end end return nil end function saveAllData ( useTime ) if ( useTime == nil ) then useTime = true end if ( useTime ) then if ( getResourceState ( getResourceFromName ( 'NGMessages' ) ) == 'running' ) then exports['NGMessages']:sendClientMessage ( "Please expect some lag, saving server data in 5 seconds.", root, 255, 0, 0 ) end setTimer ( function ( ) for i, v in ipairs ( getElementsByType ( 'player' ) ) do savePlayerData ( v, false, false ) end if ( isTimer ( saveAllTimer ) ) then resetTimer ( saveAllTimer ) else saveAllTimer = setTimer ( saveAllData, 3600000, 1, true ) end if ( getResourceState ( getResourceFromName ( "NGBank" ) ) == 'running' ) then exports['NGBank']:saveBankAccounts ( ) end if ( getResourceState ( getResourceFromName ( 'NGMessages' ) ) == 'running' ) then exports['NGMessages']:sendClientMessage ( "Server data has been saved!", root, 0, 255, 0 ) end if ( getResourceState ( getResourceFromName ( "NGBans" ) ) == "running" ) then exports.NGBans:saveBans ( ) end if ( getResourceState ( getResourceFromName ( "NGTurf" ) ) == "running" ) then exports.NGTurf:saveTurfs ( ) end end, 5000, 1 ) else if ( getResourceState ( getResourceFromName ( 'NGMessages' ) ) == 'running' ) then exports['NGMessages']:sendClientMessage ( "Saving server data! Please expect some lag.", root, 255, 0, 0 ) end if ( getResourceState ( getResourceFromName ( 'NGBank' ) ) == 'running' ) then exports['NGBank']:saveBankAccounts ( ) end if ( getResourceState ( getResourceFromName ( "NGBans" ) ) == "running" ) then exports.NGBans:saveBans ( ) end if ( getResourceState ( getResourceFromName ( "NGTurf" ) ) == "running" ) then exports.NGTurf:saveTurfs ( ) end for i, v in ipairs ( getElementsByType ( 'player' ) ) do savePlayerData ( v, false, false ) end if ( isTimer ( saveAllTimer ) ) then resetTimer ( saveAllTimer ) else saveAllTimer = setTimer ( saveAllData, 3600000, 1, true ) end end end saveAllTimer = setTimer ( saveAllData, 3600000, 1, true ) addEventHandler ( "onPlayerQuit", root, function ( ) if ( isGuestAccount ( getPlayerAccount ( source ) ) ) then return end savePlayerData ( source, false, true ) end ) addEventHandler ( "onPlayerLogin", root, function ( ) loadPlayerData ( source, true ) end ) addEventHandler ( "onResourceStop", resourceRoot, function ( ) saveAllData ( false ) end ) -- For development purposes --[[ addCommandHandler ( "makeaccnt", function ( p, cmd, accnt ) if ( getPlayerName ( p ) == "Console" or getAccountName ( getPlayerAccount ( p ) ) == "xXMADEXx" ) then outputChatBox ( "Executing command: Account Creation", root, 255, 255, 255 ) results = nil if ( accnt ) then if ( createAccount ( accnt ) ) then print ( "The account "..accnt.." has been created!" ) results = "Account "..accnt.." has been created" else print ( "Failed to create account." ) results = "Account "..accnt.." has failed to create!!" end else print ( "Format: /"..cmd.." [account name]" ) results = "none" end outputChatBox ( "Command Execution Results: "..tostring ( results ), root, 255, 255, 255 ) end end ) addCommandHandler ( "delaccnt", function ( p, cmd, accnt ) if ( getPlayerName ( p ) == "Console" ) then if ( account_exist ( accnt ) ) then print ( "Removing account "..accnt.." from database......" ) if ( db_exec ( "DELETE FROM accountdata WHERE Username='"..accnt.."'" ) ) then print ( "Account has been removed!" ) else print ( "Account has failed to have been removed." ) end else print ( "The account "..accnt.." doesn't exist in the mysql database." ) end end end ) addCommandHandler ( 'saveall', function ( p, cmd ) if ( ( getPlayerName ( p ) == 'Console' ) or ( getAccountName ( getPlayerAccount ( p ) ) == 'xXMADEXx' ) ) then saveAllData ( true ) end end ) ]] ----------------------------------------------------------------------------------------------------------------------------------------------- and there is my sql datafiles http://www.mediafire.com/download/2gkx1 ... l_data.sql
-
now i upload the file and connect to the mysql which is looks like good but the server still save the data to the internal.db file and not the mysql can anyone help me where i can find the original DayZ sql save ?
-
i have sql database and i want to move to mysql can some one tell how i can move this data to mysql ? like in this video : https://www.youtube.com/watch?v=7o0K4S6skH4
-
now works fine thanks man a lot but when i drop a katana then the script drop it and create a pickup but stay on my hand as well so i think i need to make this some different way any idea ? make it like setelementData each item then ad the item ids like in the DayZ server ? or which way is the easyest ?
-
not works again it destroy the pickup but doesnt give me a weapon or can be maked by like in the dayz version take down some item or something and i click it than i get the weapon or something like that