Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/01/23 in all areas

  1. You're not storing them in any table? Anyway, you don't need to use tables here. Instead, you can set the other elements (object and blip) as children of the collision shape using setElementParent. This will cause them to be automatically destroyed when the parent (colshape) is destroyed. You can use getElementChildren to retrieve the children of an element. Here's an example: addEventHandler("onClientResourceStart",resourceRoot, function() for index, position in ipairs(table_pos) do local x, y, z = unpack(position) -- Create a collision shape local colshape = createColSqaure(x, y, z, 1.5) -- Create an object and set its parent to the collision shape local object = createObject(2424, x, y, z) setElementParent(object, colshape) addEventHandler("onClientColShapeHit", colshape, onHit) end end) function onHit(hitElement) if hitElement == localPlayer then -- The source of this event is the colshape that was hit -- Retrieve the object that is a child of the collision shape local object = getElementChildren(source, "object")[1] -- The [1] here is used to get the first element of the table. if isElement(object) then -- Check if the object still exists ... end destroyElement(source) -- Destroy the collision shape -- The children of the collision shape will be destroyed automatically end end There is no need to use getLocalPlayer here, localPlayer is a predefined variable that refers to the local player. You should simply use the variable localPlayer directly.
    1 point
  2. dgs-dxbutton/iconImage Require [texture/shader] that can be used as the icon image of a button. dgsSetProperty(button,"iconImage",{normalImage,hoveringImage,clickedImage}) normalImage: A texture/shader element of the icon image of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this option ) hoveringImage: A texture/shader element of the icon image of the button which is selected. ( You can pass a nil value to disable this option ) clickedImage: A texture/shader element of the icon image of the button which is clicked. ( You can pass a nil value to disable this option ) You can use the function dxCreateTexture to create a texture to use on a button. Here's an example: local button = dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) -- Create a button with the text "Output!" local iconTexture = dxCreateTexture("image1.png") -- Create a texture using the image file "image1.png" if iconTexture then -- If the texture was successfully created dgsSetProperty(button,"iconImage",{iconTexture,iconTexture,iconTexture}) -- Set the button's icon image to be the created texture dgsAttachToAutoDestroy(iconTexture,button) -- Attach the texture to the button so that it is automatically destroyed when the button is destroyed. end
    1 point
  3. Let us know your MTA serial @HADES7799
    0 points
×
×
  • Create New...