Jump to content

Tommy.

Members
  • Posts

    226
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Tommy.

  1. Bom, da para você fazer o seu próprio sistema de tag ou editar um pronto. community/admins_tags
  2. Na linha 71 altera para: exports [ "kmkscoreboard" ]:addScoreboardColumn("Profissão", "Profissão", 4, 100) EDIT: Não testei.
  3. Para a gente puder te ajudar, você vai ter que enviar os códigos do scoreboard.
  4. local vehicleSlotID = 0 addCommandHandler("car",function(source,cmd, vehicle) if not isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) then return end if not vehicle then return outputChatBox("/"..cmd.." [ID/ VehicleName]",source) end local playerX, playerY, playerZ = getElementPosition(source) local vehID = tonumber(vehicle) and tonumber(vehicle) or getVehicleModelFromName(vehicle)
  5. Se eu não me engano(posso estar enganado.) Quando você freeza um player a animação é cancelada. O que você pode fazer, ao invés de usar freeze você desativar pra ele conseguir andar. toggleControl
  6. Sim, é possível. Basta usar shaders. TÓPICOS: SHADER CLOTHES By leozin99 clothes shader... By Arsilex [QUESTION] Custom clothes with shaders By Awang
  7. Na verdade a foto do inventário aparece, mas a foto do loot está por cima, o que você pode fazer para resolver é quando ele marcar algo do inventário ele desmarcar do loot dai ele não vai renderizar a foto do item que ta selecionado
  8. Bom, para fazer isso é só alterar a sua gamemode play, basta fazer uma alteração no spawnPlayer
  9. Envie a tabela skins e uma parte do client-side para que eu possa entender melhor o seu código.
  10. Você consegue explicar o que está tentando fazer ?
  11. Para remover a cor você vai usar a função: function removeHex (s) if type (s) == "string" then while (s ~= s:gsub ("#%x%x%x%x%x%x", "")) do s = s:gsub ("#%x%x%x%x%x%x", "") end end return s or false end Para colocar a bandeira do país você seta ela quando ele logar. dai é só criar o dxDrawImage com o elementData function showcountry() local flag = exports.admin:getPlayerCountry ( source ) if flag then setElementData(source,"Home",":admin/client/images/flags/"..flag..".png") else flag = "N/A" end end addEventHandler("onPlayerJoin",getRootElement(),showcountry)
  12. O objeto está sendo criado na tabela obejctItem com o argumento counter, esse counter vem de onde? eu não vi a origem dele no seu código. Aguardo a resposta para lhe ajudar.
  13. Testei o código e está funcionando perfeitamente, só spawnou 1 veículo.
  14. function chePlayergr(player,x,y,z,baseName) if isElement(player) and getElementType(player) == "player" then cheTimer = setTimer(function(player,baseName) if not((getElementData(player,"Group") == getGroupNameFromBaseName(baseName)) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))) then setElementPosition(player,x,y,z+1) end end,2000, 1,player,baseName) end end EDIT: Não testei!
  15. Eu li minha resposta ali em cima e peço perdão pela a ignorância, esse não foi o intuito. Bom se ele for realmente usar o banco de dados interno da para ele usar a função que você disse. executeSQLQuery, mas eu não recomendo. Vamos aguardar a resposta dele sobre o meu "guia".
  16. Tenta isso: outputChatBox("* #FF7F00("..hours..":"..minutes..":"..second..") #FF7F00- #ffffff"..getPlayerName(source).. "("..getElementData(source, "ID")..")#FF7F00 - #FF7F00 "..removeHex(tresc), gracze, 255, 255, 255, true)
  17. function removeHex(s) if type(s) == "string" then while(string.find(s, "#%x%x%x%x%x%x")) do s = string.gsub(s, "#%x%x%x%x%x%x","") end end return s end addEventHandler('onPlayerChangeNick', root, function(old, new) local noHex = removeHex(new) if noHex ~= new then cancelEvent() end end) addEventHandler('onPlayerJoin', root, function() local pName = getPlayerName(source) local newNick = removeHex(pName) if newNick ~= pName then setPlayerName(source, newNick) end end) addEventHandler("onPlayerChat", root, function(message, messageType) if message and messageType == 0 then cancelEvent() outputChatBox(removeHex(getPlayerName(source))..": #FFFFFF"..removeHex(message), root, 255, 255, 255, true ) end end) EDIT: Não testei
  18. Eu não entendi muito bem o seu problema, mas vou falar uma possível solução para o que eu entendi. O GTA:SA Tem um limite de objetos na tela, se tiver muitos os mais longes iram sumir, uma forma(gambiarra) de resolver isso é você ligar o "Editor" esperar dar uma carregada em tudo e dar um restart na sua gamemode.
  19. https://community.multitheftauto.com/index.php?p=resources&s=details&id=13506 Para fazer com os riscos é só você editar a imagem que vai ter.
  20. *Não postei meu código pois simplesmente não consegui fazer um... hahah Como sabes que ele ta usando a interna? em nenhum momento ele falou, kk
  21. Espero que você esteja com vontade de aprender, Irei lhe passar todas as funções que você vai precisar, Se der algum erro só falar aqui, que vou te ajudar. dbConnect, dbExec, dbPoll, dbQuery Primeiro de tudo você usa o dbConnect para conectar com o sqlite. db = dbConnect("sqlite", "database.db") Agora para criar as tabelas no banco de dados você vai usar o dbExec dbExec(db, "CREATE TABLE IF NOT EXISTS NOME_TABELA (ID, Carro, Estoque)") Para você saber se o Carro já está cadastrado no banco de dados para fazer a alteração do Estoque você vai usar o dbPoll e dbQuery local data = dbPoll(dbQuery(db, "SELECT * FROM NOME_TABELA WHERE Carro = ? ", "Camaro"), -1) Agora você vai verificar se na coluna "Carro" da tabela "NOME_TABELA" tem o carro chamado "Camaro" if #data >= 1 then -- se for <= 0 o carro não vai estar cadastrado (ou seja ele não existe no banco de dados) Para atualizar o valor você vai usar o dbQuery dbQuery(db, "UPDATE NOME_TABELA SET Estoque = ? WHERE Carro = ?", 2, "Camaro") -- Com esse exemplo ele vai setar 2 em "Estoque" do "Carro" Camaro Caso o Camaro não esteja cadastrado e você queira cadastrar por comando, você vai usar também o dbQuery dbQuery(db, "INSERT INTO NOME_TABELA VALUES(?, ?, ?)", getFreeID(), "Camaro", 0) Require para pegar um ID livre/único para cada veículo cadastrado: function getFreeID() local result = dbPoll(dbQuery(db, "SELECT ID FROM NOME_TABELA ORDER BY ID ASC"), -1) newID = false for i, id in pairs (result) do if id["ID"] ~= i then newID = i break end end if newID then return newID else return #result + 1 end end
  22. Estranho não funcionar, fez tudo certo? Colocou no lado certo?
  23. Só usar: local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local vzrx, vzry = (screenW/resW), (screenH/resH) LuaObject = {} LuaObject.__index = LuaObject LuaObject.name = "LuaObject" function LuaObject:new() local self = self or setmetatable({}, LuaObject) return self end function LuaObject:init() return self end function LuaObject:dispose() return self end function LuaObject.getSingleton(class) if(type(class) == "table") then if(not class.instance) then class.instance = class() end return class.instance elseif(type(class) == "string" and _G[class]) then if(not _G[class].instance) then _G[class].instance = _G[class]() end return _G[class].instance end end function Class(name, super, static) if(not super) then super = LuaObject end local class = {} setmetatable(class, super) class.__index = class class.__parent = super class.name = name _G[name] = class super.__call = function(c, ...) return c.new():init(...) end class.getSuperclass = function() return class.__parent end class.getClassName = function() return name end class.getInstance = function() return LuaObject.getSingleton(class) end function class:new() local self = self or setmetatable({}, class) super.new(self) return self end if(static) then setfenv(static, setmetatable({static = class, super = super}, { __index = _G })) static() end return class end local super = Class("Grid", LuaObject, function() static.font1 = dxCreateFont("utils/font.ttf", vzrx*10) static.font_10 = dxCreateFont("utils/font.ttf", vzrx*10) static.sx, static.sy = guiGetScreenSize() static.constructors = {} end).getSuperclass() local cursorOn; function Grid:init(x, y, w, h, postGUI) self.x = x self.y = y self.w = w self.h = h self.originalH = h self.columHeight = 30 self.itemHeight = 25 self.maxItems = self:getMaxPosition(); -- Max items self.pg = postGUI or false; self.items = {}; self.scrollTop = y + 18 + 2 self.listPos = 0; -- Scroll Level self.mo = nil; -- Mouse-on item self.visible = true -- Visible table.insert(Grid.constructors,self) return self end function Grid:destroy() for k, v in pairs(Grid) do if (v == self) then Grid[k] = nil end end return true end function Grid:setItemText(id, column, text) if self.items[column] and self.items[column][id] then self.items[column][id].text = text end end function Grid:setItemColor(id, column, r, g, b) if self.items[column] and self.items[column][id] then local color = tonumber(b) and tocolor(r, g, b) or tocolor(255, 255, 255) self.items[column][id].color = color end end function Grid:setVisible(visible) self.visible = visible end function Grid:isVisible() return self.visible end function Grid:addColumn(title, width) local data = { info = {title = title, width = width} }; table.insert (self.items, data); return #self.items; end function Grid:RemoveColumn(colum) self.items[colum] = nil; -- Recalculate the highest item count local highest = 0; for _, v in ipairs(self.items) do if #v > highest then highest =(#v - 1); end end return true end function Grid:getColumnCount() return #self.items end function Grid:addItem(colum, text, data, r, g, b) if self.items[colum] then local color = tonumber(b) and tocolor(r, g, b) or tocolor(255, 255, 255) table.insert(self.items[colum], {id = #self.items[colum] + 1, text = tostring(text), data = data, color = color}); self.h = self.columHeight + (self.maxItems*self.itemHeight) return #self.items[colum]; end end function Grid:removeItem( column, id) if self.items[column] and self.items[column][id] then -- Reset the selected item if necessary² if id == self.selected then local newItem = self.selected - 1 if newItem <= #self.items[colum] then self.selected = math.max(0, newItem); else self.selected = 0 end end table.remove(self.items[column], id); return true; end end function Grid:getItemCount(colum) if self.items[colum] then return #self.items[colum] end end function Grid:clear() for k, v in ipairs (self.items) do self.items[k] = {info = v.info} end self.selected = nil end function Grid:getSelectedItem() return self.selected; end function Grid:setSelectedItem (id) if id <= #self.items[1] then self.selected = id; end end function Grid:getItemDetails(column, id) if self.items[column] then if self.items[column][id] then return self.items[column][id].text, self.items[column][id].data end end end function paint() -- Is there any gridlist to render? if (#Grid.constructors > 0) then -- Loop through all grid lists for index, self in ipairs (Grid.constructors) do -- Is the gridlist visible? if self.visible then -- Draw the 'gridlist' itself dxDrawRectangle (self.x, self.y, self.w, self.h, tocolor(0, 0, 0, 0), self.pg); dxDrawRectangle(self.x, self.y + self.columHeight, self.w, self.h - self.columHeight, tocolor(0, 0, 0, 0), self.pg) -- Draw the column bar dxDrawRectangle(self.x, self.y, self.w, self.columHeight, tocolor(0, 0, 0, 0), self.pg) -- ScrollBar local uX, uY, uW = (self.x + self.w) + 1, self.y, 18 local b = 4 --UP Arow --[[ dxDrawRectangle(uX + 1, uY + 1, uW - 1, uW - 1, tocolor(0, 0, 0, 50), self.pg) dxDrawLine(uX + b , uY + uW - b, uX + uW/2, uY + b, tocolor(0, 0, 0, 70), 1, self.pg) dxDrawLine(uX - b + uW, uY + uW - b, uX + uW/2 , uY + b , tocolor(0, 0, 0, 70), 1, self.pg) --dxDrawLine(uX + b , uY + uW - b, uX + uW - b, uY + uW - b, tocolor(0, 0, 0, 70), 1, self.pg) ]] --DOWN Arow local dX, dY, dW, dH = (self.x + self.w) + 1, self.y + (self.h-18) + 1, 18 - 1, 18 - 1 --[[dxDrawRectangle(dX + 1, dY + 1, dW - 1, dW - 1, tocolor(0, 0, 0, 50), self.pg) dxDrawLine(dX + b , dH + dY - dW + b, dX + dW/2, dH + dY - b, tocolor(0, 0, 0, 70), 1, self.pg) dxDrawLine(dX + dW - b , dH + dY - dW + b, dX + dW/2, dH + dY - b, tocolor(0, 0, 0, 70), 1, self.pg) --dxDrawLine(dX + b , dH + dY - dW + b , dX + dW - b , dH + dY - dW + b, tocolor(0, 0, 0, 70), 1, self.pg) ]] --Thumb local x, y, w, h = (self.x + self.w) + 2, self.y + 18 + 2, 18 - 2, self.h - (18*2) - 2 --dxDrawRectangle(x, y, w, h, tocolor(0, 0, 0, 90)) local maxHeight = h self.thumbHeight = math.max(math.min(math.floor(maxHeight * self.maxItems / (#self.items[1])),maxHeight),18) local maxY = (y+h)-self.thumbHeight if (getKeyState("mouse1")) then if (isMouseInPosition(uX, uY, uW, uW)) then if (#self.items[1] > self.maxItems) then self.scrollTop = math.max(y,math.min(self.scrollTop - 1*maxHeight/100, maxY)) self.listPos = math.floor(((self.scrollTop - y) / (maxHeight-self.thumbHeight) * 100) * (#self.items[1]-self.maxItems) / 100) end elseif (isMouseInPosition(dX, dY, dW, dH)) then if (#self.items[1] > self.maxItems) then self.scrollTop = math.max(y,math.min(self.scrollTop + 1*maxHeight/100, maxY)) self.listPos = math.floor(((self.scrollTop - y) / (maxHeight-self.thumbHeight) * 100) * (#self.items[1]-self.maxItems) / 100) end end end if drag then local _, cy = getCursorPosition() local cy = cy*Grid.sy self.scrollTop = math.max(y,math.min(cy-space, maxY)) self.listPos = math.floor(((self.scrollTop - y) / (maxHeight-self.thumbHeight) * 100) * (#self.items[1]-self.maxItems) / 100) end local aa = 255 if (isMouseInPosition(x,self.scrollTop,w,self.thumbHeight)) then aa = 110 end -- Set cursorOn variable to the current gridlist, if it's selected self.cursorOn = nil if isMouseInPosition(self.x, self.y, self.w + 18, self.h) then cursorOn = index; end -- Is there any column? if #self.items > 0 then local cWidth = 0 -- Loop through all columns for cIndex, cData in ipairs(self.items) do -- we'll go beyond the gridlist width with this column ? if(( cWidth + cData.info.width) <= self.w) then local x = self.x + cWidth; -- Draw the column title dxDrawText(cData.info.title, x + 10, self.y, cData.info.width + x,(self.columHeight) + self.y, tocolor(255, 255, 255, 220), vzrx*1.4, "arial", "left", "center", true, true, self.pg, true, true); -- Is there any item ? if #cData > 0 then -- Loop the items local k = 0 for i=(self.listPos+1), (math.min(#self.items[1],self.maxItems)+self.listPos) do if cData[i] then -- Draw a rectangle to make it looks like selected dxDrawText(cData[i].text,x + 20,(self.columHeight + self.y)+(self.itemHeight*k),cData.info.width + x,(self.columHeight + self.y)+(self.itemHeight*k) + self.itemHeight, tocolor(255, 255, 255, 200), vzrx*1, Grid.font_10, "left", "center", true, true, self.pg, true, true) if (self.selected == i) then dxDrawRectangle(self.x,(self.columHeight + self.y)+(self.itemHeight*k),self.w,self.itemHeight,tocolor(255, 255, 255, 200), self.pg) dxDrawText(cData[i].text:gsub("#%x%x%x%x%x%x", ""),x + 20,(self.columHeight + self.y)+(self.itemHeight*k),cData.info.width + x,(self.columHeight + self.y)+(self.itemHeight*k) + self.itemHeight, tocolor(0, 0, 0, 220), vzrx*1, Grid.font_10, "left", "center", true, true, self.pg, true, true) end end k = k+1 end end -- Increase cWidth variable (to draw the columns correctly) cWidth = cWidth + cData.info.width; end end end end end end end addEventHandler("onClientRender", root, paint, true, "low-5") function onClientKey(key, press) if isCursorShowing() then if #Grid.constructors > 0 then if cursorOn then local self = Grid.constructors[cursorOn] if press and #key > 6 then if #self.items[1] > self.maxItems then local y = self.y + 18 + 2 local maxHeight = self.h - (18*2) - 2 if (isMouseInPosition(self.x,self.y,self.w+18,self.h)) then if (key == "mouse_wheel_down") then if (#self.items[1] > self.maxItems) then self.listPos = math.ceil(math.max(0,math.min(self.listPos + 1*#self.items[1]/100, #self.items[1]-self.maxItems))) self.scrollTop = y + ((self.listPos / (#self.items[1]-self.maxItems) * 100) * ((maxHeight)-self.thumbHeight) / 100) end elseif (key == "mouse_wheel_up") then if (#self.items[1] > self.maxItems) then self.listPos = math.floor(math.max(0,math.min(self.listPos - 1*#self.items[1]/100, #self.items[1]-self.maxItems))) self.scrollTop = y + ((self.listPos / (#self.items[1]-self.maxItems) * 100) * ((maxHeight)-self.thumbHeight) / 100) end end end end end end end end end addEventHandler("onClientKey", root, onClientKey) function onClientClick(button,state,absoluteX,absoluteY) if (button == "left" and state == "up") then drag = nil else if #Grid.constructors > 0 then if cursorOn then local self = Grid.constructors[cursorOn] local k = 0 for i=(self.listPos+1), (math.min(#self.items[1],self.maxItems)+self.listPos) do if isMouseInPosition(self.x,(self.columHeight + self.y)+(self.itemHeight*k),self.w,self.itemHeight) then self.selected = i end k = k+1 end if (#self.items[1] > self.maxItems) then local x, y, w, h = (self.x + self.w) + 2, self.y + 18 + 2, 18 - 2, self.h - (18*2) - 2 if (isMouseInPosition(x,self.scrollTop,w,self.thumbHeight)) then space = absoluteY-self.scrollTop drag = true elseif(isMouseInPosition((self.x + self.w) + 2,self.y + 18 + 2,18, self.h - (18*2) - 2)) then space = self.thumbHeight/2 drag = true end end end end end end addEventHandler("onClientClick",root,onClientClick) function Grid:getMaxPosition() local pos = 1 while true do if(pos*(24)+(24) <= self.originalH) then pos = pos + 1 else pos = pos - 2 break end end return pos end function isMouseInPosition(x, y, w, h) if (not isCursorShowing()) then return end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) return ((cx >= x and cx <= x + w) and (cy >= y and cy <= y + h)) end --[[ local grid = Grid(400,150,500,500) local colum = grid:addColumn("Colum",200) for k=1, 80 do grid:addItem(colum,(tostring(k))) end showCursor(true)]] EDIT: Não testei!
×
×
  • Create New...