Jump to content

Search the Community

Showing results for tags 'scripting'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

  1. Hi all! I'm dont speak English, I use google translate ERROR: [DayZ-MTA]/DayZ/survivorSystem.lua:374: attempt to index global 'elementWeaponRaplace' (a nil value) Function: Line warning if elementWeaponRaplace[source] then Help remove this warning please!
  2. Hello, I am creating a PIN system on my server and wanted to ask you for help in my code. When I send the client to the server a trigger wanted to validate if the pin sent from the client to the server is an element of my table if yes setElementData will work and the Pin used will be unable to use again but in my script when it uses a pin all The others are disabled, can you help me? Note: I'm Brazilian, I'm sorry for English. local pins15k = {"UAIFKAJDKEFC15K", "KYJFKAJDEFKC15K", "BESFKSLLKEFC15K"} function PinEdit(Pin) if validatePin(Pin) then if getElementData(source, "Diamond") then setElementData(source, "Diamond", getElementData(source, "Diamond")+10000) else setElementData(source, "Diamond", 10000) end for k, v in ipairs(pins15k) do outputChatBox("["..k.."] = "..v) end else outputChatBox("Pin invalido", source) outputChatBox(tostring(pins15k)) end end addEvent("PinEdit", true) addEventHandler("PinEdit", getRootElement(), PinEdit) function validatePin(pin) local result = false for k, v in ipairs(pins15k) do if (pin == v) then pins15k[k] = nil result = true break end end return result end
  3. addEventHandler("onPlayerLogout", getRootElement(), function () local name = getPlayerName ( source ) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then exports[getResourceName(resource)]:addNotification(root, name.." kilépett a tulajdonos szolgálatból!", "success") end end ) what wrong? onPlayerLogin working with this.. wtf?!
  4. client: local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function noBinds() guiSetInputMode("no_binds_when_editing") end addEventHandler("onClientResourceStart", root, noBinds) function createLoginWindow() windowLogin = guiCreateWindow(0.3945,0.3646,0.2109,0.2018,"Magyar Play Szerver - Loginpanel by turbesz",true) guiSetSize(windowLogin, 270, 175, false) guiSetAlpha(windowLogin,1) labelUsername = guiCreateLabel(10,52,59,24,"Felh.név:",false,windowLogin) guiSetAlpha(labelUsername,1) guiLabelSetColor(labelUsername,255,255,255) guiLabelSetVerticalAlign(labelUsername,"center") guiLabelSetHorizontalAlign(labelUsername,"left",false) labelPassword = guiCreateLabel(10,86,59,24,"Jelszó:",false,windowLogin) guiSetAlpha(labelPassword,1) guiLabelSetColor(labelPassword,255,255,255) guiLabelSetVerticalAlign(labelPassword,"center") guiLabelSetHorizontalAlign(labelPassword,"left",false) labelInfo = guiCreateLabel(10,26,250,17,"Regizz, és jelentkezz be a játékhoz.",false,windowLogin) guiSetAlpha(labelInfo,1) guiLabelSetColor(labelInfo,255,255,255) guiLabelSetVerticalAlign(labelInfo,"top") guiLabelSetHorizontalAlign(labelInfo,"center",false) guiSetFont(labelInfo,"default-bold-small") editUsername = guiCreateEdit(79,52,181,25,"",false,windowLogin) guiSetAlpha(editUsername,1) guiEditSetMaxLength(editUsername, 50) editPassword = guiCreateEdit(79,86,181,25,"",false,windowLogin) guiSetAlpha(editPassword,1) guiEditSetMasked(editPassword, true) guiEditSetMaxLength(editPassword, 50) buttonLogin = guiCreateButton(10,121,120,21,"Bejelentkezés",false,windowLogin) guiSetAlpha(buttonLogin,1) buttonRegister = guiCreateButton(143,121,117,21,"Regisztrálás",false,windowLogin) guiSetAlpha(buttonRegister,1) buttonGuest = guiCreateButton(10,145,121,21,"Vendég",false,windowLogin) guiSetAlpha(buttonGuest,1) checkbox_save = guiCreateCheckBox(157,145,117,21,"Adatok mentése",false,false,windowLogin) guiSetFont(checkbox_save,"default-small") guiWindowSetSizable ( windowLogin, false ) guiSetVisible(windowLogin, false) addEventHandler("onClientGUIClick", buttonLogin, clientSubmitLogin, false) addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false) local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( editUsername, tostring(username)) guiSetText ( editPassword, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( editUsername, tostring(username)) guiSetText ( editPassword, tostring(password)) end end function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/adatok.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/adatok.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) local xml_save_log_File = xmlLoadFile ("files/xml/adatok.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/adatok.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() local xml_save_log_File = xmlLoadFile ("files/xml/adatok.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/adatok.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) addEventHandler("onClientGUIClick",root, function () if source == buttonGuest then guiSetVisible ( windowLogin , false ) showCursor(false) end end ) function resourceStart() createLoginWindow() if (windowLogin ~= nil) then guiSetVisible(windowLogin, true) else outputChatBox("Whoops, valami error történt.") end showCursor(true) guiSetInputEnabled(true) end function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(editUsername) local password = guiGetText(editPassword) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else guiSetText(labelInfo, "Írj be felh.nevet és jelszót.") end end end function clientSubmitRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(editUsername) local password = guiGetText(editPassword) if username and password then triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) else guiSetText(labelInfo, "Írj be felh.nevet és jelszót.") end end end function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(windowLogin, false) showCursor(false) end function unknownError() guiSetText(labelInfo, "Ismeretlen hiba.") end function loginWrong() guiSetText(labelInfo, "Hibás adatok.") end function registerTaken() guiSetText(labelInfo, "Felhasználó név regisztrálva van.") end addEvent("hideLoginWindow", true) addEvent("unknownError", true) addEvent("loginWrong", true) addEvent("registerTaken", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) addEventHandler("unknownError", getRootElement(), unknownError) addEventHandler("loginWrong", getRootElement(), loginWrong) addEventHandler("registerTaken", getRootElement(), registerTaken) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStart) fileDelete("client.lua") server: function loginHandler(player, username, password, checksave) local account = getAccount(username, password) if (account ~= false) then if (logIn(player, account, password) == true) then triggerClientEvent (player, "hideLoginWindow", getRootElement()) if checksave == true then triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password) else triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password) end else triggerClientEvent (player, "unknownError", getRootElement()) end else triggerClientEvent (player, "loginWrong", getRootElement()) end end function registerHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then triggerClientEvent(player, "registerTaken", getRootElement()) else account = addAccount(username, password) if (logIn(player, account, password) == true) then triggerClientEvent(player, "hideLoginWindow", getRootElement()) else triggerClientEvent(player, "unknownError", getRootElement()) end end end addEvent("submitLogin", true) addEvent("submitRegister", true) addEventHandler("submitLogin", root, loginHandler) addEventHandler("submitRegister", root, registerHandler) why not save?
  5. Is there a way to morph a part of an object with a shader like pedmorph? So I don't want to morph the whole model, just a part of it. (Like a ped's head, or something)
  6. Client.lua : LblOnlineAdmins = {} admins = "" function setAdminList(list) if (admins ~= list) then admins = list if (admins == "") then guiSetText(LblOnlineAdmins, "Admins online: none") else guiSetText(LblOnlineAdmins, "Admins online: " .. admins) end end end addEvent( "setAdminList", true ) addEventHandler( "setAdminList", getRootElement(), setAdminList ) function getAdmins() LblOnlineAdmins = guiCreateLabel(0,0.9466,0.3799,0.0247,"",true) guiLabelSetColor(LblOnlineAdmins,255,0,0) guiLabelSetVerticalAlign(LblOnlineAdmins,"top") guiLabelSetHorizontalAlign(LblOnlineAdmins,"left",true) guiSetFont(LblOnlineAdmins,"default-bold-small") end addEventHandler( "onClientResourceStart", getRootElement( ), getAdmins) Server.lua : admins = "" function processAdminList() players = getElementsByType ( "player" ) admins = "" for k,v in ipairs(players) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then if (admins == "") then admins = getPlayerName(v) else admins = admins .. ", " .. getPlayerName(v) end end end end triggerClientEvent("setAdminList", getResourceRootElement(), admins) end addEventHandler( "onPlayerLogin", getRootElement(), processAdminList ) addEventHandler( "onPlayerLogout", getRootElement(), processAdminList ) addEventHandler( "onPlayerChangeNick", getRootElement(), processAdminList ) addEventHandler( "onPlayerQuit", getRootElement(), processAdminList ) addEventHandler("onPlayerJoin", getRootElement(), processAdminList) how to fix?:(
  7. local ScreenSizeX,ScreenSizeY = guiGetScreenSize(); local StartTick,Duration,EndTick = nil,2000,nil; local Debounce = false; local rootElement = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution local function RenderHandler() local playerX, playerY, playerZ = getElementPosition( getLocalPlayer() ) -- Get player's coordinates. local playerZoneName = getZoneName( playerX, playerY, playerZ ) -- Get name of the player's zone. local CurrentTick = getTickCount(); -- get the current tick; local Progress = (CurrentTick-StartTick)/Duration; -- calculate the progress between 0 and 1 using simple math; local Alpha = interpolateBetween(0,0,0,255,0,0,Progress,"InOutQuad"); dxDrawText(playerZoneName,ScreenSizeX/2,ScreenSizeY/2,ScreenSizeX,ScreenSizeY,tocolor(255,255,255,Alpha),1,"default-bold"); if CurrentTick>=EndTick then -- if the animation is finished; StartTick,EndTick = nil,nil; -- clear variables; removeEventHandler("onClientRender",root,RenderHandler); -- remove the render handler; Debounce = false; -- we can now use /dx again; end; end; addEventHandler("onClientRender",rootElement, function() if not Debounce then -- if the text isn't already rendering; Debounce = true; StartTick = getTickCount(); -- get the current tick as the start tick of the animation; EndTick = StartTick+Duration+1000; -- calculate the end tick; addEventHandler("onClientRender",root,RenderHandler); -- add the render handler only when you type the command; end; end); fileDelete("client.lua") when i start script, the dx message show the zone name more than one, but i want, show the zone name only 1x how to fix this? sorry for my bad english
  8. first error by: function createKillMessageGUI() local gap = config.iconHeight - config.textHeight gap = gap/2 for i=1,config.lines do local y = config.startY*screenY + (config.iconHeight*(i-1)) y = y + gap contentMessages[i] = { dxText:create("",0,y) } end endTime = config.fadeTime + config.startFade end -- second error by: function destroyLine ( line ) for k,part in ipairs(contentMessages[line]) do destroyWidget(part) end contentMessages[line] = {} end first error: killmessages\gui.lua:159: attempt to index global 'dxText' (a nil value) second error: killmessages\gui.lua:468: bad argument #1 to 'ipairs' (table expected, got nil) how to fix this? i tried fix, but doesn't working
  9. I just want to make shadows in MTA, like in this video: (at 2:33) There is a dynamic light shader with shadows, but it has so many bugs.
  10. when i playing a dm map, and everybody die, the votemap start automatic. how to disable? i want when everyone die, after start votemap
  11. How can i just apply the same shader to the same texture twice? I want to make a car vinyl system, but the last shader i've created overwrites the others. Any idea?
  12. Hi, it's me again. My problem is about that, that im wondering what is the function that makes something happen after that player clicks a chk from freeroam panel, like im trying to make something in freeroam and here's the chk: {'chk', id='Disable warping'}, and now, i dont know how to say that but how am i supposed to make some event happen after clicking it .. ? function disableWarping () ( blablabla.... ) addEventHandler ( "onPlayerClick {'chk', id="Disable warping'} ", disableWarping ) should it be in addEventHandler or what ? dont have any freaking idea ...
  13. i created a info panel, with scrollpane, and labels. but in 1440x900 resolution is working fine, but i tested in 800x600, and the labels with the text sticking out from the window.. how to fix this? here is my code: local GUIEditor = { window = {}, scrollpane = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(0.27, 0.21, 0.47, 0.59, "Segítség", true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.scrollpane[1] = guiCreateScrollPane(0.01, 0.04, 0.97, 0.94, true, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(0.00, 0.01, 1.00, 0.04, "Infó:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetColor(GUIEditor.label[1], 255, 0, 0) GUIEditor.label[2] = guiCreateLabel(0.00, 0.04, 0.98, 0.06, " Név: [HUN]Magyar Play Szerver 1.5\n Játékmód: play", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[2], "clear-normal") guiLabelSetColor(GUIEditor.label[2], 61, 161, 254) GUIEditor.label[3] = guiCreateLabel(0.00, 0.12, 1.00, 0.04, "Elérhetőségek:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetColor(GUIEditor.label[3], 255, 0, 0) GUIEditor.label[4] = guiCreateLabel(0.00, 0.16, 0.97, 0.10, " Facebook: www.tinyurl.com/magyarplay15\n TeamSpeak 3: -\n Skype: turboskype29", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[4], "clear-normal") guiLabelSetColor(GUIEditor.label[4], 61, 161, 254) GUIEditor.label[5] = guiCreateLabel(0.00, 0.28, 1.00, 0.04, "GYIK:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[5], "default-bold-small") guiLabelSetColor(GUIEditor.label[5], 255, 0, 0) GUIEditor.label[6] = guiCreateLabel(0.02, 0.32, 0.92, 0.21, "\n -Ahogy betöltött a szerver, a kocsik elérhetőek az F1 panel\n megnyitásával, kattintva a \"jármű lekérés\" menüpontra.\n Azon belül a repülők az \"aircraft\", a motorkák a \"bikes\", hajók a\n \"boats\", kocsik a \"cars\".\n A másik módja a kocsik lehívásához a /sv parancs. /sv <kocsinév>\n Pl. /sv infernus", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[6], "clear-normal") guiLabelSetColor(GUIEditor.label[6], 61, 161, 254) GUIEditor.label[7] = guiCreateLabel(0.00, 0.31, 0.98, 0.06, " Hogyan tudok kocsit szerezni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[7], "clear-normal") guiLabelSetColor(GUIEditor.label[7], 254, 254, 254) GUIEditor.label[8] = guiCreateLabel(0.00, 0.54, 0.92, 0.03, " Hogy tudok fegyvert szerezni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[8], "clear-normal") guiLabelSetColor(GUIEditor.label[8], 254, 254, 254) GUIEditor.label[9] = guiCreateLabel(0.02, 0.58, 0.92, 0.21, " -Fegyvert venni, vagy F1-ből lehívni tudsz. De ha többet akarsz gyorsan\n egyszerre, akkor F2. Azon belül fegyvercsomag.\n Fegyvert szerezhetsz még más playerek megölésével.\n Amint meghal egy játékos, és volt nála fegyver, az kikerül a\n meghalt teste fölé és megjelenik az összes\n fegyver, amit Te felszedhetsz. Vigyázz! Ha meghalsz, te is\n elveszítheted azokat a fegyvereket.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[9], "clear-normal") guiLabelSetColor(GUIEditor.label[9], 61, 161, 254) GUIEditor.label[10] = guiCreateLabel(0.00, 0.80, 0.92, 0.03, " Miért öltek meg?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[10], "clear-normal") guiLabelSetColor(GUIEditor.label[10], 254, 254, 254) GUIEditor.label[11] = guiCreateLabel(0.02, 0.84, 0.92, 0.21, " -A szerver játékmódja \"play\", ami annyit mond, hogy a szerver\n próbál lehetőséget adni mindenkinek\n a szórakozásra. Így azon játékosok, akik passzív agresszív módon\n gyilkolással vezetik le\n feszültségeiket, szabad utat kapnak ennek megvalósítására. Szóval\n ha meghalsz, ne rinyálj, mivel\n megteheti, és ugyanúgy Te is megölhetsz bárkit.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[11], "clear-normal") guiLabelSetColor(GUIEditor.label[11], 61, 161, 254) GUIEditor.label[12] = guiCreateLabel(0.00, 1.06, 0.92, 0.03, " Mi az a \"gift\" az F2-ben?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[12], "clear-normal") guiLabelSetColor(GUIEditor.label[12], 254, 254, 254) GUIEditor.label[13] = guiCreateLabel(0.02, 1.10, 0.92, 0.21, " -Nagy köszönet érte turbesznek (főadmin, szerótulaj), aki\n megalkotta a \"Gift\" menüpontot az F2 panelben.\n A gift jelentése \"ajándék\".\n Ezzel a \"kattintással\" lehetőséged nyílik arra, hogy olyan dolgokat\n használj, amiket más esetben nem\n tudnál. Például tank, minigun 3000 tölténnyel, halhatatlanság, halhatatlan autó, nagy\n fegyvercsomag és egyebek. A giftet 12 óránként használhatod.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[13], "clear-normal") guiLabelSetColor(GUIEditor.label[13], 61, 161, 254) GUIEditor.label[14] = guiCreateLabel(0.00, 1.31, 0.92, 0.03, " Mi az a [M] a játékos neve előtt?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[14], "clear-normal") guiLabelSetColor(GUIEditor.label[14], 254, 254, 254) GUIEditor.label[15] = guiCreateLabel(0.01, 1.35, 0.92, 0.21, " -Ha látsz egy playert, akinek a neve előtt [M] vagy [A] van, az\n vagy Moderátor, vagy Admin. Ezek a játékosok\n ügyelik a szervert, moderálnak, szerveznek meg mindent, ők\n segítenek másokon és ők azok, akik irányítják a\n szervert. Ezek a játékosok színesen írnak. ( ! Ha valamelyik játékos\n előtt [M] van, de nem ír színesen, az nem rangos!)\n A moderátoroknak lehetőségük nyílik mások kikelésére,\n bannolására és mute-olására, Mivel ők tartják fenn a rendet\n a szerveren, a rájuk eső feladatokat el is végzik.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[15], "clear-normal") guiLabelSetColor(GUIEditor.label[15], 61, 161, 254) GUIEditor.label[16] = guiCreateLabel(0.00, 1.57, 0.92, 0.03, " Hogy tudok admin/moderátor lenni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[16], "clear-normal") guiLabelSetColor(GUIEditor.label[16], 254, 254, 254) GUIEditor.label[17] = guiCreateLabel(0.01, 1.61, 0.92, 0.21, " -Sokszor felmerül a kérdés, de a választ nehéz rá megválaszolni. Ezt\n turbesz dönti el (NEM MÁS), és az ő\n követelései határozzák meg modira való lehetőséged. Az esetek\n 99.9%-ban a játékosoknak nincs esélyük\n moderátornak lenni, azonban próbálkozni nem\n törvénybeütköző.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[17], "clear-normal") guiLabelSetColor(GUIEditor.label[17], 61, 161, 254) GUIEditor.label[18] = guiCreateLabel(0.01, 1.80, 0.92, 0.03, " Hogy tudok színesen írni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[18], "clear-normal") guiLabelSetColor(GUIEditor.label[18], 254, 254, 254) GUIEditor.label[19] = guiCreateLabel(0.01, 1.84, 0.92, 0.21, " -Két (2) módja van annak, hogy Te színesen tudj írni. Az egyik,\n hogy rangod van (vip, modi, admin), a másik,\n hogy veszel a giftben. A giftben fehéres-zöld szín van, ami\n megmarad addig, amíg turbesz el nem veszi.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[19], "clear-normal") guiLabelSetColor(GUIEditor.label[19], 61, 161, 254) GUIEditor.label[20] = guiCreateLabel(0.01, 1.97, 0.92, 0.03, " Hogy tudok gyorsan menni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[20], "clear-normal") guiLabelSetColor(GUIEditor.label[20], 254, 254, 254) GUIEditor.label[21] = guiCreateLabel(0.02, 2.01, 0.92, 0.21, " -Ha kocsiban vagy, az ALT nyomva tartásával gyorsíthatod a kocsid\n maximum sebességre.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[21], "clear-normal") guiLabelSetColor(GUIEditor.label[21], 61, 161, 254) GUIEditor.label[22] = guiCreateLabel(0.01, 2.08, 0.92, 0.03, " Írok a chaten, de csak ezt dobja ki: \"You are muted!\"", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[22], "clear-normal") guiLabelSetColor(GUIEditor.label[22], 254, 254, 254) GUIEditor.label[23] = guiCreateLabel(0.01, 2.12, 0.92, 0.21, " -Ez azért van, mert mute-olva lettél, tehát valami szabálytalanságot\n követtél el a chatben.\n Mute = letiltás a chatbe írás lehetőségéről\n Mute jár: spam, flood, idegesítő mondatok, szavanként elküldött\n szövegek, durva káromkodás...\n", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[23], "clear-normal") guiLabelSetColor(GUIEditor.label[23], 61, 161, 254) GUIEditor.label[24] = guiCreateLabel(0.01, 2.28, 0.92, 0.03, " Hogy tudok vízen menni és/vagy repülni?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[24], "clear-normal") guiLabelSetColor(GUIEditor.label[24], 254, 254, 254) GUIEditor.label[25] = guiCreateLabel(0.01, 2.32, 0.92, 0.21, " -Ha kocsiban vagy (kivéve motor) és beírod, hogy /fly azzal repülni\n fogsz. Kikapcsolásához beírod mégegyszer.\n Ha vízen akarsz menni, arra ott a /water parancs. Ha ki szeretnéd\n kapcsolni, beírod mégegyszer.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[25], "clear-normal") guiLabelSetColor(GUIEditor.label[25], 61, 161, 254) GUIEditor.label[26] = guiCreateLabel(0.01, 2.45, 0.92, 0.03, " Mi az a \"Privát üzenetek\"?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[26], "clear-normal") guiLabelSetColor(GUIEditor.label[26], 254, 254, 254) GUIEditor.label[27] = guiCreateLabel(0.01, 2.49, 0.92, 0.21, " -Ezzel a funkcióval privát üzenetet küldhetsz. Rákattintásal kidobja\n a szerveren található összes játékost,\n és kiválasztva a neked megfelelőt, külön üzenetet küldhetsz neki,\n amit csak Ti ketten láttok.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[27], "clear-normal") guiLabelSetColor(GUIEditor.label[27], 61, 161, 254) GUIEditor.label[28] = guiCreateLabel(0.01, 2.62, 0.92, 0.03, " Hogy lehet színes a nevem?", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[28], "clear-normal") guiLabelSetColor(GUIEditor.label[28], 254, 254, 254) GUIEditor.label[29] = guiCreateLabel(0.01, 2.66, 0.92, 0.21, " -Színkóddal. Beírod Google-ba, hogy színkódok és kidob egy\n csomót. 6 jegyből áll és a jegyek előtt van egy # (rács) jel.\n Úgy működik, hogy a színkód utáni rész a színes. Ha pl. a neved\n ADMIN és a piros színkódot (#FF0000) az ADMIN elé rakod,\n az egész ADMIN szó piros lesz. Viszont ha csak az IN elé, de az ADM\n után, csak az IN lesz piros, az ADM nem. Pár színkód a színkód panelben: /szinkod", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[29], "clear-normal") guiLabelSetColor(GUIEditor.label[29], 61, 161, 254) GUIEditor.label[30] = guiCreateLabel(0.01, 2.85, 0.92, 0.03, " Fontos:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[30], "default-bold-small") guiLabelSetColor(GUIEditor.label[30], 255, 0, 0) GUIEditor.label[31] = guiCreateLabel(0.01, 2.88, 0.92, 0.21, " Kedves proletár!\n Tisztelettel megkérlek arra, hogy:\n -Ne káromkodj! Vannak fiatalabbak, akik előtt hanyagolni kell az\n obszcén szavak használatát!\n -Nem Role Play (RP) szerver. Ami azt jelenti, hogyha ezen a szerveren\n játszol,\n kapcsold ki a bindjeidet! Pl. XY beveri a fejét, de nem esik nagyobb\n baja\n Vagy gondolok itt a XY beköti az övét, eszik, iszik és egyéb más irritáló\n tevékenységekre.\n -Tartsd tiszteletben a más nyelvet beszélő elvtársaidat! Ne szidd le,\n csak mert török vagy angol.", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[31], "clear-normal") guiLabelSetColor(GUIEditor.label[31], 61, 161, 254) GUIEditor.label[32] = guiCreateLabel(0.01, 3.08, 0.92, 0.03, " Rangosok:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[32], "default-bold-small") guiLabelSetColor(GUIEditor.label[32], 255, 0, 0) GUIEditor.label[33] = guiCreateLabel(0.01, 3.11, 0.92, 0.21, " [ADMIN]\n -turbesz", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[33], "clear-normal") guiLabelSetColor(GUIEditor.label[33], 61, 161, 254) GUIEditor.label[34] = guiCreateLabel(0.01, 3.17, 0.92, 0.03, " Modok:", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[34], "default-bold-small") guiLabelSetColor(GUIEditor.label[34], 255, 0, 0) GUIEditor.label[35] = guiCreateLabel(0.02, 3.20, 0.92, 0.21, " Ezeket megtalálod az f1-ben!\n\n .\n\n A szerveren sok játékosok által készített mappolás található. (Külön\n köszönet turbesznek!)", true, GUIEditor.scrollpane[1]) guiSetFont(GUIEditor.label[35], "clear-normal") guiLabelSetColor(GUIEditor.label[35], 254, 254, 254) guiSetVisible(GUIEditor.window[1], false) function helpm() if guiGetVisible ( GUIEditor.window[1] ) == false then guiSetVisible ( GUIEditor.window[1], true ) showCursor(true) elseif guiGetVisible ( GUIEditor.window[1] ) == true then guiSetVisible ( GUIEditor.window[1], false ) showCursor(false) end end bindKey ( "F9", "down", helpm) fileDelete("c.lua")
  14. function tesztlel() local random = math.random(1, 7) --change as appropriate if random == 1 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: MINIGUN \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) triggerServerEvent("giveWeapon", getLocalPlayer(), group) local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 2 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: GOD MODE \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") function godmode ( ) cancelEvent ( ) end addEventHandler ( "onClientGUIClick", button2, function ( ) addEventHandler ( "onClientPlayerDamage", localPlayer, godmode ) toggleControl ( 'fire', false ) toggleControl ( 'action', false ) end ,false ) local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 3 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: FEGYVERCSOMAG \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) triggerServerEvent("giveWeapon1", getLocalPlayer(), group) local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 4 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: HALH.AUTÓ \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) local car = getPedOccupiedVehicle(localPlayer) if source == button3 then if isVehicleDamageProof(car) == false then setVehicleDamageProof(car, true) else if isVehicleDamageProof(car) == true then setVehicleDamageProof(car, false) end end end local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 5 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: TANK \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") --guiSetVisible(GUIEditorwindow, false) triggerServerEvent("tank",getLocalPlayer(),0,255,0,"Ezt a tankot addig használhatod amíg szeretnéd, vigyázz rá, mert 12 óráig nem kapsz újat.") local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 6 then group = "writing" triggerServerEvent("addToGroup", getLocalPlayer(), group) guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: SZÍNESÍRÁS \n\nVárunk vissza 12 óra múlva. ;)\nHasználd egészséggel a nyereményed!") local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end elseif random == 7 then guiSetVisible(nyer, true) guiSetText(szveg, "Nyereményed: SEMMI! XD \n\nNe bánkódj!\n12 óra múlva hátha kapsz valamit! XD") local currentState = guiGetProperty( GUIEditorgomb1, "Disabled" ) if currentState == "True" then guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) else guiSetProperty( GUIEditorgomb1, "Disabled", "True" ) end end end addEventHandler("onClientGUIClick", GUIEditorgomb1, tesztlel) I want, when the user click on the button, give a thing, and disable button and do not get it again gift
  15. I want make more than one function to math.random, when i click on a button, choose a function, for example god mode, or give weapons, how to make it? Sorry for my very bad english.
  16. local myCol = createColRectangle (-2039, 165, 22, 20) local myCol = createColRectangle (1342.5, -1817.4, 38, 40) local myCol = createColRectangle (1960, 1618.5, 16, 20) function destroyTheVehicles (player) if getElementType (player) == "player" and isPedInVehicle (player) then destroyElement (getPedOccupiedVehicle (player)) outputChatBox ("Ide nem léphetsz be kocsival! Felejtsd el, különben büntit kapsz.", player, r, g, b) end end addEventHandler ("onColShapeHit", myCol, destroyTheVehicles) Working on localhost server, but doesn't working on hosted server How to fix this bug?
  17. When me and my friend press '2', the script show double answer (- 1 - 1 instead of -2) or when me press '1' and my friend press '2', the script show this: 1.) Answer1 - 1 - 0 and 2.) Answer2 - 1 - 0.. How to fix this? Sorry for my bad english. code: --client-- local szavon = false --is this something used to prevent double questions? it should be serverside :/ local ido = 30 local valasz = 0 local valasz2 = 0 -- I need an explanation of valasz and valasz2, if you use them to keep track of the selected answer then there are errors GUIEditor_Window = {} GUIEditor_Label = {} function szAblak(ker,v1,v2) --question, answ1, answ2, all strings if not szavon then local v_1 = v1 --answ1, useless variable local v_2 = v2 --answ2, useless variable local szavon = true local sw,sh = guiGetScreenSize() GUIEditor_Window[1] = guiCreateWindow(sw/1.48,sh/1.4,sw/3.2,sh/3.6,"Szavazás",false) --wow it's hard to me thinking relatives coord like this, wouldn't be % much easier? guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(0.0474,0.1242,0.9161,0.2919,ker,true,GUIEditor_Window[1]) guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",true) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.0657,0.4783,0.8759,0.1553,"1.) "..v_1,true,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(0.0657,0.6335,0.8759,0.1491,"2.) "..v_2,true,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(0.0474,0.8075,0.8,0.1,ido,true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],150,150,255) guiSetFont(GUIEditor_Label[4],"clear-normal") bindKey ("1", "down", function() guiSetFont(GUIEditor_Label[3],"clear-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) valasz = 1 guiLabelSetColor(GUIEditor_Label[2],255,200,200) guiSetFont(GUIEditor_Label[2],"default-bold-small") end ) bindKey ("2", "down", function() guiSetFont(GUIEditor_Label[2],"default-normal") guiLabelSetColor(GUIEditor_Label[2],255,255,255) valasz2 = 1 guiLabelSetColor(GUIEditor_Label[3],255,200,200) guiSetFont(GUIEditor_Label[3],"default-bold-small") end ) lejar = setTimer( function() ido = ido-1 guiSetText(GUIEditor_Label[4], ido ) if ido == 0 then szVeg() --so it will be called 30s after szAblak end end, 1000,30) end end function szVeg() if isTimer(lejar) then --is it possible? It's useless i think killTimer(lejar) end szavon = false guiSetText(GUIEditor_Label[4], "szavazatok számlálása..." ) guiSetFont(GUIEditor_Label[2],"default-normal") guiSetFont(GUIEditor_Label[3],"default-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetColor(GUIEditor_Label[2],255,255,255) local v1 = valasz --if 2 was pressed this will be 2, otherwise 0 local v2 = valasz2 --if 2 was pressed this will be 2, otherwise 0 triggerServerEvent("submit",getLocalPlayer(),v1,v2) --valasz will be 1 if 1 key got pressed, otherwise 0 end addEvent("szvzas",true) --this will be called once a one player in the server makes a question addEventHandler("szvzas",root, function(question,answ1,answ2) --the handler attached to the root (resourceRoot should also work) accept 3 arguments szAblak(question,answ1,answ2) --and call the function with these paramenters end ) addEvent("valaszok",true) addEventHandler("valaszok",getRootElement(), function(v1,v2) --after 5 second from szVeg this will be triggered --v1 1 or 0, v2 2 or 0. BOTH CAN BE 0!!!! ALSO BOTH CAN BE 1 AND 2. The font wans't already set? you are not changing any passed var serverside. This doesn't make sense guiSetText(GUIEditor_Label[4], "_@/\"" ) guiSetText(GUIEditor_Label[2], guiGetText(GUIEditor_Label[2]) .. " - " .. v1 ) guiSetText(GUIEditor_Label[3], guiGetText(GUIEditor_Label[3]) .. " - " .. v2 ) if v1 > v2 then --i need explanation here. It's error if you are using them to see what localPlayer choose guiSetFont(GUIEditor_Label[2],"default-bold-small") elseif v1 < v2 then guiSetFont(GUIEditor_Label[3],"default-bold-small") end setTimer( function()--reset to default destroyElement(GUIEditor_Window[1]) szavon = false ido = 30 valasz = 0 valasz2 = 0 end, 5000, 1) end ) --server-- addEvent( "submit", true ) addEventHandler( "submit", root, function (v1, v2) -- 1 or 0, 2 or 0 depending on keypress setTimer( function() triggerClientEvent(root, "valaszok", resourceRoot, v1, v2) end, 5000, 1) end ) function szvzas(playerSource, cmd, theQuestion, theFirstAnswer, theSecondAnswer) --read the wiki for more infos triggerClientEvent ( root, "szvzas", resourceRoot, theQuestion, theFirstAnswer, theSecondAnswer ) --trigger on root, event "szvzas", source is the resource, and there are 3 arguments end addCommandHandler ( "k", szvzas )
  18. function csunyaszavak(message,messageType) if message == "buzi" or message == "fasz" or message == "geci" or message == "kurva" or message == "baszd" or message == "bazd" or message == "bazmeg" or message == "nyomorék" or message == "csicska" or message == "anyád" or message == "pina" then setPlayerMuted( source, true ) gPlayerMuteTimer[ source ] = setTimer( unmutePlayer, gSettings.muteTime * 1000, 1, source ) outputChatBox( "#14B866[M] #FF699CPlaybot#898395: #808080Ne káromkodj a chaten! (#ffFFff"..getPlayerName(source).."#808080) (mute)", root, 255, 0, 0, true ) end end addEventHandler("onPlayerChat",getRootElement(),csunyaszavak) When i type in chat for example "f*sz", the script mute me. But, when i type for example "te f*sz", the script doesn't mute me. Why? How to fix this?
  19. When i type a big character, the script mute me.. But i want, when i type more than one big character, then mute me. How to fix this? /sorry for my bad english/ code: (server only) addEventHandler('onPlayerChat',getRootElement(),function(key) if string.byte(key) > 40 and string.byte(key) < 91 then -- pressed an alphabedical symbol with CAPS LOCK ON! setPlayerMuted( source, true ) gPlayerMuteTimer[ source ] = setTimer( unmutePlayer, gSettings.muteTime * 1000, 1, source ) outputChatBox( "#14B866[M] #FF699CPlaybot#898395: #696969Ne írj csupa nagybetűvel a chatben. Köszi! (#ffFFff"..getPlayerName(source).."#696969) (mute)", root, 255, 0, 0, true ) end end)
  20. -- client -- local szavon = false local ido = 30 local valasz = 0 GUIEditor_Window = {} GUIEditor_Label = {} function szAblak(ker,v1,v2) if not szavon then local v_1 = v1 local v_2 = v2 local szavon = true local sw,sh = guiGetScreenSize() GUIEditor_Window[1] = guiCreateWindow(sw/1.48,sh/1.4,sw/3.2,sh/3.6,"Szavazás",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Label[1] = guiCreateLabel(0.0474,0.1242,0.9161,0.2919,ker,true,GUIEditor_Window[1]) guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",true) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(0.0657,0.4783,0.8759,0.1553,"1.) "..v_1,true,GUIEditor_Window[1]) --guiLabelSetColor(GUIEditor_Label[2],255,200,200) --guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(0.0657,0.6335,0.8759,0.1491,"2.) "..v_2,true,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(0.0474,0.8075,0.8,0.1,ido,true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],150,150,255) guiSetFont(GUIEditor_Label[4],"clear-normal") bindKey ("1", "down", function() guiSetFont(GUIEditor_Label[3],"clear-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) valasz = 1 guiLabelSetColor(GUIEditor_Label[2],255,200,200) guiSetFont(GUIEditor_Label[2],"default-bold-small") end) bindKey ("2", "down", function() guiSetFont(GUIEditor_Label[2],"default-normal") guiLabelSetColor(GUIEditor_Label[2],255,255,255) valasz = 2 guiLabelSetColor(GUIEditor_Label[3],255,200,200) guiSetFont(GUIEditor_Label[3],"default-bold-small") end) lejar = setTimer( function() ido = ido-1 guiSetText(GUIEditor_Label[4], ido ) if ido == 0 then szVeg() --killTimer(lejar) end end, 1000,30) end end function szVeg() if isTimer(lejar) then killTimer(lejar) end szavon = false guiSetText(GUIEditor_Label[4], "szavazatok számlálása..." ) guiSetFont(GUIEditor_Label[2],"default-normal") guiSetFont(GUIEditor_Label[3],"default-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetColor(GUIEditor_Label[2],255,255,255) --("valasz: "..valasz) triggerServerEvent("submit",getLocalPlayer(),valasz) unbindKey ("1", "down", function() guiSetFont(GUIEditor_Label[3],"clear-normal") guiLabelSetColor(GUIEditor_Label[3],255,255,255) valasz = 1 guiLabelSetColor(GUIEditor_Label[2],255,200,200) guiSetFont(GUIEditor_Label[2],"default-bold-small") end) unbindKey ("2", "down", function() guiSetFont(GUIEditor_Label[2],"default-normal") guiLabelSetColor(GUIEditor_Label[2],255,255,255) valasz = 2 guiLabelSetColor(GUIEditor_Label[3],255,200,200) guiSetFont(GUIEditor_Label[3],"default-bold-small") end) end addEvent("szvzas",true) addEventHandler("szvzas",getRootElement(), function(question,answ1,answ2) szAblak(question,answ1,answ2) end) addEvent("valaszok",true) addEventHandler("valaszok",getRootElement(), function(v1,v2) guiSetText(GUIEditor_Label[4], "_@/\"" ) guiSetText(GUIEditor_Label[2], guiGetText(GUIEditor_Label[2]) .. " - " .. v1 ) guiSetText(GUIEditor_Label[3], guiGetText(GUIEditor_Label[3]) .. " - " .. v2 ) if v1 > v2 then guiSetFont(GUIEditor_Label[2],"default-bold-small") elseif v1 < v2 then guiSetFont(GUIEditor_Label[3],"default-bold-small") end setTimer( function() destroyElement(GUIEditor_Window[1]) szavon = false ido = 30 valasz = 0 end, 5000, 1) end) -- server -- function submit() bindKey ("1", "down", function() valasz = 1 end) bindKey ("2", "down", function() valasz = 2 end) end addEvent( "submit", true ) addEventHandler( "submit", root, submit ) function szvzas(question,answ1,answ2) local question = "" local answ1 = "" local answ2 = "" triggerClientEvent ( root, "szvzas", root, text) end addCommandHandler ( "k", szvzas, question, answ1, answ2 ) function valaszok(v1,v2) triggerClientEvent(root, "valaszok", root, v1, v2) bindKey(player, "1", "down", v1) bindKey(player, "2", "down", v2) end The window appear when i type '/k', but i want question, answer1, answer2 in this command (/k Question? Answ1 Answ2 example). But doesn't working.. Sorry, me very noob. And, error: server.lua:20: attempt to concatenate local 'v_1' (a nil value). Why?
  21. -- client -- function boom ( ) local pX, pY, pZ = getElementPosition ( getLocalPlayer() ) createExplosion ( pX+3, pY+3, pZ, 2 ) createExplosion ( pX-3, pY-3, pZ, 2 ) createExplosion ( pX+5, pY-2, pZ, 2 ) createExplosion ( pX-4, pY+4, pZ, 2 ) end addEvent( "rob", true ) addEventHandler( "rob", root, boom ) -- server -- function robbant(p,s) if hasObjectPermissionTo(p,"command.rob") then triggerClientEvent(getRootElement(),"rob",getRootElement()) end end addCommandHandler("rob",robbant) When i type 'rob', explode everyone.. Why? How to fix this?
  22. -- client -- local w, h = guiGetScreenSize () local destroyTime local asd = 0.138 local target local localPlayer = getLocalPlayer () local allowed = true addEvent ( "allowIt", true ) addEventHandler ( "allowIt", root, function ( element ) allowed = true end ) addEventHandler ( "onClientPlayerWeaponFire", localPlayer, function ( weapon, _, _, _, _, _, element ) if not element or not allowed then return end if weapon == 23 then target = element if not destroyTime then addEventHandler ( "onClientRender", root, drawProgress ) end destroyTime = getTickCount () end end ) function drawProgress () if not getPedTarget ( localPlayer ) then destroyTime = nil target = nil removeEventHandler ( "onClientRender", root, drawProgress ) end local prog = getTickCount () - ( destroyTime or getTickCount () ) if prog > 1000 then triggerServerEvent ( "destroyIt", localPlayer, target ) destroyTime = nil target = nil removeEventHandler ( "onClientRender", root, drawProgress ) end local w2, h2 = math.floor ( w/2 ), math.floor ( h/2 ) dxDrawLine ( w2 - 72, h2 - 6, w2 - 72, h2 + 6 ) dxDrawLine ( w2 + 72, h2 - 6, w2 + 72, h2 + 6 ) dxDrawRectangle ( w2 - 69, h2 - 6, prog * asd, 12 ) end -- server -- function destroyIt (target) destroyElement(source, target) end addEvent( "destroyIt", true ) addEventHandler( "destroyIt", root, destroyIt ) no warnings / errors...
  23. function boom ( ) local pX, pY, pZ = getElementPosition ( source ) createExplosion ( pX, pY, pZ, 2 ) end addCommandHandler( "rob", boom, getLocalPlayer() ) bad argument @ 'addCommandHandler' [Expected bool at argument 3, got player]
  24. Hi! I just searched for lighting effects, and i found a shader for XNA. Its an Ambient and Diffuse lighting shader with Shadow Maps: #define GENERATE_NORMALS #include "mta-helper.fx" //------------------------------------------------------------------------------ // File: BasicRender.fx // // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // Global variables //------------------------------------------------------------------------------ float4 g_MaterialAmbientColor = {0.05f, 0.05f, 0.05f, 0.05f}; // Material's ambient color float4 g_MaterialDiffuseColor = {0.75f, 0.75f, 0.75f, 0.75f}; // Material's diffuse color float3 g_LightPos = {1000, 2000, 1000}; // Position of light float3 g_LightDir = {0, 0, 0}; // Direction of light (temp) float4x4 g_mLightView; // View matrix of light float4x4 g_mLightProj; // Projection matrix of light float4 g_LightDiffuse = {0.75f, 0.75f, 0.75f, 0.75f}; // Light's diffuse color float4 g_LightAmbient = {0.05f, 0.05f, 0.05f, 0.05f}; // Light's ambient color texture g_MeshTexture; // Color texture for mesh texture g_ShadowMapTexture; // Shadow map texture for lighting float4x4 g_mWorld; // World matrix for object float3 g_CameraPos; // Camera position for scene View float4x4 g_mCameraView; // Camera's view matrix float4x4 g_mCameraProj; // Projection matrix //------------------------------------------------------------------------------ // Texture samplers //------------------------------------------------------------------------------ sampler MeshTextureSampler = sampler_state { Texture = (gTexture0); MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; }; sampler ShadowMapSampler = sampler_state { Texture = <g_ShadowMapTexture>; MinFilter = POINT; MagFilter = POINT; MipFilter = POINT; AddressU = Clamp; AddressV = Clamp; }; //------------------------------------------------------------------------------ // Vertex shader output structure //------------------------------------------------------------------------------ struct VS_OUTPUT { float4 Position : POSITION0; // vertex position float2 TextureUV : TEXCOORD0; // vertex texture coords float3 vNormal : TEXCOORD1; float4 vPos : TEXCOORD2; }; struct PS_INPUT { float2 TextureUV : TEXCOORD0; // vertex texture coords float3 vNormal : TEXCOORD1; float4 vPos : TEXCOORD2; }; struct VS_SHADOW_OUTPUT { float4 Position : POSITION; float Depth : TEXCOORD0; }; //------------------------------------------------------------------------------ // Utility function(s) //------------------------------------------------------------------------------ float4x4 CreateLookAt(float3 gView, float3 gProjection, float3 up) { float3 zaxis = normalize(gView - gProjection); float3 xaxis = normalize(cross(up, zaxis)); float3 yaxis = cross(zaxis, xaxis); float4x4 view = { xaxis.x, yaxis.x, zaxis.x, 0, xaxis.y, yaxis.y, zaxis.y, 0, xaxis.z, yaxis.z, zaxis.z, 0, -dot(xaxis, gView), -dot(yaxis, gView), -dot(zaxis, gView), 1 }; return view; } float4 GetPositionFromLight(float4 position) { float4x4 WorldViewProjection = mul(mul(gWorld, gLightDiffuse), gLightDirection); return mul(position, WorldViewProjection); } //------------------------------------------------------------------------------ // This shader computes rudimentary transform and lighting. // The XNA VertexDeclaration of our models is PositionNormalTexture. //------------------------------------------------------------------------------ VS_OUTPUT RenderShadowsVS( float3 position : POSITION, float3 normal : NORMAL, float2 vTexCoord0 : TEXCOORD0 ) { VS_OUTPUT Output; //generate the world-view-projection matrix float4x4 wvp = mul(mul(gWorld, gView), gProjection); //transform the input position to the output Output.Position = mul(float4(position, 1.0), wvp); //transform the normal to world space Output.vNormal = mul(normal, gWorld); //do not transform the position needed for the //shadow map determination Output.vPos = float4(position,1.0); //pass the texture coordinate as-is Output.TextureUV = vTexCoord0; //return the output structure return Output; } VS_SHADOW_OUTPUT RenderShadowMapVS(float4 vPos: POSITION) { VS_SHADOW_OUTPUT Out; Out.Position = GetPositionFromLight(vPos); // Depth is Z/W. This is returned by the pixel shader. // Subtracting from 1 gives us more precision in floating point. Out.Depth.x = 1-(Out.Position.z/Out.Position.w); return Out; } //------------------------------------------------------------------------------ // Pixel shader output structure //------------------------------------------------------------------------------ struct PS_OUTPUT { float4 RGBColor : COLOR0; // Pixel color }; //------------------------------------------------------------------------------ // This shader outputs the pixel's color by modulating the texture's // color with diffuse material color //------------------------------------------------------------------------------ PS_OUTPUT RenderShadowsPS( PS_INPUT In ) { PS_OUTPUT Output; // Standard lighting equation float4 vTotalLightDiffuse = float4(0.1f,0.1f,0.1f,0.1f); float3 lightDir = normalize(g_LightPos+In.vPos); // direction of light vTotalLightDiffuse += g_LightDiffuse * max(0,dot(In.vNormal, lightDir)); vTotalLightDiffuse.a = 0.5f; // Now, consult the ShadowMap to see if we're in shadow float4 lightingPosition = GetPositionFromLight(In.vPos);// Get our position on the shadow map // Get the shadow map depth value for this pixel float2 ShadowTexC = 0.5 * lightingPosition.xy / lightingPosition.w + float2( 0.5, 0.5 ); ShadowTexC.y = 1.0f - ShadowTexC.y; float shadowdepth = tex2D(ShadowMapSampler, ShadowTexC).r; // Check our value against the depth value float ourdepth = 1 + (lightingPosition.z / lightingPosition.w); // Check the shadowdepth against the depth of this pixel // a fudge factor is added to account for floating-point error if (shadowdepth-0.03 > ourdepth) { // we're in shadow, cut the light vTotalLightDiffuse = float4(0,0,0,1); }; Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * (vTotalLightDiffuse + g_LightAmbient); return Output; } PS_OUTPUT DiffuseOnlyPS(VS_OUTPUT In) : COLOR { PS_OUTPUT Output; //calculate per-pixel diffuse float3 directionToLight = normalize(g_LightPos - In.vPos); float diffuseIntensity = saturate( dot(directionToLight, In.vNormal)); float4 diffuse = g_LightDiffuse * diffuseIntensity; float4 color = diffuse + g_LightAmbient; color.a = 0.0; Output.RGBColor = tex2D(MeshTextureSampler, In.TextureUV) * color; return Output; } PS_OUTPUT TextureOnlyPS(float2 TextureUV : TEXCOORD0) : COLOR { PS_OUTPUT Output; Output.RGBColor = tex2D(MeshTextureSampler, TextureUV); return Output; } float4 RenderShadowMapPS( VS_SHADOW_OUTPUT In ) : COLOR { // The depth is Z divided by W. We return // this value entirely in a 32-bit red channel // using SurfaceFormat.Single. This preserves the // floating-point data for finer detail. return float4(In.Depth.x,0,0,1); } //------------------------------------------------------------------------------ // Renders scene to render target //------------------------------------------------------------------------------ technique TextureRender { pass P0 { VertexShader = compile vs_2_0 RenderShadowsVS(); PixelShader = compile ps_2_0 TextureOnlyPS(); } pass P1 { VertexShader = compile vs_2_0 RenderShadowsVS(); PixelShader = compile ps_2_0 RenderShadowsPS(); } pass P2 { // These render states are necessary to get a shadow map. // You should consider resetting CullMode and AlphaBlendEnable // before you render your main scene. CullMode = CW; ZEnable = TRUE; ZWriteEnable = TRUE; AlphaBlendEnable = TRUE; VertexShader = compile vs_2_0 RenderShadowMapVS(); PixelShader = compile ps_2_0 RenderShadowMapPS(); } } This is not the original .fx file, i configured it for MTA. The diffuse and the ambient light works correctly, but not generating shadows. Any Idea?
  25. -- client -- local displayWidth, displayHeight = guiGetScreenSize(); local notificationData = {}; local notificationFont = dxCreateFont('files/fonts/roboto.ttf', 12 * 2, false); local iconsFont = dxCreateFont('files/fonts/icons.ttf', 12 * 2, false); addEventHandler('onClientRender', root, function() for k, v in pairs(notificationData) do if (v.State == 'fadeIn') then local alphaProgress = (getTickCount() - v.AlphaTick) / 650; local alphaAnimation = interpolateBetween(0, 0, 0, 255, 0, 0, alphaProgress, 'Linear'); if (alphaAnimation) then v.Alpha = alphaAnimation; else v.Alpha = 255; end if (alphaProgress > 1) then v.Tick = getTickCount(); v.State = 'openTile'; end elseif (v.State == 'fadeOut') then local alphaProgress = (getTickCount() - v.AlphaTick) / 650; local alphaAnimation = interpolateBetween(255, 0, 0, 0, 0, 0, alphaProgress, 'Linear'); if (alphaAnimation) then v.Alpha = alphaAnimation; else v.Alpha = 0; end if (alphaProgress > 1) then notificationData = {}; end elseif (v.State == 'openTile') then local tileProgress = (getTickCount() - v.Tick) / 350; local tilePosition = interpolateBetween(v.StartX, 0, 0, v.EndX, 0, 0, tileProgress, 'Linear'); local tileWidth = interpolateBetween(0, 0, 0, v.Width, 0, 0, tileProgress, 'Linear'); if (tilePosition and tileWidth) then v.CurrentX = tilePosition; v.CurrentWidth = tileWidth; else v.CurrentX = v.EndX; v.CurrentWidth = v.Width; end if (tileProgress > 1) then v.State = 'fixTile'; setTimer(function() v.Tick = getTickCount(); v.State = 'closeTile'; end, string.len(v.Text) * 45 + 5000, 1); end elseif (v.State == 'closeTile') then local tileProgress = (getTickCount() - v.Tick) / 350; local tilePosition = interpolateBetween(v.EndX, 0, 0, v.StartX, 0, 0, tileProgress, 'Linear'); local tileWidth = interpolateBetween(v.Width, 0, 0, 0, 0, 0, tileProgress, 'Linear'); if (tilePosition and tileWidth) then v.CurrentX = tilePosition; v.CurrentWidth = tileWidth; else v.CurrentX = v.StartX; v.CurrentWidth = 0; end if (tileProgress > 1) then v.AlphaTick = getTickCount(); v.State = 'fadeOut'; end elseif (v.State == 'fixTile') then v.Alpha = 255; v.CurrentX = v.EndX; v.CurrentWidth = v.Width; end roundedRectangle(v.CurrentX, 20, 25 + v.CurrentWidth, 25, tocolor(0, 0, 0, 150 * v.Alpha / 255), _, true); dxDrawRectangle(v.CurrentX, 20, 25, 25, tocolor(0, 0, 0, 255 * v.Alpha / 255), true); if (v.Alpha == 255) then dxDrawText(v.Text, v.CurrentX + 25 + 10, 20, v.CurrentX + 25 + 10 + v.CurrentWidth - 20, 20 + 25, tocolor(255, 255, 255, 255), 0.40, notificationFont, 'center', 'center', true, false, true); end if (v.Type == 'error') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(215, 90, 90, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'warning') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(220, 180, 80, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'info') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(85, 180, 245, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); elseif (v.Type == 'success') then dxDrawText('', v.CurrentX + 5, 20, v.CurrentX + 5 + 25 - 10, 20 + 25, tocolor(80, 205, 105, v.Alpha), 0.50, iconsFont, 'center', 'center', false, false, true); end end end ) addEvent('addNotification', true); function addNotification(text, type) if (text and type) then if (notificationData ~= nil) then table.remove(notificationData, #notificationData); end table.insert(notificationData, { StartX = (displayWidth / 2) - (25 / 2), EndX = (displayWidth / 2) - ((dxGetTextWidth(text, 0.40, notificationFont) + 20 + 25) / 2), Text = text, Width = dxGetTextWidth(text, 0.40, notificationFont) + 20, Alpha = 0, State = 'fadeIn', Tick = 0, AlphaTick = getTickCount(), CurrentX = (displayWidth / 2) - (25 / 2), CurrentWidth = 0, Type = type or 'info' } ); playSoundFrontEnd(11); end end addEventHandler('addNotification', root, addNotification); function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 0, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, postGUI); --> Border dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right end end -- server -- function addNotification(player, text, type) if (player and text and type) then exports["notices"]:addNotification("Test","success"); triggerClientEvent(player, 'addNotification', player, text, type); end end addEventHandler("onResourceStart", addNotification, player, text, type)
×
×
  • Create New...