Jump to content

KariiiM

Members
  • Posts

    1,312
  • Joined

  • Last visited

Everything posted by KariiiM

  1. this is a undefined table and that makes no sense, I'm talking about what action you do for letting the window appears..
  2. This code is only for gui elements, where is the code that execute those elements ?
  3. So, in this case, you cannot edit a compiled script.
  4. --------------------------- -- My window --------------------------- local GUIEditor = { window = { }, button = { }, memo = { } } GiftWindow = guiCreateWindow(322, 223, 783, 193, "AJÁNDÉK PANEL | TELJESEN TURBESZ ÁLTAL", false) guiWindowSetSizable(GiftWindow, false) guiSetVisible (GiftWindow, false) guiSetProperty(GiftWindow, "CaptionColour", "FF00D655") button2 = guiCreateButton(9, 24, 126, 34, "HALHATATLANSÁG", false, GiftWindow) guiSetProperty(button2, "NormalTextColour", "FF2FFE00") button3 = guiCreateButton(9, 68, 126, 35, "AUTÓ HALHATATLANSÁG 1X", false, GiftWindow) guiSetProperty(button3, "NormalTextColour", "FF2FFE00") button33 = guiCreateButton(9, 110, 126, 32, "MINIGUN", false, GiftWindow) guiSetProperty(button33, "NormalTextColour", "FF2FFE00") button4 = guiCreateButton(10, 150, 125, 33, "TANK", false, GiftWindow) guiSetProperty(button4, "NormalTextColour", "FF2FFE00") button5 = guiCreateButton(143, 25, 131, 33, "SZÍNESÍRÁS", false, GiftWindow) guiSetProperty(button5, "NormalTextColour", "FFFEFFFE") button6 = guiCreateButton(143, 68, 131, 35, "FEGYVER CSOMAG", false, GiftWindow) guiSetProperty(button6, "NormalTextColour", "FFFEFFFE") button7 = guiCreateButton(144, 109, 130, 33, "LÁTHATATLANSÁG", false, GiftWindow) guiSetProperty(button7, "NormalTextColour", "FFFEFFFE") memo = guiCreateMemo(277, 25, 496, 117, "\nSzia, üdv a FullFunPlay Szerveren! \n\nEz a panel, egy MÁGIKUS!!! ISMÉTLEM MÁGIKUS PANEL!!! Csak nektek, turbesztől, a tulajtól. \n\nItt kiválaszthatsz több valamit, 12 óránként! \n\nJó szórakozást a panellel! \n\nUPDATE! #2016.07.29: Választhatsz színesírást!\n\nUPDATE! #2016.08.01: Láthatatlanság ki/be kapcsolható!\nGravity Gun szerzés 2 milláért.", false, GiftWindow) guiMemoSetReadOnly(memo, true) button = guiCreateButton(146, 152, 627, 31, "BEZÁRÁS BEZÁRÁS BEZÁRÁS BEZÁRÁS BEZÁRÁS", false, GiftWindow) guiSetProperty(button, "NormalTextColour", "FFFF0000") Try it
  5. If I am not wrong. you want to get the player's current position coordinations, right?
  6. local beszelget = { } local localPlayer = getLocalPlayer () local root = getRootElement () local w,h = guiGetScreenSize() local y = h-35-340 local gomb = guiCreateButton ( w*0.275,h-35, 100, 35, "Privát üzenetek", false ) guiSetAlpha ( gomb, 1 ) local options = { colorCode=false, chatbox=true, noti=true, bind=false, bindbutton="" } local players local img_default = { w=30, h=75, x=w*0.275 + 120, y=h} local img local speed_default = 0.09 local speed local hideTimer local refreshTimer local lastSearch = "" local backTimer local wrongTable = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse_wheel_up", "mouse_wheel_down", "arrow_l", "arrow_u", "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "backspace", "tab", "lalt", "ralt", "enter", "space", "pgup", "pgdn", "end", "home", "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" } local keyTable = {} function togglePM ( ) if isElement ( ablak ) then if guiGetVisible ( ablak ) then guiSetVisible ( ablak, false ) guiSetInputEnabled(false) else guiSetVisible ( ablak, true ) end end end function loadSettings () for i, v in ipairs ( wrongTable ) do keyTable[ v ] = true end if fileExists ( "settings.xml" ) then local file = xmlLoadFile ( "settings.xml" ) for i, v in ipairs ( xmlNodeGetChildren ( file ) ) do if xmlNodeGetValue ( v ) == "true" or xmlNodeGetValue ( v ) == "false" then options [ xmlNodeGetName ( v ) ] = loadstring ( "return " .. xmlNodeGetValue ( v ) )() else options [ xmlNodeGetName ( v ) ] = xmlNodeGetValue ( v ) end end if options.bind then bindWindowTo ( options.bindbutton ) end xmlUnloadFile ( file ) end end function saveSettings () local file = xmlLoadFile ( "settings.xml" ) or xmlCreateFile ( "settings.xml", "settings" ) for k, v in pairs ( options ) do local child = xmlFindChild ( file, k, 0 ) or xmlCreateChild ( file, k ) xmlNodeSetValue ( child, tostring(v) ) end xmlSaveFile ( file ) xmlUnloadFile ( file ) end function bindWindowTo ( button ) if keyTable[ button ] then guiSetText ( bindedit, button ) if options.bindbutton and options.bindbutton ~= "" then unbindKey ( options.bindbutton, "down", togglePM ) end bindKey ( button, "down", togglePM ) options.bindbutton = button else guiSetText ( bindedit, options.bindbutton ) end end function refreshList ( ) local name = guiGetText ( keres ) if name ~= lastSearch then lastSearch = name for i, v in pairs(players) do if string.find(v.name:lower(), tostring(name):lower(), 1, true) then v.hide = false else v.hide = true end end reCreateNameList ( true ) end end addEventHandler ( "onClientResourceStop", resourceRoot, saveSettings ) function onClick ( ) --outputChatBox ( "a: " .. tostring(guiGetInputEnabled()) ) if source ~= keres and isTimer ( refreshTimer ) then killTimer ( refreshTimer ) lastSearch = "" end if source == keres then if guiGetText ( keres ) == "Keresés" then guiSetText(keres,"") end guiSetInputEnabled ( true ) if not isTimer ( refreshTimer ) then refreshTimer = setTimer ( refreshList, 1000, 0 ) end elseif source == grid then local r, c = guiGridListGetSelectedItem(grid) if r and r ~= -1 then kezoOldal ( false ) local player = guiGridListGetItemData(grid,r,1) if beszelget[player] then guiSetText(memo,beszelget[player]) guiMemoSetCaretIndex(memo,string.len(guiGetText(memo))-1) end end elseif source == kuld then --outputChatBox ( "b: " .. tostring(guiGetInputEnabled()) ) local text = guiGetText(msg) if text == "" then guiSetInputEnabled(false) end local r, c = guiGridListGetSelectedItem(grid) if text and r and text ~= "" and r ~= -1 then local player = guiGridListGetItemData(grid,r,1) if not beszelget[player] then beszelget[player] = players [ localPlayer ].name .. ": "..text kijelol(player) else beszelget[player] = beszelget[player] .."\n".. players [ localPlayer ].name .. ": "..text end local leng = string.len(beszelget[player]) if leng > 3000 then beszelget[player] = string.sub(beszelget[player], leng-3000) end guiSetText(msg,"") if string.len(guiGetText ( memo ) ) <= 1 then guiSetText(memo,players [ localPlayer ].name .. ": "..text) else guiSetText(memo,guiGetText(memo)..players [ localPlayer ].name .. ": "..text) end if options.chatbox then outputChatBox ( "-> " .. players [ player ].name .. ": "..text, 255, 170, 0 ) end guiMemoSetCaretIndex(memo,string.len(guiGetText(memo))-1) guiBringToFront(msg) guiSetInputEnabled(true) triggerServerEvent("uzenet",getLocalPlayer(),player,text) --outputChatBox ( "c: " .. tostring(guiGetInputEnabled()) ) end elseif source == msg then guiSetInputEnabled(true) elseif source == color then options.colorCode = not guiCheckBoxGetSelected ( color ) reCreateNameList () elseif source == chatbox then options.chatbox = guiCheckBoxGetSelected ( chatbox ) elseif source == noti then options.noti = guiCheckBoxGetSelected ( noti ) elseif source == bind then if guiCheckBoxGetSelected ( bind ) then guiSetEnabled ( bindedit, true ) else guiSetText ( bindedit, options.bindbutton or "" ) guiSetEnabled ( bindedit, false ) end options.bind = guiCheckBoxGetSelected ( bind ) if options.bind then bindWindowTo ( options.bindbutton ) elseif options.bindbutton and options.bindbutton ~= "" then unbindKey ( options.bindbutton, "down", togglePM ) end elseif source == bindedit then guiSetInputEnabled ( true ) elseif source ~= memo then kezoOldal ( true ) end end function draw ( time ) if img.y >= h - img.h then img.y = img.y - (time * speed ) end dxDrawImage ( img.x, img.y, img.w, img.h, "fl.png" ) end function startAnim ( state ) if state == nil then state = true end if state == true then img = img_default speed = speed_default if isTimer ( hideTimer ) then killTimer ( hideTimer ) elseif isTimer ( backTimer ) then killTimer ( backTimer ) end if not drawing then addEventHandler ( "onClientPreRender", root, draw ) drawing = true end backTimer = setTimer ( startAnim, 5000, 1, "back" ) elseif state == "back" and drawing then speed = -1 * speed img.y = img.y + ( h - img.h - img.y ) hideTimer = setTimer ( startAnim, 2100, 1, false ) elseif drawing then removeEventHandler ( "onClientPreRender", root, draw ) drawing = false end end addEvent("uzenet_jott",true) addEventHandler("uzenet_jott",getRootElement(), function(_,text) local r, c = guiGridListGetSelectedItem(grid) local player if text and r and text ~= "" and r ~= -1 then player = guiGridListGetItemData(grid,r,1) end if player ~= source or not guiGetVisible(ablak) then guiSetText(gomb,"Privát üenetek\n ( Új üzenet! )") end if options.chatbox then outputChatBox ( "* PM from " .. players [ source ].name .. ": ".. text, 255, 100, 100 ) end if options.noti and not guiGetVisible ( ablak ) then startAnim () end text = "> ".. players [ source ].name .. ": "..text if not beszelget[source] then beszelget[source] = text kivesz(source) local row = guiGridListInsertRowAfter(grid,-1) guiGridListSetItemText(grid,row,column,players [ source ].name,false,false) guiGridListSetItemColor(grid,0,1,10,200,255) guiGridListSetItemData ( grid, row, 1, source ) else beszelget[source] = beszelget[source] .."\n".. text end if player == source then guiSetText(memo,guiGetText(memo)..text) guiMemoSetCaretIndex(memo,string.len(guiGetText(memo))-1) end if guiGetVisible ( msg ) then guiSetInputEnabled(true) end end) function onClick_gomb ( ) guiSetText(gomb,"Privát üzenetek") startAnim ( false ) togglePM ( ) end addEventHandler ( "onClientGUIClick", gomb, onClick_gomb) addEventHandler("onClientPlayerJoin",getRootElement(), function(arg) if grid and isElement(grid) then local row = guiGridListInsertRowAfter ( grid, guiGridListGetRowCount ( grid ) ) guiGridListSetItemData ( grid, row, 1, source ) players[ source ] = { name=options.colorCode and getPlayerName(source) or string.gsub(getPlayerName ( source ), '#%x%x%x%x%x%x', ''), blue=false } guiGridListSetItemText(grid,row,column,players [ source ].name, false,false) end end) addEventHandler( "onClientPlayerQuit", getRootElement(), function() kivesz(source) players[ source ] = nil end) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), function ( regi, uj) if grid and isElement(grid) then -- outputChatBox("nev") for i = 0, guiGridListGetRowCount(grid) do if guiGridListGetItemData(grid,i,1) == source then players[ source ].name = options.colorCode and getPlayerName(source) or string.gsub(getPlayerName ( source ), '#%x%x%x%x%x%x', '') guiGridListSetItemText(grid,i,1, players[ source ].name,false,false) end end end end ) function kivesz(player) if grid and isElement(grid) then for i = 0, guiGridListGetRowCount(grid) do if guiGridListGetItemData(grid,i,1) == player then guiGridListRemoveRow(grid,i,1) break end end end end function kijelol(player) if grid and isElement(grid) then players[ player ].blue = true kivesz ( player ) local row = guiGridListInsertRowAfter ( grid, -1, 1 ) guiGridListSetItemText(grid,row,1,players[ player ].name,false,false) guiGridListSetItemColor(grid,row,1,10,200,255) guiGridListSetItemData ( grid, row, 1, player ) guiGridListSetSelectedItem ( grid, row, 1 ) --triggerEvent("onClientGUIClick",grid) end end function reCreateNameList ( noRescan ) guiGridListClear ( grid ) if not noRescan or not players then players = {} lastSearch = "" for i, v in ipairs(getElementsByType("player")) do --if v ~= localPlayer then players[ v ] = { name=options.colorCode and getPlayerName ( v ) or string.gsub(getPlayerName ( v ), '#%x%x%x%x%x%x', ''), blue=beszelget[v] and true or false } --end end end for k, v in pairs ( players ) do if not v.hide then if not v.blue then local row = guiGridListAddRow(grid) guiGridListSetItemText ( grid, row, column, v.name, false, false) guiGridListSetItemData ( grid, row, column, k ) else local row = guiGridListInsertRowAfter(grid, 0) guiGridListSetItemText ( grid, row, column, v.name, false, false) guiGridListSetItemColor(grid,row,column,10,200,255) guiGridListSetItemData ( grid, row, column, k ) end end end end function kezoOldal ( state ) if state then guiSetText ( memo, "Légy üdvözölve kedves Játékos!\n\nVálassz egy nevet oldalról a listából akivel beszélgetni szeretnél, és írj neki!\nHa úgy szeretnél a rendes chat-be írni, hogy közben ez az ablak is nyitva van, nyomj úgy entert vagy kattints a Küldés gombra, hogy nincs beí­rva üzenet. Ezután írhatsz (t-vel általában...) a chatbox-ba, majd ide visszakattintva újra ide." ) guiSetSize ( memo, 0.75, 0.40, true ) guiSetInputEnabled ( false ) else guiSetSize ( memo, 0.75, 0.7324, true ) guiSetText ( memo, "" ) end guiSetVisible ( color, state ) guiSetVisible ( chatbox, state ) guiSetVisible ( noti, state ) guiSetVisible ( bind, state ) guiSetVisible ( bindedit, state ) guiSetVisible ( kuld, not state ) guiSetVisible ( msg, not state ) guiSetVisible ( help, state) end function init() ablak = guiCreateWindow ( w*0.275, y, 550, 340, "PM ablak", false ) guiSetVisible(ablak,false) guiWindowSetMovable( ablak, false ) guiWindowSetSizable( ablak, false ) grid = guiCreateGridList ( 0.017, 0.0706, 0.1989, 0.8265, true, ablak ) guiGridListSetSortingEnabled(grid,false) guiGridListSetSelectionMode ( grid, 2 ) bindedit = guiCreateEdit(128, 296, 130, 23, options.bindbutton, false, ablak) guiEditSetMaxLength ( bindedit, 16 ) loadSettings () column = guiGridListAddColumn ( grid, "Játékosok", 1.2 ) reCreateNameList ( ) keres = guiCreateEdit ( 0.017, 0.9176, 0.1989, 0.0559, "Keresés", true, ablak ) --guiSetEnabled(keres, false) help = guiCreateLabel ( 0.2348, 0.0765, 0.7311, 0.0706, "Válassz egy játékost, akivel beszélgetni szeretnél. Akivel már van megkezdett beszélgetésed, azt a lista elején, kék szí­nnel kiemelve találod.", true, ablak ) guiLabelSetHorizontalAlign ( help, "left", true ) guiSetFont ( help, "default-small" ) memo = guiCreateMemo(0.23, 0.16, 0.75, 0.40, "Légy üdvözölve kedves Játékos!\n\nVálassz egy nevet oldalról a listából akivel beszélgetni szeretnél, és írj neki!\nHa úgy szeretnél a rendes chat-be írni, hogy közben ez az ablak is nyitva van, nyomj úgy entert vagy kattints a Küldés gombra, hogy nincs beí­rva üzenet. Ezután írhatsz (t-vel általában...) a chatbox-ba, majd ide visszakattintva újra ide.", true, ablak) guiMemoSetReadOnly ( memo, true ) color = guiCreateCheckBox(0.23, 0.59, 0.69, 0.04, "Színkodok elrejtése a nevekben (Hide color codes in names)", true, true, ablak) guiCheckBoxSetSelected ( color, not options.colorCode ) chatbox = guiCreateCheckBox(0.23, 0.66, 0.69, 0.04, "Üzenet kiírása a chatboxba (Output messages to the chatbox)", true, true, ablak) guiCheckBoxSetSelected ( chatbox,options.chatbox ) noti = guiCreateCheckBox(0.23, 0.74, 0.68, 0.04, "Feltűnőbb üzenetjelző használata (More visible notification)", true, true, ablak) guiCheckBoxSetSelected ( noti, options.noti ) bind = guiCreateCheckBox(0.23, 0.81, 0.71, 0.04, "Ablak megnyitása a következő gombbal (Bind opening this window)", true, true, ablak) guiCheckBoxSetSelected ( bind, options.bind ) help = guiCreateLabel ( 260, 300, 270, 25, "Nyomj entert a mentéshez (Press enter to save)", false, ablak ) guiSetEnabled ( bindedit, options.bind ) msg = guiCreateEdit ( 0.2292, 0.9147, 0.6364, 0.0588, "", true, ablak ) guiEditSetMaxLength ( msg, 128 ) kuld = guiCreateButton ( 0.8693, 0.9059, 0.1136, 0.0676, "Küldés", true, ablak ) kezoOldal ( true ) addEventHandler( "onClientGUIAccepted", root, function( theElement ) if theElement == msg then --guiSetInputEnabled ( false ) guiBringToFront ( msg ) triggerEvent("onClientGUIClick",kuld) elseif theElement == bindedit then local text = guiGetText ( bindedit ) if text then guiSetInputEnabled ( false ) guiMoveToBack ( bindedit ) bindWindowTo ( text ) end end end ) addEventHandler ( "onClientGUIClick", ablak, onClick, true) end addEventHandler("onClientResourceStart",getResourceRootElement(),init) addCommandHandler ( "pm", togglePM ) Try this code now, and tell me the results to let me know, it should works
  7. local beszelget = { } local localPlayer = getLocalPlayer () local root = getRootElement () local w,h = guiGetScreenSize() local y = h-35-340 local gomb = guiCreateButton ( w*0.275,h-35, 100, 35, "Privát üzenetek", false ) guiSetAlpha ( gomb, 1 ) local options = { colorCode=false, chatbox=true, noti=true, bind=false, bindbutton="" } local players local img_default = { w=30, h=75, x=w*0.275 + 120, y=h} local img local speed_default = 0.09 local speed local hideTimer local refreshTimer local lastSearch = "" local backTimer local wrongTable = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse_wheel_up", "mouse_wheel_down", "arrow_l", "arrow_u", "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "backspace", "tab", "lalt", "ralt", "enter", "space", "pgup", "pgdn", "end", "home", "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" } local keyTable = {} function togglePM ( ) if isElement ( ablak ) then if guiGetVisible ( ablak ) then guiSetVisible ( ablak, false ) guiSetInputEnabled(false) else guiSetVisible ( ablak, true ) end end end function loadSettings () for i, v in ipairs ( wrongTable ) do keyTable[ v ] = true end if fileExists ( "settings.xml" ) then local file = xmlLoadFile ( "settings.xml" ) for i, v in ipairs ( xmlNodeGetChildren ( file ) ) do if xmlNodeGetValue ( v ) == "true" or xmlNodeGetValue ( v ) == "false" then options [ xmlNodeGetName ( v ) ] = loadstring ( "return " .. xmlNodeGetValue ( v ) )() else options [ xmlNodeGetName ( v ) ] = xmlNodeGetValue ( v ) end end if options.bind then bindWindowTo ( options.bindbutton ) end xmlUnloadFile ( file ) end end function saveSettings () local file = xmlLoadFile ( "settings.xml" ) or xmlCreateFile ( "settings.xml", "settings" ) for k, v in pairs ( options ) do local child = xmlFindChild ( file, k, 0 ) or xmlCreateChild ( file, k ) xmlNodeSetValue ( child, tostring(v) ) end xmlSaveFile ( file ) xmlUnloadFile ( file ) end function bindWindowTo ( button ) if keyTable[ button ] then guiSetText ( bindedit, button ) if options.bindbutton and options.bindbutton ~= "" then unbindKey ( options.bindbutton, "down", togglePM ) end bindKey ( button, "down", togglePM ) options.bindbutton = button else guiSetText ( bindedit, options.bindbutton ) end end function refreshList ( ) local name = guiGetText ( keres ) if name ~= lastSearch then lastSearch = name for i, v in pairs(players) do if string.find(v.name:lower(), tostring(name):lower(), 1, true) then v.hide = false else v.hide = true end end reCreateNameList ( true ) end end addEventHandler ( "onClientResourceStop", resourceRoot, saveSettings ) function onClick ( ) --outputChatBox ( "a: " .. tostring(guiGetInputEnabled()) ) if source ~= keres and isTimer ( refreshTimer ) then killTimer ( refreshTimer ) lastSearch = "" end if source == keres then if guiGetText ( keres ) == "Keresés" then guiSetText(keres,"") end guiSetInputEnabled ( true ) if not isTimer ( refreshTimer ) then refreshTimer = setTimer ( refreshList, 1000, 0 ) end elseif source == grid then local r, c = guiGridListGetSelectedItem(grid) if r and r ~= -1 then kezoOldal ( false ) local player = guiGridListGetItemData(grid,r,1) if beszelget[player] then guiSetText(memo,beszelget[player]) guiMemoSetCaretIndex(memo,string.len(guiGetText(memo))-1) end end elseif source == kuld then --outputChatBox ( "b: " .. tostring(guiGetInputEnabled()) ) local text = guiGetText(msg) if text == "" then guiSetInputEnabled(false) end local r, c = guiGridListGetSelectedItem(grid) if text and r and text ~= "" and r ~= -1 then local player = guiGridListGetItemData(grid,r,1) if not beszelget[player] then beszelget[player] = players [ localPlayer ].name .. ": "..text kijelol(player) else beszelget[player] = beszelget[player] .."\n".. players [ localPlayer ].name .. ": "..text end local leng = string.len(beszelget[player]) if leng > 3000 then beszelget[player] = string.sub(beszelget[player], leng-3000) end guiSetText(msg,"") if string.len(guiGetText ( memo ) ) <= 1 then guiSetText(memo,players [ localPlayer ].name .. ": "..text) else guiSetText(memo,guiGetText(memo)..players [ localPlayer ].name .. ": "..text) end if options.chatbox then outputChatBox ( "-> " .. players [ player ].name .. ": "..text, 255, 170, 0 ) end guiMemoSetCaretIndex(memo,string.len(guiGetText(memo))-1) guiBringToFront(msg) guiSetInputEnabled(true) triggerServerEvent("uzenet",getLocalPlayer(),player,text) --outputChatBox ( "c: " .. tostring(guiGetInputEnabled()) ) end elseif source == msg then guiSetInputEnabled(true) elseif source == color then options.colorCode = not guiCheckBoxGetSelected ( color ) reCreateNameList () elseif source == chatbox then options.chatbox = guiCheckBoxGetSelected ( chatbox ) elseif source == noti then options.noti = guiCheckBoxGetSelected ( noti ) elseif source == bind then if guiCheckBoxGetSelected ( bind ) then guiSetEnabled ( bindedit, true ) else guiSetText ( bindedit, options.bindbutton or "" ) guiSetEnabled ( bindedit, false ) end options.bind = guiCheckBoxGetSelected ( bind ) if options.bind then bindWindowTo ( options.bindbutton ) elseif options.bindbutton and options.bindbutton ~= "" then unbindKey ( options.bindbutton, "down", togglePM ) end elseif source == bindedit then guiSetInputEnabled ( true ) elseif source ~= memo then kezoOldal ( true ) end end function draw ( time ) if img.y >= h - img.h then img.y = img.y - (time * speed ) end dxDrawImage ( img.x, img.y, img.w, img.h, "fl.png" ) end function startAnim ( state ) if state == nil then state = true end if state == true then img = img_default speed = speed_default if isTimer ( hideTimer ) then killTimer ( hideTimer ) elseif isTimer ( backTimer ) then killTimer ( backTimer ) end if not drawing then addEventHandler ( "onClientPreRender", root, draw ) drawing = true end backTimer = setTimer ( startAnim, 5000, 1, "back" ) elseif state == "back" and drawing then speed = -1 * speed img.y = img.y + ( h - img.h - img.y ) hideTimer = setTimer ( startAnim, 2100, 1, false ) elseif drawing then removeEventHandler ( "onClientPreRender", root, draw ) drawing = false end end addEvent("uzenet_jott",true) addEventHandler("uzenet_jott",getRootElement(), function ( text ) if ( type ( text ) ~= "string" ) then text = tostring ( text ) end local r, c = guiGridListGetSelectedItem(grid) local player if text and r and text ~= "" and r ~= -1 then player = guiGridListGetItemData(grid,r,1) end if player ~= source or not guiGetVisible(ablak) then guiSetText(gomb,"Privát üenetek\n ( Új üzenet! )") end if options.chatbox then outputChatBox ( "* PM from " .. players [ source ].name .. ": ".. text, 255, 100, 100 ) end if options.noti and not guiGetVisible ( ablak ) then startAnim () end text = "> ".. players [ source ].name .. ": "..text if not beszelget[source] then beszelget[source] = text kivesz(source) local row = guiGridListInsertRowAfter(grid,-1) guiGridListSetItemText(grid,row,column,players [ source ].name,false,false) guiGridListSetItemColor(grid,0,1,10,200,255) guiGridListSetItemData ( grid, row, 1, source ) else beszelget[source] = beszelget[source] .."\n".. text end if player == source then guiSetText(memo,guiGetText(memo)..text) guiMemoSetCaretIndex(memo,string.len(guiGetText(memo))-1) end if guiGetVisible ( msg ) then guiSetInputEnabled(true) end end) function onClick_gomb ( ) guiSetText(gomb,"Privát üzenetek") startAnim ( false ) togglePM ( ) end addEventHandler ( "onClientGUIClick", gomb, onClick_gomb) addEventHandler("onClientPlayerJoin",getRootElement(), function(arg) if grid and isElement(grid) then local row = guiGridListInsertRowAfter ( grid, guiGridListGetRowCount ( grid ) ) guiGridListSetItemData ( grid, row, 1, source ) players[ source ] = { name=options.colorCode and getPlayerName(source) or string.gsub(getPlayerName ( source ), '#%x%x%x%x%x%x', ''), blue=false } guiGridListSetItemText(grid,row,column,players [ source ].name, false,false) end end) addEventHandler( "onClientPlayerQuit", getRootElement(), function() kivesz(source) players[ source ] = nil end) addEventHandler ( "onClientPlayerChangeNick", getRootElement(), function ( regi, uj) if grid and isElement(grid) then -- outputChatBox("nev") for i = 0, guiGridListGetRowCount(grid) do if guiGridListGetItemData(grid,i,1) == source then players[ source ].name = options.colorCode and getPlayerName(source) or string.gsub(getPlayerName ( source ), '#%x%x%x%x%x%x', '') guiGridListSetItemText(grid,i,1, players[ source ].name,false,false) end end end end ) function kivesz(player) if grid and isElement(grid) then for i = 0, guiGridListGetRowCount(grid) do if guiGridListGetItemData(grid,i,1) == player then guiGridListRemoveRow(grid,i,1) break end end end end function kijelol(player) if grid and isElement(grid) then players[ player ].blue = true kivesz ( player ) local row = guiGridListInsertRowAfter ( grid, -1, 1 ) guiGridListSetItemText(grid,row,1,players[ player ].name,false,false) guiGridListSetItemColor(grid,row,1,10,200,255) guiGridListSetItemData ( grid, row, 1, player ) guiGridListSetSelectedItem ( grid, row, 1 ) --triggerEvent("onClientGUIClick",grid) end end function reCreateNameList ( noRescan ) guiGridListClear ( grid ) if not noRescan or not players then players = {} lastSearch = "" for i, v in ipairs(getElementsByType("player")) do --if v ~= localPlayer then players[ v ] = { name=options.colorCode and getPlayerName ( v ) or string.gsub(getPlayerName ( v ), '#%x%x%x%x%x%x', ''), blue=beszelget[v] and true or false } --end end end for k, v in pairs ( players ) do if not v.hide then if not v.blue then local row = guiGridListAddRow(grid) guiGridListSetItemText ( grid, row, column, v.name, false, false) guiGridListSetItemData ( grid, row, column, k ) else local row = guiGridListInsertRowAfter(grid, 0) guiGridListSetItemText ( grid, row, column, v.name, false, false) guiGridListSetItemColor(grid,row,column,10,200,255) guiGridListSetItemData ( grid, row, column, k ) end end end end function kezoOldal ( state ) if state then guiSetText ( memo, "Légy üdvözölve kedves Játékos!\n\nVálassz egy nevet oldalról a listából akivel beszélgetni szeretnél, és írj neki!\nHa úgy szeretnél a rendes chat-be írni, hogy közben ez az ablak is nyitva van, nyomj úgy entert vagy kattints a Küldés gombra, hogy nincs beí­rva üzenet. Ezután írhatsz (t-vel általában...) a chatbox-ba, majd ide visszakattintva újra ide." ) guiSetSize ( memo, 0.75, 0.40, true ) guiSetInputEnabled ( false ) else guiSetSize ( memo, 0.75, 0.7324, true ) guiSetText ( memo, "" ) end guiSetVisible ( color, state ) guiSetVisible ( chatbox, state ) guiSetVisible ( noti, state ) guiSetVisible ( bind, state ) guiSetVisible ( bindedit, state ) guiSetVisible ( kuld, not state ) guiSetVisible ( msg, not state ) guiSetVisible ( help, state) end function init() ablak = guiCreateWindow ( w*0.275, y, 550, 340, "PM ablak", false ) guiSetVisible(ablak,false) guiWindowSetMovable( ablak, false ) guiWindowSetSizable( ablak, false ) grid = guiCreateGridList ( 0.017, 0.0706, 0.1989, 0.8265, true, ablak ) guiGridListSetSortingEnabled(grid,false) guiGridListSetSelectionMode ( grid, 2 ) bindedit = guiCreateEdit(128, 296, 130, 23, options.bindbutton, false, ablak) guiEditSetMaxLength ( bindedit, 16 ) loadSettings () column = guiGridListAddColumn ( grid, "Játékosok", 1.2 ) reCreateNameList ( ) keres = guiCreateEdit ( 0.017, 0.9176, 0.1989, 0.0559, "Keresés", true, ablak ) --guiSetEnabled(keres, false) help = guiCreateLabel ( 0.2348, 0.0765, 0.7311, 0.0706, "Válassz egy játékost, akivel beszélgetni szeretnél. Akivel már van megkezdett beszélgetésed, azt a lista elején, kék szí­nnel kiemelve találod.", true, ablak ) guiLabelSetHorizontalAlign ( help, "left", true ) guiSetFont ( help, "default-small" ) memo = guiCreateMemo(0.23, 0.16, 0.75, 0.40, "Légy üdvözölve kedves Játékos!\n\nVálassz egy nevet oldalról a listából akivel beszélgetni szeretnél, és írj neki!\nHa úgy szeretnél a rendes chat-be írni, hogy közben ez az ablak is nyitva van, nyomj úgy entert vagy kattints a Küldés gombra, hogy nincs beí­rva üzenet. Ezután írhatsz (t-vel általában...) a chatbox-ba, majd ide visszakattintva újra ide.", true, ablak) guiMemoSetReadOnly ( memo, true ) color = guiCreateCheckBox(0.23, 0.59, 0.69, 0.04, "Színkodok elrejtése a nevekben (Hide color codes in names)", true, true, ablak) guiCheckBoxSetSelected ( color, not options.colorCode ) chatbox = guiCreateCheckBox(0.23, 0.66, 0.69, 0.04, "Üzenet kiírása a chatboxba (Output messages to the chatbox)", true, true, ablak) guiCheckBoxSetSelected ( chatbox,options.chatbox ) noti = guiCreateCheckBox(0.23, 0.74, 0.68, 0.04, "Feltűnőbb üzenetjelző használata (More visible notification)", true, true, ablak) guiCheckBoxSetSelected ( noti, options.noti ) bind = guiCreateCheckBox(0.23, 0.81, 0.71, 0.04, "Ablak megnyitása a következő gombbal (Bind opening this window)", true, true, ablak) guiCheckBoxSetSelected ( bind, options.bind ) help = guiCreateLabel ( 260, 300, 270, 25, "Nyomj entert a mentéshez (Press enter to save)", false, ablak ) guiSetEnabled ( bindedit, options.bind ) msg = guiCreateEdit ( 0.2292, 0.9147, 0.6364, 0.0588, "", true, ablak ) guiEditSetMaxLength ( msg, 128 ) kuld = guiCreateButton ( 0.8693, 0.9059, 0.1136, 0.0676, "Küldés", true, ablak ) kezoOldal ( true ) addEventHandler( "onClientGUIAccepted", root, function( theElement ) if theElement == msg then --guiSetInputEnabled ( false ) guiBringToFront ( msg ) triggerEvent("onClientGUIClick",kuld) elseif theElement == bindedit then local text = guiGetText ( bindedit ) if text then guiSetInputEnabled ( false ) guiMoveToBack ( bindedit ) bindWindowTo ( text ) end end end ) addEventHandler ( "onClientGUIClick", ablak, onClick, true) end addEventHandler("onClientResourceStart",getResourceRootElement(),init) addCommandHandler ( "pm", togglePM )
  8. I did a change for text scale, just try what I posted it should do the job.
  9. local sWidth, sHeight = guiGetScreenSize ( ) local sx, sy = sWidth/1280, sHeight/720 addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle ( sx*506, sy*616, sx*297, sy*76, tocolor ( 0, 0, 0, 133 ), true ) dxDrawText ( "Team 1 Score: 0", sx*556, sy*626, sx*793, sy*650, tocolor ( 255, 255, 255, 255 ), sx*0.80, "bankgothic", "left", "top", false, false, true, false, false ) dxDrawText ( "Team 2 Score: 0", sx*556, sy*658, sx*793, sy*682, tocolor ( 255, 255, 255, 255 ), sx*0.80, "bankgothic", "left", "top", false, false, true, false, false ) end )
  10. Using varialbe instead of table, will receive only one player, with table you can get more players in order, as I did for you, anyway you have the choice to choose what you need.
  11. Why did not you upload your resource on the community? I see It better
  12. Also, the Ped variable was not gonna be triggered since it was inside a function.
  13. local Ped = createPed ( 287, 0, 0, 3 ) local Vehicle = createVehicle ( 487, 1290.68958, -785.93646, 96.55399 ) setVehicleColor( Vehicle, 0, 0, 0, 0, 250, 250 ) setTimer ( warpPedIntoVehicle, 200, 1, Ped, Vehicle ) function fly ( ) local theVeh = getPedOccupiedVehicle ( Ped ) if ( theVeh ) then setPedControlState ( Ped, "steer_back", true ) end end
  14. You need to create a ped to let the function setPedControlState works.
  15. KariiiM

    WarZone

    No, the only way is to learn how to script
  16. function cv() local Ped = createPed ( 287, 0, 0, 3 ) local Vehicle = createVehicle ( 487, 1290.68958, -785.93646, 96.55399 ) setVehicleColor( Vehicle, 0, 0, 0, 0, 250, 250 ) setTimer ( warpPedIntoVehicle, 200, 1, Ped, Vehicle ) end addEventHandler ("onResourceStart", resourceRoot, cv )
  17. KariiiM

    WarZone

    What do you mean by easily way?
  18. KariiiM

    WarZone

    You need to use a file editor such as notepad++ then put the scripted files into your server. read this topic, https://wiki.multitheftauto.com/wiki/Scripting_Introduction
  19. KariiiM

    WarZone

    You have to script that, https://wiki.multitheftauto.com/wiki/CreateColRectangle
  20. KariiiM

    WarZone

    You can create a zone using createColRectangle then you can continue scripting your ideas on it.
×
×
  • Create New...