Jump to content

Search the Community

Showing results for tags 'gridlist'.

  • 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

Found 10 results

  1. function dxGridList( x, y, w, h, parent) local self, element = createElement( 'dxGridList', parent, sourceResource ) if self then self.x = math.round(x) self.y = math.round(y) self.w = math.round(w) self.h = math.round(h) self.parent = parent self.colorbackground = tocolor( 20, 20, 30, 255 ) self.colortext = tocolor(255, 255, 255, 255) self.colorselected = tocolor(120, 95, 205, 255) if self.parent then self.offsetX = self.x - Cache[self.parent].x self.offsetY = self.y - Cache[self.parent].y end self.font = Files['font']['Basic-Regular'][10] self.fontH = dxGetFontHeight( 1, self.font ) -- self.scrollV = dxScroll(self.x+self.w-math.round(17*sh), self.y, self.h, true, parent) self.scrollH = dxScroll(self.x, self.y+self.h-math.round(17*sh), self.w-math.round(17*sh), false, parent) Cache[self.scrollH].isVisible = false Cache[self.scrollV].isVisible = false Cache[self.scrollV].gridlist = element self.from = nil self.to = nil self.mul = 0 self.columns = {} self.items = {} self.scrollX = 0 self.scrollY = 0 -- self.selected = -1 self.update = true Timer(function() self.update = true end, 600, 1) Timer(function() self.update = true end, 1200, 1) return element end end function dxGridListAddItem(element, ...) local self = Cache[element] if self then table.insert(self.items, {...}) self.update2 = true return true end return false end function dxGridListRemoveItem(element, index) local self = Cache[element] if self then if self.items[index] then table.remove(self.items, index) self.update2 = true return true end end return false end function dxGridListAddColumn(element, name, size) local self = Cache[element] if self then table.insert(self.columns, {name, size}) self.update = true return name end return false end -------- My Code function dxGridListSetItemText(element, columns, name) if self.items[columns] and self.items[columns][element] then self.items[columns][element].text = text end end How can i make setItemText for this grid , i tryed but it's not work.
  2. I was bored and long time without do any script so I started looking in the wiki some functions what I not used yet and I found dxDrawMaterialLine3D. You have a video and code about a scoreboard what I made for test this function. Maybe this can be useful for you ( take scrollbar, etc ). Client-Side code:
  3. SERVER: MarkerGuardar = createMarker (359.159, 207.26, 1007.383, "cylinder", 1.5, 255,255,255,50) setElementInterior(MarkerGuardar, 3) setElementDimension(MarkerGuardar, 1) function AbrirPainelGUI(player) triggerClientEvent(player,"showHide", root) end addEventHandler("onMarkerHit", MarkerGuardar, AbrirPainelGUI) CLIENT: GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(773, 341, 369, 442, "Guardar Armas", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) centerGUI(GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(785, 740, 134, 33, "Guardar", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(998, 740, 134, 33, "Fechar", false, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(781, 370, 351, 362, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Armas", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Munição", 0.5) end ) function Abrir() if guiGetVisible(GUIEditor.window[1]) == true then guiSetVisible(GUIEditor.window[1],false) showCursor(false) guiGridListClear(GUIEditor.gridlist[1]) elseif guiGetVisible(GUIEditor.window[1]) == false then guiSetVisible(GUIEditor.window[1],true) showCursor(true) guiGridListClear(GUIEditor.gridlist[1]) triggerServerEvent("getDataFromServer",getLocalPlayer(),getLocalPlayer()) end end addEvent("showHide", true) addEventHandler("showHide", root , Abrir)
  4. السلام عليكم ورحمة الله وبركاتة كيف حال الشباب عساكم طيبين الجواب من اصحاب الخبرة والاحتراف ( القصة مو سهلة على ما اعتقد )ا اليوم كنت اشتغل على برمجة بالدي اكس @t3wz وصادفت انو لازمني 2 جريد ليست وانا بستخدم جريد ليست حقت وانا مشغل نظام الكوائن بملف الميتا <oop>true</oop> بس المصيبة كانت انو ما اقدر اختار غير من جريد ليست واحده فقط وهي اخر واحده انا سويتها اكواد الجريد ليست dxGrid = { items = {} }; local cursorOn; local NATIVE_RESOLUTION = { nil } -- put your screen resolution here to fit the gridlists to all resolutions (ex: { 1366, 768 } ) if ( table.maxn ( NATIVE_RESOLUTION ) == 2 ) then FIT_MODE = true RES = { guiGetScreenSize() }; X,Y = RES[1] / NATIVE_RESOLUTION[1], RES[2] / NATIVE_RESOLUTION[2]; SCALE = ( 1 / NATIVE_RESOLUTION[1] ) * RES[1]; end --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Core - functions function dxGrid:Create ( x, y, width, height, postGUI ) -- table dxGrid:Create ( int x, int y, int width, int height[, bool postGUI ] ) if __checkParams ( "Create", "nnnn", x, y, width, height ) then local data = { x = FIT_MODE and ( x * X ) or x; -- X position y = FIT_MODE and ( y * Y ) or y; -- Y position w = FIT_MODE and ( width * X ) or width; -- Width h = FIT_MODE and ( height * Y ) or height; -- Height pg = postGUI or false; -- PostGUI i = {}; -- Items mi = __calcMaxItems ( FIT_MODE and ( height * Y ) or height ); -- Max items s = 1; -- Scroll Level r = -1; -- Row count se = -1; -- Selected item mo = nil; -- Mouse-on item vis = true -- Visible }; setmetatable ( data, { __index = dxGrid } ); table.insert ( dxGrid.items, data ); return data; end end function dxGrid:Destroy () -- bool dxGrid:Destroy () for k, v in pairs ( dxGrid.items ) do if v == self then dxGrid.items[k] = nil; return true; end end return false; end function dxGrid:SetVisible ( visible ) -- bool Gridlist:SetVisible ( bool state ) if __checkParams ( "SetVisible", "b", visible ) then self.vis = visible return true else return false end end function dxGrid:IsVisible ( ) -- bool Gridlist:IsVisible() return self.vis end function dxGrid:AddColumn ( title, width ) -- int Gridlist:AddColumn ( string title, int width ) if __checkParams ( "AddColumn", "sn", title, width ) then local data = { info = { title = title, width = FIT_MODE and ( width * X ) or width } }; table.insert ( self.i, data ); return #self.i; end end function dxGrid:RemoveColumn ( columnIndex ) -- bool Gridlist:RemoveColumn ( int columnIndex ) if __checkParams ( "RemoveColumn", "n", columnIndex ) then self.i[columnIndex] = nil; -- Recalculate the highest item count local highest = -1; for _, v in ipairs ( self.i ) do if #v > highest then highest = ( #v - 1 ); end end self.r = highest; -- Recalculate the scroll level (if necessary) if ( ( ( self.s + self.mi ) - 2 ) == self.r ) then self.s = ( self.r - self.mi ) + 1; end return true end return false end function dxGrid:GetColumnCount () -- int Gridlist:GetColumnCount() return #self.i end function dxGrid:AddItem ( columnIndex, text, data, r, g, b ) -- int Gridlist:AddItem ( int columnIndex, string title[, mixed data, int r, int g, int b ] ) if __checkParams ( "AddItem", "ns", columnIndex, text ) then if self.i[columnIndex] then local tColor = __checkRGB ( r, g, b ) and { r, g, b } or { 255, 255, 255 }; table.insert ( self.i[columnIndex], { id = #self.i[columnIndex] + 1, text = tostring( text ), data = data, color = tColor } ); if #self.i[columnIndex] > self.r then self.r = #self.i[columnIndex]; end return #self.i[columnIndex]; end return false; end end function dxGrid:RemoveItem ( column, itemID ) -- bool Gridlist:RemoveItem ( int columnIndex, int itemIndex ) if __checkParams ( "RemoveItem", "nn", column, itemID ) then if self.i[column] and self.i[column][itemID] then -- Recalculate the highest item count if self.r == #self.i[column] then local highest = -1; for _, v in ipairs ( self.i ) do if #v > highest then highest = ( #v - 1 ); end end self.r = highest; end -- Recalculate the scroll level (if necessary) if ( ( ( self.s + self.mi ) - 2 ) == self.r ) then self.s = ( self.r - self.mi ) + 1; end -- Reset the selected item if necessary² if itemID == self.se then local newItem = self.se - 1 if newItem <= self.r then self.se = math.max ( 0, newItem ); else self.se = -1 end end table.remove ( self.i[column], itemID ); return true; end return false end end function dxGrid:GetItemCount ( columnID ) -- int Gridlist:GetItemCount ( int columnIndex ) if __checkParams ( "GetItemCount", "n", columnID ) then if self.i[columnID] then return #self.i[columnID] end return false end end function dxGrid:Clear () -- bool Gridlist:Clear() for k, v in ipairs ( self.i ) do self.i[k] = { info = v.info } end self.r = -1 self.se = nil -- Recalculate the scroll level self.s = 1; return true end function dxGrid:GetSelectedItem ( ) -- int Gridlist:GetSelectedItem () return self.se; end function dxGrid:SetSelectedItem ( itemID ) -- bool Gridlist:SetSelectedItem ( int itemIndex ) if __checkParams ( "SetSelectedItem", "n", itemID ) then if itemID <= self.r then self.se = itemID; return self.se == itemID; end return false; end end function dxGrid:GetItemDetails ( column, itemID ) -- string, mixed Gridlist:GetItemDetails ( int columnIndex, int itemIndex ) if __checkParams ( "GetItemDetails", "nn", columnID, itemID ) then if self.i[column] then if self.i[column][itemID] then return self.i[column][itemID].text, self.i[column][itemID].data end end return false end end --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Core - render/move addEventHandler ( "onClientRender", root, function ( ) -- Is there any gridlist to render? if #dxGrid.items > 0 then -- Loop through all grid lists for index, data in ipairs ( dxGrid.items ) do -- Is the gridlist visible? if data.vis then -- Draw the 'gridlist' itself dxDrawRectangle ( data.x, data.y, data.w, data.h, tocolor ( 0, 0, 0, 200 ), data.pg ); -- Draw the column bar dxDrawRectangle ( data.x, data.y, data.w, 30 % data.h, tocolor ( 0, 0, 0, 220 ), data.pg ); -- Set cursorOn variable to the current gridlist, if it's selected cursorOn = nil if __isMouseInPosition ( data.x, data.y, data.w, data.h ) then cursorOn = index; end -- Check if there's any selected item local seeFrom = data.s; local seeTo = ( data.s + data.mi ) - 1; if data.se and data.se <= data.r and data.se >= seeFrom and data.se <= seeTo then local index = data.se - ( data.s - 1 ); local y2 = data.y + ( ( index - 1 ) * 25 ); -- Draw a rectangle to make it looks like selected dxDrawRectangle ( data.x, ( 30 % data.h ) + y2, data.w, 20, tocolor ( 100, 100, 100, 100 ), data.pg ); end -- Is there any column? if #data.i > 0 then local cWidth = 0 -- Loop through all columns for cIndex, cData in ipairs ( data.i ) do -- we'll go beyond the gridlist width with this column ? if ( ( cWidth + cData.info.width ) <= data.w ) then local x = data.x + cWidth; -- Draw the column title dxDrawText ( cData.info.title, x, data.y, cData.info.width + x, ( 30 % data.h ) + data.y, tocolor ( 255, 255, 255 ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, false, true ); -- Reset the selected item cData.info.selected = -1; -- Is there any item ? if #cData > 0 then local seeFrom = data.s; local seeTo = ( data.s + data.mi ) - 1; -- Loop the items for iIndex = seeFrom, seeTo do -- There's a row with this index in the current column? if cData[iIndex] then local index = iIndex - ( data.s - 1 ); local y = data.y + ( index * 25 ); local y2 = data.y + ( ( index - 1 ) * 25 ); -- Check if cursor is on item position if __isMouseInPosition ( data.x, ( 30 % data.h ) + y2, data.w, 20 ) then -- Define the mouse-on variable data.mo = iIndex; end -- Draw the item text dxDrawText ( cData[iIndex]["text"], x, y, cData.info.width + x, ( 30 % data.h ) + y, tocolor ( unpack ( cData[iIndex]["color"] ) ), FIT_MODE and ( 1 * SCALE ) or 1, "default-bold", "center", "center", true, true, data.pg, false, true ); end end end -- Increase cWidth variable (to draw the columns correctly) cWidth = cWidth + cData.info.width; end end end end end end end , true, "low-5") -- addEventHandler ( "onClientKey", root, function ( button, press ) -- Is cursor showing? if isCursorShowing () then -- Is there any gridlist? if #dxGrid.items > 0 then -- Is there any selected gridlist? if cursorOn then -- We pressed the scroll? if press and #button > 6 then -- Does the gridlist requires scroll? if dxGrid.items[cursorOn].r > dxGrid.items[cursorOn].mi then -- Define some variables local index = cursorOn; local currentValue = dxGrid.items[index].s; local newValue = math.max ( 1, button == "mouse_wheel_down" and currentValue + 2 or currentValue -1 ); -- Check if we have spent the row's limit with the new value if ( ( newValue + dxGrid.items[index].mi ) > dxGrid.items[index].r ) then newValue = ( dxGrid.items[index].r - dxGrid.items[index].mi ) + 1; end -- Set the new scroll level dxGrid.items[index].s = newValue; end elseif press and button == "mouse1" and dxGrid.items[cursorOn].mo then dxGrid.items[cursorOn].se = dxGrid.items[cursorOn].mo; end end end end end ) --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Useful function __calcMaxItems ( height ) for i = 0, 9999 do if ( ( ( i + 1 ) * 25 ) >= math.floor ( height ) ) then return ( ( ( i + 1 ) * 25 ) > math.floor ( height ) and ( i - 1 ) or i ); end end return false; end function __checkParams ( methodName, pattern, ... ) local cTable = { ["string"] = "s"; ["number"] = "n"; ["boolean"] = "b"; ["s"] = "string"; ["n"] = "number"; ["b"] = "boolean" }; if #pattern > table.maxn ( { ... } ) then local index = table.maxn ( { ... } ) == 0 and 1 or table.maxn ( { ... } ) + 1 return false, error ( "Bad Argument @ '"..methodName.."' [Expected "..cTable[ pattern:sub ( index, index ) ].." at argument "..index..", got none]" ) end for k, v in pairs ( { ... } ) do if cTable[ type ( v ) ] ~= pattern:sub ( k, k ) then return false, error ( "Bad Argument @ '"..methodName.."' [Expected "..cTable[ pattern:sub ( k, k ) ].." at argument "..k..", got "..( type ( v ) or "none" ).."]" ) end end return true; end function __checkRGB ( r, g, b ) -- Check if all parameters were passed if ( not r ) or ( not g ) or ( not b ) then return false; end for _, v in ipairs ( { r, g, b } ) do if ( type ( v ) ~= "number" ) or ( v < 0 ) or ( v > 255 ) then return false; end end return true; end function __isMouseInPosition ( x, y, w, h ) if not isCursorShowing() then return false end local res = { guiGetScreenSize() }; local cpos = { getCursorPosition() }; local fpos = { res[1] * cpos[1], res[2] * cpos[2] }; return ( fpos[1] >= x and fpos[1] <= x + w ) and ( fpos[2] >= y and fpos[2] <= y + h ) end وبارك الله في الي يقدر يساعد وجمعة مباركة تنعاد علينا وعليكم بصحة والسلامة
  5. Hello guys, i have this question, How to make a new line that contains the rest of the text, That has reached the end of the line in the grid list ? just like the memo does.
  6. EN: I NEED HELP WITH THIS, SORRY FOR MY BAD ENGLISH. I NEED ADD ONLY WANTED PLAYERS IN GRIDLIST RESUME: ADD : PLAYERS WITH STAR >= 1 IN GRIDLIST ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ PT: EU PRECISO DE AJUDA COM ISSO, QUERO ADICIONAR APENAS JOGADORES PROCURADOS NA GRIDLIST
  7. Hello, I'm using gridlist sections for weapon classes. I have stored my weapon data in table and i have set each weapon it's own class. So my problem is this: It creates section for every weapon, but it should skip if there is already section for class. Here's how it looks now and how it should not look: Code: [Table]: prices = { { name="Shotgun", id=25, ammo=30, price=700, class="Shotguns", type="everyone" }; { name="Sawed-off", id=26, ammo=30, price=650, class="Shotguns", type="everyone" }; { name="Combat Shotgun", id=27, ammo=30, price=800, class="Shotguns", type="everyone" }; { name="Uzi", id=28, ammo=60, price=500, class="Sub-Machine Guns", type="everyone" }; { name="MP5", id=29, ammo=60, price=600, class="Sub-Machine Guns", type="everyone" }; { name="Uzi", id=32, ammo=60, price=500, class="Sub-Machine Guns", type="everyone" }; { name="AK-47", id=30, ammo=60, price=800, class="Assault Rifles", type="everyone" }; { name="M4", id=31, ammo=60, price=1000, class="Assault Rifles", type="everyone" }; { name="Rifle", id=33, ammo=60, price=2000, class="Rifles", type="everyone" }; { name="Sniper", id=34, ammo=60, price=3000, class="Rifles", type="everyone" }; { name="Rocket Launcher", id=35, ammo=20, price=7000, class="Heavy Weapons", type="Vip" }; { name="Heat-Seeking Rocket Launcher", id=36, ammo=20, price=1000, class="Heavy Weapons", type="Vip" }; { name="Minigun", id=38, ammo=2000, price=10000, class="Heavy Weapons", type="Vip" }; } [Client]: function drawWeaponsTable(weapons, isVip, vip_discount) local weapons = fromJSON(weapons) guiGridListClear(gridlist) local t = {} for i=1, #weapons do local value = weapons[i]["class"] if t[value] == nil then table.insert(t, value) local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row, 1, value, true, false) end local row = guiGridListAddRow(gridlist) guiGridListSetItemText(gridlist, row, 1, weapons[i]["name"], false, false) end end Hope you understand something
  8. Hi As it says in the Title, i have a problem with this .. I looked up on the Wiki and used guiGridListGetItemData, I read the example provided, didn't make it for what I need . function BuyDrink ( button ) if button == "left" then local nRow, nColumn = guiGridListGetSelectedItem( GridList ) if nRow ~= -1 and nColumn ~= - 1 then local row, col = guiGridListGetSelectedItem ( GridList ) local selected = guiGridListGetItemData ( GridList, row, col ) -- This Gives "nil" output outputChatBox ( "You Bought " .. tostring(selected) ) -- Output the Text from selected row of the first Column only end end end Basically I want the Text of my first column selected row, not an int . I hope I made it clear to understand Any help is appreciated .
  9. Estaba aburrido y llevaba bastante tiempo sin scriptear así que me puse a buscar por la wiki funciones que nunca usé y encontré dxDrawMaterialLine3D. Aquí os dejo un vídeo y el código de un scoreboard simple que he hecho para probar la función, por si os es útil el tema del scroll y lo que podáis encontrar. Código Client-Side:
  10. السلام عليكم ورحمة الله وبركاته عندي مشكلة بمود اتمنى الرد بأسرع وقت فيه سويت الجريد لست وخليته يجيب اسماء اللاعبين لكن ما يجيب الا اسم شخص واحد ومعلومات شخص آخر التجربة KPahmedGridList = guiCreateGridList(10, 25, 580, 245, false ) C1 = guiGridListAddColumn(KPahmedGridList, "Players", 0.2) C2 = guiGridListAddColumn(KPahmedGridList, "Money", 0.2) C3 = guiGridListAddColumn(KPahmedGridList, "Ping", 0.2) C4 = guiGridListAddColumn(KPahmedGridList, "FPS", 0.2) C5 = guiGridListAddColumn(KPahmedGridList, "Wanted", 0.2) C6 = guiGridListAddColumn(KPahmedGridList, "x", 0.2) C7 = guiGridListAddColumn(KPahmedGridList, "y", 0.2) C8 = guiGridListAddColumn(KPahmedGridList, "z", 0.2) C9 = guiGridListAddColumn(KPahmedGridList, "Health", 0.2) C10 = guiGridListAddColumn(KPahmedGridList, "zone name", 0.2) for i = 1, 10 do myRow = guiGridListAddRow (KPahmedGridList) end function DeveloperAhmedKillerProject () for id, player in ipairs(getElementsByType("player")) do x,y,z = getElementPosition( player ) Area = getZoneName( x,y,z ) guiGridListSetItemText ( KPahmedGridList, myRow, C1, getPlayerName ( player ), false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C2, getPlayerMoney ( player ), false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C3, getPlayerPing ( player ), false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C4, getFPSLimit ( player ), false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C5, getPlayerWantedLevel ( player ), false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C6, x, false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C7, y, false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C8, z, false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C9, getElementHealth ( player ), false, false ) guiGridListSetItemText ( KPahmedGridList, myRow, C10, Area, false, false ) playerName = guiGridListGetItemText ( KPahmedGridList, guiGridListGetSelectedItem ( KPahmedGridList ), 1 ) end end addEventHandler("onClientRender", root, DeveloperAhmedKillerProject)
×
×
  • Create New...