
lima
Members-
Posts
19 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
lima's Achievements

Civilian (7/54)
0
Reputation
-
The error was actually on the line " table.insert(slots, i, {x - 2, y - 4, 54, 54, v.itemID, v[4]})" but it has already been resolved.
-
Hello, I'm sorry, I already solved this issue. I would actually like you to help me solve this code. the error itself is this one: (Bad argument @ 'getPlayerName' [Expected element at argument 1, got boolean] Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] ) clienntside local rx, ry = 229, 225 local render = dxCreateRenderTarget(rx,ry,true) local sx, sy = guiGetScreenSize(); local cx,cy = 599, 354 local rx,ry = 234, 226 -- Renomeie essas variáveis para rx2, ry2 para evitar conflitos local font = dxCreateFont("assets/fonts/regular.ttf", local color = tocolor(24, 30, 40, 155) --local posSlot = {x - 2, y - 4} function isMouseInPosition(x,y,w,h) if isCursorShowing() then local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() local cx,cy = (cx*sx),(cy*sy) if (cx >= x and cx <= x+w) and (cy >= y and cy <= y+h) then return true end end end local slotAction = { {552, 819, 50, 50, item = false, categoria = false}, {625, 819, 50, 50, item = false, categoria = false}, {703, 819, 50, 50, item = false, categoria = false}, {778, 819, 50, 50, item = false, categoria = false}, {852, 819, 50, 50, item = false, categoria = false}, } function Inv() local pesoAtual = math.floor((getElementData(localPlayer, "pesoInv") or 0)) local pesoMax = (getElementData(localPlayer, "pesoMax") or 30) dxDrawImage(458, 276, 423, 384, "assets/img/base.png") dxDrawImageSection(553, 557, (270 / pesoMax * pesoAtual), 74, 0, 0, (280 / pesoMax * pesoAtual), 78, "assets/img/pesoBar.png") dxDrawText(pesoAtual .. "/" .. pesoMax .. "", 825, 508, 820, 692, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false) dxDrawText("Quantidade", 435, 509, 820, 690, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false) if isMouseInPosition(550, 374, 25, 30) or aba == 1 then dxDrawImage(550, 374, 25, 30, "assets/img/privado.png", 0, 0, 0, tocolor(0, 191, 255, 255)) else dxDrawImage(550, 374, 25, 30, "assets/img/privado.png", 0, 0, 0, tocolor(255, 255, 255, 255)) end if isMouseInPosition(546, 429, 30, 32) or aba == 2 then dxDrawImage(546, 429, 30, 32, "assets/img/food.png", 0, 0, 0, tocolor(0, 191, 255, 255)) else dxDrawImage(546, 429, 30, 32, "assets/img/food.png", 0, 0, 0, tocolor(255, 255, 255, 255)) end if isMouseInPosition(547, 489, 32, 25) or aba == 3 then dxDrawImage(547, 489, 32, 25, "assets/img/ilegal.png", 0, 0, 0, tocolor(0, 191, 255, 255)) else dxDrawImage(547, 489, 32, 25, "assets/img/ilegal.png", 0, 0, 0, tocolor(255, 255, 255, 255)) end if isMouseInPosition(547, 542, 30, 30) or aba == 4 then dxDrawImage(547, 542, 30, 30, "assets/img/tools.png", 0, 0, 0, tocolor(0, 191, 255, 255)) else dxDrawImage(547, 542, 30, 30, "assets/img/tools.png", 0, 0, 0, tocolor(255, 255, 255, 255)) end local x, y = 4, 4 slots = {} dxSetRenderTarget(render, true); for i, v in ipairs(Itens) do if aba == tonumber(v[4]) then if i == selected then dxDrawImage(x - 3, y - 4, 56, 56, "assets/img/slot-effect.png") else dxDrawRectangle(x - 2, y - 4, 54, 54, color) end table.insert(slots, i, {x - 2, y - 4, 54, 54, v.itemID, v[4]}) print('v.itemID') dxDrawImage(x + 2, y + 2, 48, 45, "assets/itens/" .. v[1] .. ".png") dxDrawText("x" .. formatNumber(v[3]), x * 2 - 40, y * 2 + 32, 52, 53, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false) x = x + 54 + 3; if x >= 229 then x = 4; y = y + 54 + 4; end end end dxSetRenderTarget(); dxDrawImage(cx, cy, rx, ry, render); end --addEventHandler('onClientRender',root,Inv) function hotBar() if not getElementData(localPlayer, "BloqHud") then dxDrawImage(506, 780, 430, 125, "assets/img/base2.png") for i, v in ipairs(slotAction) do if (i <= 6 and getKeyState(i)) then dxDrawImage(v[1], v[2], v[3], v[4], "assets/slot-effect.png") end if v.item then dxDrawImage(v[1] + 3, v[2] + 50, v[3], v[4], "assets/itens/" .. (v.item) .. ".png") end end end end function pressedAction(button, press) if (press and tonumber(button)) then if not (getElementData(localPlayer, "BloqHud") or false) then if (tonumber(button) <= 6) and (tonumber(button) >= 1) then local i = tonumber(button) if isTimer(TimerAC) then local timerSeconds = getTimerDetails(TimerAC) notifyC("Aguarde " .. math.floor(timerSeconds / 1000) .. "s para usar novamente!", "error") else if slotAction.item and slotAction.categoria then toggleControl("next_weapon", false) toggleControl("previous_weapon", false) triggerServerEvent("LINCE.useItem", localPlayer, localPlayer, slotAction.item, tonumber(1), slotAction.categoria, slotAction.dataItem) if not config["Hotbar"][slotAction.item] then updateAction(slotAction.item) bloqueado = true TimerAC = setTimer(function() bloqueado = false end, 2000, 1) end end end end end end end addEventHandler("onClientRender", root, hotBar) addEventHandler("onClientClick", root, function(b, s) if s == "down" and b == "left" then if isEventHandlerAdded("onClientRender", root, Inv) then selected = {} if (isMouseInPosition(552, 372, 25, 30) and not page) then aba = 1 return end if (isMouseInPosition(546, 428, 30, 32) and not page) then aba = 2 return end if (isMouseInPosition(547, 488, 32, 25) and not page) then aba = 3 return end if (isMouseInPosition(548, 540, 30, 30) and not page) then aba = 4 return end if isMouseInPosition(cx, cy, rx, ry)then for i, v in pairs(slots) do if isMouseInPosition(v[1] + cx, v[2] + cy, v[3], v[4]) then selected = i playSound("assets/sfx/release.mp3") return end end end end end end) function onClientClickUseItem(id, item, quantia) triggerServerEvent("useItem", localPlayer, id, item, quantia) end function click2(b,player, _, id, item, quantia,...) if b == "left" then for i, v in pairs(slots) do if isMouseInPosition(v[1] + cx, v[2] + cy, v[3], v[4]) and not (getElementData(localPlayer, "usandoItem") or false) then local id = slots[5] local item = slots[6] local quantia = 1 onClientClickUseItem(id, item, quantia) selected = i end end end end addEventHandler("onClientDoubleClick", root, click2) addEvent("attActionBar", true) addEventHandler("attActionBar", root, function() ItensAction = {} for i,v in ipairs(slotAction) do v.item = false v.qnt = false v.categoria = false end end) function setItemSlot(newslot) for i,v in ipairs(Itens) do if aba == tonumber(v[4]) and itemSelect == i and select ~= newslot then v[5] = newslot triggerServerEvent("UpdateSlot", localPlayer, localPlayer, v[2], newslot) select = 0 itemSelect = nil break elseif aba == tonumber(v[4]) and itemSelect == i and select == newslot then select = 0 itemSelect = nil break end end end addEvent("inserirItem", true) addEventHandler("inserirItem", root, function(tabela) Itens = {} for i, v in ipairs(tabela) do Itens = {v.itemID, v.nameItem, v.qnt, v.category, tonumber(v.slot), v.dataItem} end end) addEvent("soundItem", true) addEventHandler("soundItem", root, function(action, duration) if action == "eat" then playSound("assets/sfx/eat.mp3") elseif action == "drink" then playSound("assets/sfx/drink.mp3") end end ) function openInv() if not isEventHandlerAdded("onClientRender", root, Inv) then addEventHandler("onClientRender", root, Inv) showCursor(true) selectSlot = false quantitySelect = 1 manageEdits = false select = false itemSelect = false subWindow = false aba = 1 else removeEventHandler("onClientRender", root, Inv) showCursor(false) end end addEvent("openInv", true) addEventHandler("openInv", root, openInv) bindKey("b", "down", openInv) function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == "string" and isElement( pElementAttachedTo ) and type( func ) == "function" then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == "table" and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end serverside Inventario = {} weaponStates = {} ArmaEquipada = {} comProposta = {} UsouPicareta = {} mochilinha = {} UsouFacao = {} UsouPa = {} object = {} UsouBastao = {} mascara = {} Skate = {} Usando = {} local MuniIDS = { --ID arma jogo, ID munição [30] = 40, [25] = 42, [22] = 41, [31] = 39, [34] = 39, [29] = 41, [32] = 39, [24] = 41, } local weaponMuni = { --ID arma jogo, elementdata munição [30] = "AK-47", [25] = "DOZE", [22] = "SUBANDPISTOL", [31] = "MUNIM4ANDSNIPER", [34] = "MUNIM4ANDSNIPER", [29] = "SUBANDPISTOL", [32] = "SUBANDPISTOL", [24] = "SUBANDPISTOL", } local itemGiveMuni = { --elementdata munição, id munição ["AK-47"] = 40, ["DOZE"] = 42, ["SUBANDPISTOL"] = 41, ["MUNIM4ANDSNIPER"] = 39, } taserEquip = {} addEventHandler("onResourceStart", resourceRoot, function() db = dbConnect("sqlite", "data.sqlite") dbExec(db, "CREATE TABLE IF NOT EXISTS Itens (account, itemID, nameItem, qnt, category, slot, dataItem)") if config["Mensagem Start"] then outputDebugString("["..getResourceName(getThisResource()).."] Startado com sucesso!") end setTimer(function() for i, v in ipairs(getElementsByType("player")) do attInv(v) attPeso(v) setElementData(v, "pesoMax", 30) if (getElementData(v, "usandoItem") or false) then setElementData(v, "usandoItem", false) end end end, 1000, 1) end) function giveItem1(player, _, id, item, quantia) if aclGetGroup("Console") and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Console")) then if not tonumber(id) and tonumber(item) and tonumber(quantia) then notifyS(player, "Digite corretamente. /item [ID] [Item] [Quantia]", "error") else local receiver = getPlayerFromID(tonumber(id)) if not isElement(receiver) then notifyS(player, "Este jogador está ausente!", "info") else iditem = tonumber(item) quantiaitem = tonumber(quantia) if quantiaitem == nil then notifyS(player, "Quantia de item invalida!", "error") else if (tonumber(iditem) == nil) then notifyS(player, "Ocorreu algum erro!", "error") else if (tonumber(iditem) > tonumber(#config["Itens"])) then notifyS(player, "Este item não existe!", "error") else local peso = math.floor(getElementData(receiver, "pesoInv")) or 0 if ((config["Itens"][iditem][3] * tonumber(quantiaitem)) + peso > (getElementData(player, "pesoMax") or 30)) then notifyS(player, "A mochila do jogador está cheia.", "error") else local NameItem = tostring(config["Itens"][iditem][1]) notifyS(player, "Você adicionou "..formatNumber(quantia).."x do item ("..NameItem..") para "..getPlayerName(receiver).."!", "info") giveItem(receiver, tonumber(item), tonumber(quantia)) ---exports["i9_util"]:messageDiscord("O jogador(a) "..(exports["i9_util"]:puxarNome(player)).." ("..(exports["i9_util"]:puxarID(player))..") adicionou "..formatNumber(quantia).."x do item ("..NameItem..") para "..getPlayerName(receiver).."!", "https://discord.com/api/webhooks/1121640792671395931/W4yq5lm7WBNVcaES-27Ef5-75VBc7MWZ29A8S4rA-iP5Cpr6u7QQiN1PSnNLQpaFEZo7") end end end end end end end end addCommandHandler("item", giveItem1) function giveItem(target, item, quantia, dataItem) if target and isElement(target) and getElementType(target) == "player" and tonumber(item) and tonumber(quantia) then local NomeItem = tostring(config["Itens"][tonumber(item)][1]) local Categoria = tonumber(config["Itens"][tonumber(item)][2]) local peso = math.floor(getElementData(target, "pesoInv")) or 0 if not isElement(target) then notifyS(player, "O jogador não está online!", "error") else if (tonumber(quantia) == nil) then notifyS(target, "Ocorreu algum erro a receber algum item!", "error") else if (tonumber(item) == nil) then notifyS(player, "Ocorreu algum erro a receber algum item!", "error") else if ((config["Itens"][tonumber(item)][3] * tonumber(quantia)) + peso > (getElementData(target, "pesoMax") or 30)) then notifyS(target, "A sua mochila está cheia.", "error") else local result = dbPoll(dbQuery(db, "SELECT * FROM Itens WHERE itemID = ? AND account = ?", tonumber(item), getAccountName(getPlayerAccount(target))), -1) if config["Não agrupar"][item] then dbExec(db, "INSERT INTO Itens (account, itemID, nameItem, qnt, category, slot, dataItem) VALUES(?, ?, ?, ?, ?, ?, ?)", getAccountName(getPlayerAccount(target)), tonumber(item), item == 110 and "CNH "..dataItem.typeCategory or NomeItem, tonumber(quantia), tonumber(Categoria), getFreeSlot(getAccountName(getPlayerAccount(target)), tonumber(Categoria)), dataItem and toJSON(dataItem) or {}) else if (#result ~= 0) then dbExec(db, "UPDATE Itens SET qnt = ? WHERE itemID = ? AND account = ?", result[1]["qnt"] + tonumber(quantia), tonumber(item), getAccountName(getPlayerAccount(target))) else dbExec(db, "INSERT INTO Itens (account, itemID, nameItem, qnt, category, slot, dataItem) VALUES(?, ?, ?, ?, ?, ?, ?)", getAccountName(getPlayerAccount(target)), tonumber(item), NomeItem, tonumber(quantia), tonumber(Categoria), getFreeSlot(getAccountName(getPlayerAccount(target)), tonumber(Categoria)), dataItem and toJSON(dataItem) or {}) end end attInv(target) attPeso(target) return true end end end end end return false end addEvent("giveItem", true) addEventHandler("giveItem", root, giveItem) function takeItem1(player, _, id, item, quantia) if aclGetGroup("Console") and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Console")) then if not tonumber(id) and tonumber(item) and tonumber(quantia) then notifyS(player, "Digite corretamente. /takeitem [ID] [Item] [Quantia]", "error") else local target = getPlayerFromID(tonumber(id)) if not isElement(target) then notifyS(player, "Este jogador está ausente!", "info") else iditem = tonumber(item) quantiaitem = tonumber(quantia) if quantiaitem == nil then notifyS(player, "Quantia de item inválida!", "error") else if (tonumber(iditem) == nil) then notifyS(player, "Ocorreu algum erro!", "error") else if (tonumber(iditem) > tonumber(#config["Itens"])) then notifyS(player, "Este item não existe!", "error") else local result = dbPoll(dbQuery(db, "SELECT * FROM Itens WHERE itemID = ? AND account = ?", tonumber(item), getAccountName(getPlayerAccount(target))), -1) if #result ~= 0 and result[1]["qnt"] >= tonumber(quantia) then local NomeItem = tostring(config["Itens"][tonumber(item)][1]) notifyS(player, "Você retirou "..formatNumber(quantia).."x do item ("..NomeItem..") de "..getPlayerName(target).."!", "info") takeItem(target, tonumber(item), tonumber(quantia)) else notifyS(player, "O jogador não possui a quantidade necessária desse item!", "error") end end end end end end end end addCommandHandler("take", takeItem1) function takeItem(target, item, quantia) if target and isElement(target) and getElementType(target) == "player" and tonumber(item) and tonumber(quantia) then local result = dbPoll(dbQuery(db, "SELECT * FROM Itens WHERE itemID = ? AND account = ?", tonumber(item), getAccountName(getPlayerAccount(target))), -1) if #result ~= 0 and result[1]["qnt"] >= tonumber(quantia) then local newQuantity = result[1]["qnt"] - tonumber(quantia) if newQuantity > 0 then dbExec(db, "UPDATE Itens SET qnt = ? WHERE itemID = ? AND account = ?", newQuantity, tonumber(item), getAccountName(getPlayerAccount(target))) else dbExec(db, "DELETE FROM Itens WHERE itemID = ? AND account = ?", tonumber(item), getAccountName(getPlayerAccount(target))) end attInv(target) attPeso(target) return true else return false end end return false end addEvent("takeItem", true) addEventHandler("takeItem", root, takeItem) function useItem(player, _, id, item, quantia) if aclGetGroup("Console") and isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Console")) then if not tonumber(id) or not tonumber(item) or not tonumber(quantia) then notifyS(player, "Digite corretamente. /useitem [ID] [Item] [Quantia]", "error") else local target = getPlayerFromID(tonumber(id)) if not isElement(target) then notifyS(player, "Este jogador está ausente!", "info") else iditem = tonumber(item) quantiaitem = tonumber(quantia) if quantiaitem == nil then notifyS(player, "Quantia de item inválida!", "error") else if (tonumber(iditem) == nil) then notifyS(player, "Ocorreu algum erro!", "error") else if (tonumber(iditem) > tonumber(#config["Itens"])) then notifyS(player, "Este item não existe!", "error") else local result = dbPoll(dbQuery(db, "SELECT * FROM Itens WHERE itemID = ? AND account = ?", tonumber(item), getAccountName(getPlayerAccount(target))), -1) if #result ~= 0 and result[1]["qnt"] >= tonumber(quantia) then local NomeItem = tostring(config["Itens"][tonumber(item)][1]) notifyS(player, "Você usou "..formatNumber(quantia).."x do item ("..NomeItem..") em "..getPlayerName(target).."!", "info") useItemAction(target, tonumber(item), tonumber(quantia)) else notifyS(player, "O jogador não possui a quantidade necessária desse item!", "error") end end end end end end end end addCommandHandler("use", useItem) addEvent("useItem", true) addEventHandler("useItem", root, useItem) function useItemAction(player, item, quantia) -- Adicione aqui a lógica para ação de usar o item no servidor -- Exemplo: removerVisualDoItem(player, item) takeItem(player, item, quantia) attInv(player) attPeso(player) end function onFireWeapon(weapon) if not (getElementData(source, "LINCE.podeAtirarSem") or false) then if weapon == 34 or weapon == 30 or weapon == 25 or weapon == 22 or weapon == 31 or weapon == 29 or weapon == 32 or weapon == 24 then --ID da arma do jogo local QuantiaMun = getElementData(source, weaponMuni[weapon]) or 0 if (QuantiaMun >= 2) then setElementData(source, weaponMuni[weapon], QuantiaMun - 1) else setElementData(source, weaponMuni[weapon], 0) if ArmaEquipada[source] then ArmaEquipada[source][weapon] = false end weaponStates[source] = false takeAllWeapons(source) notifyS(source, "Sua munição acabou.", "info") end end end end addEventHandler("onPlayerWeaponFire", root, onFireWeapon) function attInv(player) local result = dbPoll(dbQuery(db, "SELECT * FROM Itens WHERE account = ?", getAccountName(getPlayerAccount(player))), -1) Inventario[player] = result triggerClientEvent(player, "inserirItem", player, Inventario[player]) end function attPeso(player) setElementData(player, "pesoInv", getPesoInv(player)) end addEvent("attPeso", true) addEventHandler("attPeso", root, attPeso) addEventHandler("onPlayerLogin", root, function() attInv(source) attPeso(source) end) function getPesoInv(player) pesoTotal = 0 local itens = Inventario[player] if type(itens) == "table" then if #itens ~= 0 then for i, v in ipairs(itens) do local quantia = tonumber(v["qnt"]) local iditem = tonumber(v["itemID"]) pesoTotal = pesoTotal + (quantia * config["Itens"][iditem][3]) end end end return pesoTotal end function getItemNameFromID(id) if config["Itens"][id] then return config["Itens"][id][1] end return "" end function getPlayerFromID(id) if (id) then for i, v in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(v)) then if (getElementData(v, "ID") == tonumber(id)) then return v end end end end return false end function getAgrupar(item) if config["Não agrupar"][item] then return true end return false end the error occurs in the onClientDoubleClick function
-
is based on ejecting the play from the vehicle, leaving only the driver.. using the onClientClick function.. local screenW,screenH = guiGetScreenSize() local resW, resH = 1600,900 local x, y = (screenW/resW), (screenH/resH) function dx() dxDrawImage(x*786, y*572, x*36, y*27, "assets/img/expulse.png") end addEventHandler("onClientRender",root,dx) addEventHandler("onClientClick", root, function (b, s) if s == "down" and b == "left" then if isEventHandlerAdded("onClientRender", root, dx) then if isMouseInPosition (x*786, y*572, x*36, y*27) then Veh = getPedOccupiedVehicle(player) or 0 if (Veh) then vehSeatNo = getPedOccupiedVehicleSeat(player) or 0 if vehSeatNo == 0 then getVehicleOccupant(seat) removePedFromVehicle(source, ocVeh) pX, pY, pZ = getElementPosition(source) rX, rY, rZ = getElementRotation(source) ejectorSeat = createObject(1562, pX, pY, pZ, rX, rY, rZ) setElementAlpha(ejectorSeat, 0) -- make the seat invis. setElementCollisionsEnabled(ejectorSeat, false) -- make the seat untouchable so as to avoid crashes getVehicleOccupant(player) attachElements(source, ejectorSeat, 0, 0, 0, 0, 0, 0) moveObject(ejectorSeat, 5000, pX, pY, pZ, - 100) setTimer(detachElements,5000,1,player,ejectorSeat) setTimer(destroyElement,5000,1,ejectorSeat) triggerServerEvent ( "ejectVehicle", localPlayer ) end end end end end end) function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == "string" and isElement( pElementAttachedTo ) and type( func ) == "function" then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == "table" and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function isMouseInPosition(x,y,w,h) if isCursorShowing() then local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() local cx,cy = (cx*sx),(cy*sy) if (cx >= x and cx <= x+w) and (cy >= y and cy <= y+h) then return true end end end client side
-
I'm trying to put this dxDrawImageSection to work according to the speedometer but it's giving an error when loading the image. Could someone help me put the image to interact with the speedometer? local screen = {guiGetScreenSize ()} local resolution = {1366, 768} local scale = math.min (0.75, math.max ((screen[2] / resolution[2]), 2)) addEventHandler("onClientResourceStart", resourceRoot, function() loadSVG() end) local bollX, bollY = (screen[1] - (scale * 152)), (screen[2] - (scale * 254)) local bollTX, bollTY = (screen[1] - (scale * 183)), (screen[2] - (scale * 183)) local fuelX, fuelY = (screen[1] - (scale * 67)), (screen[2] - (scale * 67)) local textX, textY = (screen[1] - (scale * 35)), (screen[2] - (scale * 105)) local bollTTX, bollTTY = (screen[1] - (scale * 70)), (screen[2] - (scale * 60)) local font = dxCreateFont("assets/fonts/Medium.ttf", 17) addEventHandler ("onClientRender", root, function () local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end local kmh = getElementSpeed(vehicle, 2) local maxVelocity = (getVehicleHandling(vehicle)["maxVelocity"]) local fuel = (getElementData(vehicle, "fuel") or 100) local motor = (getElementHealth(vehicle)) dxDrawImage(bollX - 108, bollY - 30, 280 * scale, 255 * scale, "assets/img/base.png") dxDrawImage(bollX - 10, bollY + 132 , 17 * scale, 17 * scale, "assets/img/dano.png") dxDrawImage(bollX - 39, bollY + 130 , 20 * scale, 19 * scale, "assets/img/fuel1.png") dxDrawImage(bollX + 12, bollY + 124 , 35 * scale, 35 * scale, "assets/img/lock.png") --setSVGOffset(1, -281) --createCircleStroke(1, 393 * scale, 393 * scale, 21) --drawItem(1, bollTX - 160, bollTY - 195, 200, tocolor(0, 224, 255, 255), false) --setSVGOffset(1, -281 +( maxVelocity*kmh)) dxDrawImageSection(bollTX + 72, bollTY + 120, 60 * ((getElementSpeed(vehicle,2,maxVelocity*kmh) or 100) / 100), 11, 0, 0, 60 * ((getElementSpeed(vehicle,2,maxVelocity*kmh) or 100) / 100), 11, 'assets/img/base2.png', 0, 0, 0, tocolor(255, 255, 255, alpha)) createCircleStroke(4, 50 * scale, 50 * scale, 2) drawItem(4, bollTTX - 115, bollTTY - 34, 200, tocolor(0, 224, 255, 255), false) setSVGOffset(4, (80/100*fuel)) createCircleStroke(6, 50 * scale, 50 * scale, 2) drawItem(6, bollTTX - 80, bollTTY - 34, 250, tocolor(0, 224, 255, 255), false) setSVGOffset(6, motor <= 100 and 0 or (7/150*motor)) kmh = math.floor(kmh) if (kmh == 0) then kmh = '00'..kmh elseif (kmh < 10) then kmh = '00'..kmh elseif (kmh < 100) then kmh = '0'..kmh end dxDrawText(kmh, textX - 143, textY - (90), ((textX - 143)+108), ((textY - (90))+72), tocolor(255, 255, 255, 75), 1.00, font, "center", "center", false, false, false, false, false) end) function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)) * mult).length end
-
I'm trying to put this dxDrawImageSection to work according to the speedometer but it's giving an error when loading the image. Could someone help me put the image to interact with the speedometer? local screen = {guiGetScreenSize ()} local resolution = {1366, 768} local scale = math.min (0.75, math.max ((screen[2] / resolution[2]), 2)) addEventHandler("onClientResourceStart", resourceRoot, function() loadSVG() end) local bollX, bollY = (screen[1] - (scale * 152)), (screen[2] - (scale * 254)) local bollTX, bollTY = (screen[1] - (scale * 183)), (screen[2] - (scale * 183)) local fuelX, fuelY = (screen[1] - (scale * 67)), (screen[2] - (scale * 67)) local textX, textY = (screen[1] - (scale * 35)), (screen[2] - (scale * 105)) local bollTTX, bollTTY = (screen[1] - (scale * 70)), (screen[2] - (scale * 60)) local font = dxCreateFont("assets/fonts/Medium.ttf", 17) addEventHandler ("onClientRender", root, function () local vehicle = getPedOccupiedVehicle(localPlayer) if not vehicle then return end local kmh = getElementSpeed(vehicle, 2) local maxVelocity = (getVehicleHandling(vehicle)["maxVelocity"]) local fuel = (getElementData(vehicle, "fuel") or 100) local motor = (getElementHealth(vehicle)) dxDrawImage(bollX - 108, bollY - 30, 280 * scale, 255 * scale, "assets/img/base.png") dxDrawImage(bollX - 10, bollY + 132 , 17 * scale, 17 * scale, "assets/img/dano.png") dxDrawImage(bollX - 39, bollY + 130 , 20 * scale, 19 * scale, "assets/img/fuel1.png") dxDrawImage(bollX + 12, bollY + 124 , 35 * scale, 35 * scale, "assets/img/lock.png") --setSVGOffset(1, -281) --createCircleStroke(1, 393 * scale, 393 * scale, 21) --drawItem(1, bollTX - 160, bollTY - 195, 200, tocolor(0, 224, 255, 255), false) --setSVGOffset(1, -281 +( maxVelocity*kmh)) dxDrawImageSection(bollTX + 72, bollTY + 120, 60 * ((getElementSpeed(vehicle,2,maxVelocity*kmh) or 100) / 100), 11, 0, 0, 60 * ((getElementSpeed(vehicle,2,maxVelocity*kmh) or 100) / 100), 11, 'assets/img/base2.png', 0, 0, 0, tocolor(255, 255, 255, alpha)) createCircleStroke(4, 50 * scale, 50 * scale, 2) drawItem(4, bollTTX - 115, bollTTY - 34, 200, tocolor(0, 224, 255, 255), false) setSVGOffset(4, (80/100*fuel)) createCircleStroke(6, 50 * scale, 50 * scale, 2) drawItem(6, bollTTX - 80, bollTTY - 34, 250, tocolor(0, 224, 255, 255), false) setSVGOffset(6, motor <= 100 and 0 or (7/150*motor)) kmh = math.floor(kmh) if (kmh == 0) then kmh = '00'..kmh elseif (kmh < 10) then kmh = '00'..kmh elseif (kmh < 100) then kmh = '0'..kmh end dxDrawText(kmh, textX - 143, textY - (90), ((textX - 143)+108), ((textY - (90))+72), tocolor(255, 255, 255, 75), 1.00, font, "center", "center", false, false, false, false, false) end) function getElementSpeed(theElement, unit) assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) return (Vector3(getElementVelocity(theElement)) * mult).length end
-
local rx, ry = 229, 225 local render = dxCreateRenderTarget(rx,ry,true) local sx, sy = guiGetScreenSize(); local color = tocolor(255, 255, 255, 255) local cx,cy = 600, 363 local rx,ry = 234, 225 ----------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ local font = dxCreateFont("assets/fonts/regular.ttf", ------------------------------------------------------------------------------------------ local selected = nil; local slots = {} Itens = {} select = 0 itemSelect = false ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function isMouseInPosition(x,y,w,h) if isCursorShowing() then local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() local cx,cy = (cx*sx),(cy*sy) if (cx >= x and cx <= x+w) and (cy >= y and cy <= y+h) then return true end end end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function Inv() local pesoAtual = math.floor((getElementData(localPlayer, "pesoInv") or 0)) local pesoMax = (getElementData(localPlayer, "pesoMax") or 30) dxDrawImage(499, 254, 418, 436, "assets/img/base.png"); dxDrawImageSection(558, 560, (307/pesoMax*pesoAtual), 74, 0, 0, (307/pesoMax*pesoAtual), 78, "assets/img/pesoBar.png") if isMouseInPosition(735, 300, 135, 92) then dxDrawImage(735, 300, 135, 92, "assets/img/button_effect.png") else dxDrawImage(735, 300, 135, 92, "assets/img/button.png") end if isMouseInPosition(548, 368, 25, 30) or aba == 1 then dxDrawImage(548, 368, 25, 30, "assets/img/privado.png",0, 0, 0, tocolor(0,191,255,255)) else dxDrawImage(548, 368, 25, 30, "assets/img/privado.png",0, 0, 0, tocolor(255,255,255,255)) end if isMouseInPosition(545, 420, 32, 25) or aba == 2 then dxDrawImage(545, 420, 32, 25, "assets/img/ilegal.png",0, 0, 0, tocolor(0,191,255,255)); else dxDrawImage(545, 420, 32, 23, "assets/img/ilegal.png",0, 0, 0, tocolor(255,255,255,255)) end if isMouseInPosition(545, 465, 30, 30) or aba == 3 then dxDrawImage(545, 465, 30, 30, "assets/img/tools.png",0, 0, 0, tocolor(0,191,255,255)) else dxDrawImage(545, 465, 30, 30, "assets/img/tools.png",0, 0, 0, tocolor(255,255,255,255)) end dxDrawText("DROPAR",1469, 674, 138, 22, nil, 1, "Default", 'center', 'center') dxDrawText(pesoAtual.."/"..pesoMax.."", 805, 516, 820, 692, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false) dxDrawText("Quantidade", 448, 514, 820, 692, tocolor(255, 255, 255, 255), 1.00, font, "center", "center", false, false, false, false, false) --dxDrawRectangle(600, 363, 229, 225, tocolor(24, 30, 40,135)) --dxDrawImage(876, 254, 424, 436, "assets/img/base1.png"); if render and isElement(render) then local element = localPlayer --dxDrawImage(0, 0, 1440, 900, "assets/img/base2.png"); --dxDrawRectangle(829, 362 +sroll1, 3, 116,tocolor(0,191,255,150)) local x,y = 5,5 slots = {} dxSetRenderTarget(render, true); for i, v in ipairs(Itens) do iprint(Itens) if aba == tonumber(v[6]) then if (selected ~= tonumber(v[5])) then if i == selected then dxDrawImage(x-4, y-4 ,52, 53, "assets/img/slot-effect.png") else dxDrawRectangle(x-4, y-4 ,52, 53, color) end table.insert(slots, {x-4, y-4, 52, 53}) dxDrawImage(x-2, y+4, 48, 45,"assets/itens/"..v[1]..".png") --dxDrawText("x"..formatNumber(v[3]),x*2 +22,y*2 +32, 52, 53, tocolor(255, 255, 255, 127), 1.00, font, "center", "center", false, false, false, false, false) x = x + 52 + 5; if x >= 321 then x = 5; y = y + 53 + 4; end end -- iprint(slots) dxSetRenderTarget(); dxDrawImage( cx,cy,rx,ry, render); --dxDrawImage( 980, 363, 231, 225, render2); end end end end --------------------------------------------------------------------------------------------------------------------------------------------------------------- function hotBar() if not getElementData(localPlayer, "BloqHud") then dxDrawImage(506, 790, 430, 125, "assets/img/base2.png") for i, v in ipairs(slots) do if (i <= 6 and getKeyState(i)) then dxDrawImage(v[1], v[2], v[3], v[4], "assets/slot-effect.png") end if v.item then dxDrawImage(v[1]+3, v[2]+50, v[3], v[4], "assets/itens/"..(v.item)..".png") end end end end addEventHandler("onClientRender", root, hotBar) ------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------- addEventHandler("onClientClick", root, function (b, s) if s == "down" and b == "left" then if isEventHandlerAdded("onClientRender", root, Inv) then selected = false if (isMouseInPosition(548, 368, 25, 30) and not page) then aba = 1 dxDrawText("DROPAR",1469, 674, 138, 22, nil, 1, "Default", 'center', 'center') return end if (isMouseInPosition(545, 420, 32, 25) and not page) then aba = 2 return end if (isMouseInPosition(545, 465, 30, 30) and not page) then aba = 3 return end if isMouseInPosition(cx,cy,rx,ry) then for i,v in ipairs(slots) do if isMouseInPosition(v[1]+cx, v[2]+cy, v[3], v[4]) and aba and select ~= 0 and not page then selected = i playSound("assets/sfx/release.mp3") return end end if isMouseInPosition(735, 300, 135, 92) then if Itens[selected].id >= tonumber(item) and takeItem (player, item, quantia) then triggerServerEvent("droparItem", localPlayer, localPlayer, Itens[selected][1], qntUse, Itens[selected][6], Itens[selected]) selected = i playSound("assets/sfx/release.mp3") return end end end end end end) --------------------------------------------------------------------------------------------------------------------------------------------------------------- function Click2( b ) if b == "left" then if isMouseInPosition(cx,cy,rx,ry) then for i, v in ipairs(Itens) do if isMouseInPosition(v[1]+cx, v[2]+cy, v[3], v[4]) and select ~= 0 then triggerServerEvent("useItem", player, config['Itens'][item[selected].id].nome, item[selected].id) select = v[5] selected = i return end end end end end addEventHandler("onClientDoubleClick", root, Click2) --------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------- addEvent("inserirItem", true) addEventHandler("inserirItem", root, function(tabela) Itens = {} for i, v in ipairs(tabela) do -- iprint(tabela) Itens = {v.itemID, v.nameItem, v.qnt,tonumber(v.slots), v.dataItem,v.category} end end) function openInv() if not isEventHandlerAdded("onClientRender", root, Inv) then addEventHandler("onClientRender", root, Inv) showCursor(true) selectSlot = false quantitySelect = 1 manageEdits = false select = false itemSelect = false subWindow = false aba = 1 else removeEventHandler("onClientRender", root, Inv) showCursor(false) end end addEvent("JOAO.openInv", true) addEventHandler("JOAO.openInv", root, openInv) bindKey("b", "down", openInv) function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == "string" and isElement( pElementAttachedTo ) and type( func ) == "function" then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == "table" and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end
-
Alguém poderia me ajudar com um exemplo de como filtrar a tabela e ver a categoria de acordo com o item? tipo de arma = encaminhado para aba de ilegais. Comida = para aba comida
-
Brother, this script is mine.. I've been creating this for two weeks now.. The fact that the codes are broken doesn't mean I caught it.. I'm creating this inventory myself, I spend days and nights, late nights with my face on the computer trying to discover the right codes, reading content about the .lua language... so I came to tell you that this script I found on the internet... dxDrawRectangle(x-4, y-4 -sroll,52, 53, tocolor(255, 255, 255, 255), false) dxDrawImage(x-4, y-4 -sroll,52, 53, "assets/img/slot-effect.png", 0, 0, 0, scrollColor, false) and the function i == selected ?? Where does it fit in? pro effect slot be selected? because then it will give an error..
-
If you could, would you also be able to help me with this onClientDoubleclick function.. I can't find the position of the slot, and when I create a position, clicking on it doesn't give me the item in the inventory.
-
local rx, ry = 229, 225 local render = dxCreateRenderTarget(rx,ry,true) local x, y = guiGetScreenSize(); local selected = nil; local slots = {x, y ,52, 53} local cx, cy = (x/2) - (rx/2) - 50, (y/2) - (ry/2); local sroll = 0 local sroll1 = 0 local scrollColor = tocolor(24, 30, 40,155) local scrollColorS = tocolor(0,191,255,150) local maxScroll = 0; local maxScroll1 = 0 local peso = math.floor((getElementData(localPlayer, "peso") or 0)) ---------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------ function isMouseInPosition(x,y,w,h) if isCursorShowing() then local sx,sy = guiGetScreenSize() local cx,cy = getCursorPosition() local cx,cy = (cx*sx),(cy*sy) if (cx >= x and cx <= x+w) and (cy >= y and cy <= y+h) then return true end end end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function Inv() dxDrawImage(488, 254, 424, 436, "assets/img/base.png"); dxDrawImageSection(543, 362, (352/peso*g_peso), 3, 0, 0, (352/peso*g_peso), 3, "assets/img/pesoBar.png") if render and isElement(render) then local element = localPlayer --dxDrawImage(0, 0, 1440, 900, "assets/img/base2.png"); dxDrawRectangle(829, 362 +sroll1, 3, 116,tocolor(0,191,255,150)) dxDrawRectangle( 829,362,52, 53, tocolor(24, 30, 40,155)) --dxDrawRectangle(594,297,249, 259, tocolor(24, 30, 40,25)) local Itens = getElementData(localPlayer, "mochila"); local peso = (getElementData(localPlayer, "peso") or config["Weight Template"]) local x,y= 5,5 slots = {} maxScroll = 0 maxScroll1 = 0 dxSetRenderTarget(render, true); --dxDrawRectangle(227, -1 +sroll, 8, 126,tocolor(0,191,255,150)) for i,v in ipairs(Itens) do dxDrawRectangle(x-4, y-4 -sroll,52, 53, i == selected and dxDrawImage(x-4, y-4 -sroll,52, 53, "assets/img/slot-effect.png") or scrollColor) table.insert(slots, {x-4, y-4, 52, 53}) dxDrawImage(x, y -sroll, 48, 45,"assets/itens/"..(v.id)..".png") x = x + 52 + 5; if x >= 229 then x = 5; y = y + 53 + 4; end end maxScroll = math.max(114, y -300) maxScroll1 = math.max(110, y -300) dxSetRenderTarget(); dxDrawImage( 600, 363, 231, 225, render); end if (isMouseInPosition(544, 376, 29, 35) and not manageEdits) or aba == 1 then dxDrawImage(544, 376, 29, 35, "assets/img/privado.png",0, 0, 0, tocolor(0,191,255,255)) -- dxDrawImage(810, 256, 80, 140, "assets/img/baseBar.png") --dxDrawText('Pessoal', 1597, 514, 30, 31, tocolor(255, 255, 255, 255), 1, fonts, 'center', 'center', false, false, false, false, false) else dxDrawImage(544, 376, 29, 35, "assets/img/privado.png",0, 0, 0, tocolor(255,255,255,255)) end if (isMouseInPosition(536, 434, 36, 36)and not manageEdits) or aba == 2 then dxDrawImage(536, 434, 36, 36, "assets/img/food.png",0, 0, 0, tocolor(0,191,255,255)) ---dxDrawImage(810, 325, 80, 140, "assets/img/baseBar.png") ---dxDrawImage(594,293, 60, 64, "assets/itens/agua.png") --dxDrawText('Alimentos', 1580, 514, 30, 31, tocolor(255, 255, 255, 255), 1, fonts, 'center', 'center', false, false, false, false, false) else dxDrawImage(536, 434, 36, 36, "assets/img/food.png",0, 0, 0, tocolor(255,255,255,255)) end if (isMouseInPosition(538, 495, 37, 26) and not manageEdits) or aba == 3 then dxDrawImage(538, 495, 37, 26, "assets/img/ilegal.png",0, 0, 0, tocolor(0,191,255,255)); --dxDrawImage(810, 389, 80, 140, "assets/img/baseBar.png") --dxDrawText('Ilegal', 1613, 514, 30, 31, tocolor(255, 255, 255, 255), 1, fonts, 'center', 'center', false, false, false, false, false) else dxDrawImage(538, 495, 37, 26, "assets/img/ilegal.png",0, 0, 0, tocolor(255,255,255,255)) end if (isMouseInPosition(538, 545, 36, 38) and not manageEdits) or aba == 4 then dxDrawImage(538, 545, 36, 38, "assets/img/tools.png",0, 0, 0, tocolor(0,191,255,255)) --dxDrawImage(810, 455, 80, 140, "assets/img/baseBar.png") --dxDrawText('Ferramentas', 1560, 514, 30, 31, tocolor(255, 255, 255, 255), 1, fonts, 'center', 'center', false, false, false, false, false) else dxDrawImage(538, 545, 36, 38, "assets/img/tools.png",0, 0, 0, tocolor(255,255,255,255)) end end --------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------- function ScrollRoler(b, p) if p then if isMouseInPosition(601, 367, 227, 228) then if b == 'mouse_wheel_up' then sroll = math.max(0, sroll - 50) elseif b == "mouse_wheel_down" then sroll = math.min(maxScroll, sroll + 50) end end end end addEventHandler("onClientKey", root, ScrollRoler) function ScrollR(b,p) if p then if isMouseInPosition(601, 367, 227, 228) then if b == 'mouse_wheel_up' then sroll1 = math.max(0, sroll - 70) elseif b == "mouse_wheel_down" then sroll1 = math.min(maxScroll1, sroll1 + 70) end end end end addEventHandler("onClientKey", root, ScrollR) addEventHandler("onClientClick", root, function (b, s) if s == "down" and b == "left" then if isEventHandlerAdded("onClientRender", root, Inv) then select = false if (isMouseInPosition(544, 376, 29, 35) and not manageEdits) then aba = 1 return end if (isMouseInPosition(536, 434, 36, 36) and not manageEdits) then aba = 2 return end if (isMouseInPosition(538, 495, 37, 26) and not manageEdits) then aba = 3 return end if (isMouseInPosition(538, 545, 36, 38) and not manageEdits) then aba = 4 return end if manageEdits then if isMouseInPosition(544, 376, 29, 35) then aba = 1 return end if isMouseInPosition(536, 434, 36, 36) then aba = 2 return end if isMouseInPosition(538, 495, 37, 26) then aba = 3 return end if isMouseInPosition(538, 545, 36, 38) then aba = 4 return end end end end if isMouseInPosition(601, 367, 227, 228) then for i,v in ipairs(slots) do if isMouseInPosition(v[1]+601,v[2]+367,v[3],v[4]) then selected = i end end elseif isMouseInPosition (829,362,52, 53) and selected then local dados = getElementData(localPlayer, "mochila") or {} usarItem(config.Itens[dados[selected].id].nome, dados[selected].id) end end) function Click2( b ) if b == "left" then for i,v in ipairs(slots) do if isMouseInPosition(v[1]+x,v[2]+y,v[3],v[4]) and selected == i then local dados = getElementData(localPlayer, "mochila"); usarItem(config.Itens[dados[selected].id].nome, dados[selected].id) itemSelect = true; end end end end addEventHandler("onClientDoubleClick", root, Click2) function openInv() if not isEventHandlerAdded("onClientRender", root, Inv) then addEventHandler("onClientRender", root, Inv) showCursor(true) selectSlot = false quantitySelect = 1 manageEdits = false select = false itemSelect = false subWindow = false aba = 1 else removeEventHandler("onClientRender", root, Inv) showCursor(false) end end addEvent("JOAO.openInv", true) addEventHandler("JOAO.openInv", root, openInv) bindKey("b", "down", openInv) addCommandHandler('item', function() GiveItem(localPlayer, 5, 1, true); end); function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == "string" and isElement( pElementAttachedTo ) and type( func ) == "function" then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == "table" and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end addCommandHandler('takeitem', function() TakeItem(localPlayer, 1, 1); end); addEvent("playSound", true) addEventHandler("playSound", resourceRoot, PlaySound)
-
So give me a tip on how to use both within the render and when selecting the rectangle activate the effect image?!
-
because this code is inside the render.
-
my code : dxDrawRectangle(x-4, y-4 -sroll,52, 53, i == selected and dxDrawImage(x-4, y-4 -sroll,52, 53,"assets/img/slot-effect.png") or scrollColor) error : Bad argument @ 'dxDrawRectangle' [expected number at argument 5 , got boolean]