Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 30/11/22 in all areas

  1. Add the part of the code where you put the data of the gridlist in the function where to make the panel visible and place a gridListClear() on top of it all. function open() guiSetVisible(windows, true) ------------------------------------ guiGridListClear(Gridlist_Slot1) for i = 1, 2 do guiGridListAddRow(Gridlist_Slot1) end local Gold = exports.Points_system:getPlayerGold(localPlayer) guiGridListSetItemText(Gridlist_Slot1, 0, 1, "Gold Insignia", false, false) if Gold == 0 then guiGridListSetItemText(Gridlist_Slot1, 0, 2, ""..Gold, false, false) guiGridListSetItemColor(Gridlist_Slot1, 0, 2, 255, 0, 0, 255) end if Gold >= 1 then guiGridListSetItemText(Gridlist_Slot1, 0, 2, ""..Gold, false, false) guiGridListSetItemColor(Gridlist_Slot1, 0, 2, 0, 255, 0, 255) end local Silver = exports.Points_system:getPlayerSilver(localPlayer) guiGridListSetItemText(Gridlist_Slot1, 1, 1, "Silver Insignia", false, false) if Silver == 0 then guiGridListSetItemText(Gridlist_Slot1, 1, 2, ""..Silver, false, false) guiGridListSetItemColor(Gridlist_Slot1, 1, 2, 255, 0, 0, 255) end if Silver == 1 then guiGridListSetItemText(Gridlist_Slot1, 1, 2, ""..Silver, false, false) guiGridListSetItemColor(Gridlist_Slot1, 1, 2, 0, 255, 0, 255) end end
    1 point
  2. you need to create a function to update it. like update the thing when you open the panel for example yeah you dont need to use guiGridListClear if the row always 2 just update the value of that
    1 point
  3. There is another solution that doesn't require render targets, and it's closer to dxDrawImageSection in the way it works: dxDrawMaterialPrimitive. dxDrawImageSection only operates on rectangular sections. dxDrawMaterialPrimitive allows you to draw triangles, specifying the texture coordinates for each vertex, and since triangles can be put together to form other shapes, you can do what dxDrawImageSection does but not limited to rectangular sections. There isn't an example in the wiki page on how to use it, but dxDrawPrimitive has one, and dxDrawMaterialPrimitive works in a similar way, only it takes image as second argument, and each vertex has 5 parameters instead of 3 (2 extra parameters are for image coordinates). I came up with some function, for drawing a radially cut out section of an image. I only tested it as much as I could test it in standalone Lua interpreter so I don't know if it works in MTA, but if it does, someone may put it on useful functions page in wiki ? It uses trianglefan primitive type, puts the first vertex in the center and other vertices around it. local white = tocolor(255, 255, 255, 255) local degToRad = math.pi/180 local function makeVertexAtAngle(centerX, centerY, halfWidth, halfHeight, angle, color) local angleRad = angle*degToRad local xAdd, yAdd = math.sin(angleRad), -math.cos(angleRad) local maxAdd = math.max(math.abs(xAdd), math.abs(yAdd)) xAdd, yAdd = xAdd/maxAdd, yAdd/maxAdd return { centerX+xAdd*halfWidth, centerY+yAdd*halfHeight, color, 0.5+xAdd*0.5, 0.5+yAdd*0.5 } end function dxDrawRadialImageSection(posX, posY, width, height, image, startAngle, stopAngle, color, postGUI) if color == nil then color = white end if postGUI == nil then postGUI = false end local halfWidth, halfHeight = width*0.5, height*0.5 local centerX, centerY = posX+halfWidth, posY+halfHeight local roundedStartAngle = math.floor((startAngle-45)/90+1)*90+45 local roundedStopAngle = math.ceil((stopAngle-45)/90-1)*90+45 local vertices = {{centerX, centerY, color, 0.5, 0.5}} table.insert(vertices, makeVertexAtAngle(centerX, centerY, halfWidth, halfHeight, startAngle, color)) for angle = roundedStartAngle, roundedStopAngle, 90 do table.insert(vertices, makeVertexAtAngle(centerX, centerY, halfWidth, halfHeight, angle, color)) end table.insert(vertices, makeVertexAtAngle(centerX, centerY, halfWidth, halfHeight, stopAngle, color)) dxDrawMaterialPrimitive("trianglefan", image, postGUI, unpack(vertices)) end This example should display a looping 5-second animation of image going from 0 to 360 (if I didn't screw anything up): function drawAnimatedRadialSection() local angle = (getTickCount() % 5000) / 5000 * 360 dxDrawRadialImageSection(100, 100, 200, 200, "your_image.png", 0, angle) end addEventHandler("onClientRender", root, drawAnimatedRadialSection)
    1 point
×
×
  • Create New...