Jump to content

Nakka Lindo

Members
  • Posts

    29
  • Joined

  • Last visited

Details

  • Gang
    Programação.
  • Location
    Rs.
  • Occupation
    Trabalhar.
  • Interests
    Aprender/Programação.

Recent Profile Visitors

904 profile views

Nakka Lindo's Achievements

Advanced Member

Advanced Member (8/54)

0

Reputation

  1. Quero que pegue só a cor que o player está usando
  2. Panel = {} local screenWidth, screenHeight local renderTarget local headerColor = tocolor(0, 0, 0, 227) local headerColor2 = tocolor(0, 0, 0, 240) local itemColor = tocolor(42, 40, 41) local highlightedColor = tocolor(255, 255, 255) colorButtonsList = { { name = "purple" }, { name = "blue" }, { name = "red" }, { name = "orange" }, { name = "green" }, { name = "black" }, { name = "pink" }, { name = "blue2"}, { name = "grey"}, { name = "yellow"}, } local panelWidth = 797 local panelHeight local headerHeight = 60 local itemHeight = 25 local itemsCount = 8 local headerFont local itemFont local columns = { { name = "Matou:", size = 0.1, data = "kills"}, { name = "Morreu:", size = 0.1, data = "deaths"}, { name = "Desativado:", size = 0.1, data = " "}, { name = "Nick:", size = 0.4, data = "name"}, { name = "Equipe:", size = 0.1, data = "team"}, { name = "Fps:", size = 0.1, data = "FPS"}, { name = "Ping:", size = 0.1, data = "ping"}, } setTimer( function() if getPlayerTeam(localPlayer) then setElementData(localPlayer, "team", getTeamName(getPlayerTeam(localPlayer))) end end, 1000, 0) local playersList = {} local playersOnlineCount = 0 local playersOnlineString = "Jogadores online" local scrollOffset = 0 function dxDrawRoundedRectangle(x, y, rx, ry, cor, raio) rx = rx - raio * 2 ry = ry - raio * 2 x = x + raio y = y + raio if (rx >= 0) e (ry >= 0) then dxDrawRectangle(x, y, rx, ry, cor) dxDrawRectangle(x, y - raio, rx, raio, cor) dxDrawRectangle(x, y + ry, rx, raio, cor) dxDrawRectangle(x - raio, y, raio, ry, cor) dxDrawRectangle(x + rx, y, raio, ry, cor) terminar fim local function draw() if renderTarget then dxSetRenderTarget(renderTarget) end local w, h = 500, 50 local y = screenHeight / 2 - panelHeight / 2 local panelX = screenWidth / 2 - panelWidth / 2 dxDrawRoundedRectangle(panelX, y, panelWidth, headerHeight * 2 + itemsCount * itemHeight, headerColor,1) dxDrawRoundedRectangle(panelX, y, panelWidth, headerHeight * 4.07 - itemsCount * itemHeight, headerColor2,1) local x = panelX para i, coluna em ipairs(colunas) do local width = panelWidth * column.size dxDrawText(exports.dpLang:getString(column.name), x, y, x + width, y + headerHeight, tocolor(255, 255, 255), 1, headerFont, "center", "center") x = x + width end y = y + headerHeight local itemY = y for i = scrollOffset + 1, math.min(itemsCount + scrollOffset, #playersList) do local item = playersList local color = itemColor if item.isGroup then color = item.color end if item.isLocalPlayer then color = highlightedColor end x = panelX if item.isGroup then dxDrawText(item.text, x, y, x + panelWidth, y + headerHeight * 0.8, tocolor(255, 255, 255), 1, itemFont, "center", "center", true) else for j, column in ipairs(columns) do local text = item[column.data] local width = panelWidth * column.size dxDrawText(tostring(text), x, y, x + width, y + headerHeight * 0.8, tocolor(255, 255, 255), 1, itemFont, "center", "center", true) x = x + width end end y = y + itemHeight end x = panelX y = itemY + itemsCount * itemHeight dxDrawText(playersOnlineString .. ": " .. tostring(playersOnlineCount), x, y, x + panelWidth, y + headerHeight, tocolor(255, 255, 255), 1, headerFont, "center", "center") if renderTarget then dxSetRenderTarget() end end local function mouseDown() if #playersList <= itemsCount then return end scrollOffset = scrollOffset + 1 if scrollOffset > #playersList - itemsCount then scrollOffset = #playersList - itemsCount + 1 end end local function mouseUp() if #playersList <= itemsCount then return end scrollOffset = scrollOffset - 1 if scrollOffset < 0 then scrollOffset = 0 end end function Panel.start() renderTarget = exports.dpUI:getRenderTarget() screenWidth, screenHeight = exports.dpUI:getScreenSize() addEventHandler("onClientRender", root, draw) headerFont = exports.dpAssets:createFont("Roboto-Regular.ttf", 12) itemFont = exports.dpAssets:createFont("Roboto-Regular.ttf", 12) for i, colorButton in ipairs(colorButtonsList) do local lol = exports.dpUI:getThemeName( colorButton.name) if tostring(colorButtonsList.name) == tostring(lol) then logoNumber = i end end panelHeight = 10 + headerHeight * 2 + itemsCount * itemHeight highlightedColor = tocolor(exports.dpUI:getThemeColor()) lista de jogadores = {} local function addPlayerToList(player, isLocalPlayer) if type(player) == "table" then table.insert(playersList, player) return end local nameString if player:getData("nome de usuário") then nameString = exports.dpUtils:removeHexFromString(player:getData("nome de usuário")) else nameString = getPlayerName(player).." (carregando...)" end table.insert(playersList, { isLocalPlayer = isLocalPlayer, id = player:getData("serverId") or 0, name = player.name:gsub("#%x%x%x%x%x%x%x",""), ping = tostring(player:getPing() or '?'), FPS = player:getData('FPS') or '-', team = tostring(player:getData("team") or "Player"), kills = tostring(player:getData("kills") or 0), mortes = tostring(player:getData("mortes") ou 0), }) end local players = getElementsByType("player") table.sort(players, function (player1, player2) local id1 = player1:getData("serverId") ou 999 local id2 = player2:getData("serverId") ou 999 return id1 < id2 end) playersOnlineCount = #players local function getPlayersWithData(dataName) local t = {} for i = #players, 1, -1 do if players:getData(dataName) then table.insert(t, table.remove(players, i)) end end return t end addPlayerToList(localPlayer, true) if #players > 0 then addPlayerToList({ text = exports.dpLang:getString("tab_panel_group_players"), color = headerColor, isGroup = true} ) for i, player in ipairs(players) do if player ~= localPlayer then addPlayerToList(player) end end end bindKey("mouse_wheel_up", "para baixo", mouseUp) bindKey("mouse_wheel_down", "para baixo", mouseDown) localPlayer:setData("activeUI", "tabPanel") playersOnlineString = exports.dpLang:getString("tab_panel_players_online") se não playersOnlineString então playersOnlineString = "Jogadores online" end end function Panel.stop() removeEventHandler("onClientRender", root, draw) destroyElement(headerFont) destroyElement(itemFont) unbindKey("mouse_wheel_up", "para baixo", mouseUp) unbindKey("mouse_wheel_down", "para baixo", mouseDown) localPlayer:setData("activeUI", false) end local iFPS = 0 local FPS = 0 setTimer(function() localPlayer:setData('FPS', FPS, true) end,5000,0) addEventHandler('onClientRender',root,function() iFPS = iFPS+1 fim) setTimer(function() FPS = iFPS iFPS = 0 final,1000,0)
  3. function Hud_() local colete = math.floor (getPedArmor (getLocalPlayer())); dxDrawImageSection(653, 354, 51, 51, 0, 0, 51, 51, 'assets/Circle.png', 360/100 * colete, 0, 0, tocolor(21, 4, 252, 255), false) end; addEventHandler('onClientRender', root, Hud_)
  4. sound = {}; sound['veh'] = playSound(...) radioSound = { } addEventHandler("onClientResourceStart", resourceRoot, function() bindKey("R", "down", clientToggleRadio) end ) addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) if thePlayer == getLocalPlayer() then local msg = "Pressione 'R' Para Ligar a Rádio." if radioSound[source] == nil then outputChatBox(msg, 255, 255, 255) else if radioSound[source].soundElement == nil then outputChatBox(msg, 255, 255, 255) end end end end ) addEventHandler("onClientSoundStream", root, function(success, length, streamName) if streamName then local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then if radioSound[veh] == nil then return end if radioSound[veh].soundElement == source then end end end end ) addEventHandler("onClientSoundChangedMeta", root, function(streamTitle) if streamTitle then local veh = getPedOccupiedVehicle(getLocalPlayer()) if veh then if radioSound[veh] == nil then return end if radioSound[veh].soundElement == source then outputChatBox("#696969Música: #AA2222 " .. streamTitle, 255, 255, 255, true) end end end end ) addEvent("onServerToggleRadio", true) addEventHandler("onServerToggleRadio", getLocalPlayer(), function(toggle, url, veh, volume) if (sound['veh']) then -- Verificando se existe aquele som na tabela usando o identificador do som. stopSound(sound['veh']); -- Parando o som. sound['veh'] = nil; return end if toggle == true then local x, y, z = getElementPosition(veh) if radioSound[veh] ~= nil then if (sound['veh']) then -- Verificando se existe aquele som na tabela usando o identificador do som. stopSound(sound['veh']); -- Parando o som. sound['veh'] = nil; --local sound = playSound3D(url, x, y, z) sound['veh'] = playSound('som.mp3') if volume ~= nil then end setSoundMinDistance(sound, 6) setSoundMaxDistance(sound, 200) attachElements(sound, veh) radioSound[veh] = {} radioSound[veh].soundElement = sound else local sound = playSound3D(url, x, y, z) sound['veh'] = playSound('som.mp3') if volume ~= nil then end setSoundMinDistance(sound, 6) setSoundMaxDistance(sound, 200) attachElements(sound, veh) radioSound[veh] = {} radioSound[veh].soundElement = sound end else if radioSound[veh] ~= nil then if (sound['veh']) then -- Verificando se existe aquele som na tabela usando o identificador do som. stopSound(sound['veh']); -- Parando o som. sound['veh'] = nil; radioSound[veh].soundElement = nil end end end end end ) addEvent("onServerRadioURLChange", true) addEventHandler("onServerRadioURLChange", getLocalPlayer(), function(newurl, veh, volume) if radioSound[veh] ~= nil then if (sound['veh']) then -- Verificando se existe aquele som na tabela usando o identificador do som. stopSound(sound['veh']); -- Parando o som. sound['veh'] = nil; local x, y, z = getElementPosition(veh) --local sound = playSound3D(newurl, x, y, z) sound['veh'] = playSound('newurl.mp3') if volume ~= nil then end setSoundMinDistance(sound, 6) setSoundMaxDistance(sound, 200) attachElements(sound, veh) radioSound[veh] = {} radioSound[veh].soundElement = sound end end end ) addEvent("onServerVolumeChangeAccept", true) addEventHandler("onServerVolumeChangeAccept", getLocalPlayer(), function(veh, newVolume) if veh then if radioSound[veh] ~= nil then setSoundVolume(radioSound[veh].soundElement, newVolume) end end end ) function clientToggleRadio() triggerServerEvent("onPlayerToggleRadio", getLocalPlayer()) end
  5. esse 'x' é do dxDrawBorderedText , preciso definir nil no usingChat
  6. dxDrawBorderedText(usingChat and 'Digitando...\ncargo' or 'cargo', tostring(cargo) , x - 1 - w / 2.6,y - 1 - h - 14, 0, 0, tocolor(255,255,255), 1.0,"default-bold")
  7. -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- -- Configuração do painel lado cliente -- local NOME_Painel = "PANEL DE DROGAS" local NOME_SERVIDOR = "Brasil Zueira Insana" local cor_letras = tocolor(169, 169, 169, 255) --Obs.: Lembrando que algumas configuracoes devem ser repeitadas no lado do servidor !!! -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- local screenW,screenH = guiGetScreenSize() local resW, resH = 1365,767 local x, y = (screenW/resW), (screenH/resH) gridlist = guiCreateGridList(x*529, y*264, x*160, y*260, false) coluna = guiGridListAddColumn(gridlist, "Players", 0.9) guiSetVisible(gridlist, false) --pesquisarNick = guiCreateEdit(x*529, y*240, x*160, y*20, "", false) --guiSetVisible(pesquisarNick, false) nomeplayerv = getPlayerName(getLocalPlayer()) vendedorv = getPlayerFromName(nomeplayerv) vendedor = vendedorv painel_Drog = false function tag_Drog () dxDrawRectangle(x*514, y*191, x*381, y*400, tocolor(0, 0, 0, 225), false) dxDrawText("Selecione o player", x*527, y*244, x*689, y*234+20, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "bottom", false, false, false, false, false) dxDrawText("Fazer Vendas", x*689, y*380, x*885, y*415, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "bottom", false, false, false, false, false) dxDrawImage(x*685, y*190, x*200, y*200, "GFX/Traficante.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*755, y*445, x*45, y*35, "GFX/Lanca.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*755, y*480, x*45, y*45, "GFX/Maconha.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*810, y*446, x*74, y*34, tocolor(36, 35, 35, isCursorOnElement(x*810, y*446, x*34, y*34) and 255 or 100), false) dxDrawText("Lança", x*699, y*448, x*885, y*480, cor_letras, x*1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText("Vender", x*817, y*446, x*885, y*480, tocolor(255, 255, 255, 255), x*1.35, "default-bold", "left", "center", false, false, false, false, false) dxDrawRectangle(x*810, y*488, x*74, y*34, tocolor(36, 35, 35, isCursorOnElement(x*810, y*488, x*34, y*34) and 255 or 100), false) dxDrawText("Maconha", x*699, y*525, x*885, y*480, cor_letras, x*1.00, "default-bold", "left", "center", false, false, false, false, false) dxDrawText("Vender", x*817, y*530, x*885, y*480, tocolor(255, 255, 255, 255), x*1.35, "default-bold", "left", "center", false, false, false, false, false) dxDrawText(NOME_SERVIDOR, x*524, y*548, x*885, y*565, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "top", false, false, false, false, false) end function abrir () --<<++-- if painel_Drog == false then addEventHandler ("onClientRender", root, tag_Drog) painel_Drog = true --<<++-- showCursor (true) guiSetVisible(gridlist, true) playSoundFrontEnd(20) --guiSetVisible(pesquisarNick, true) else if painel_Drog == true then removeEventHandler ("onClientRender", root, tag_Drog) guiSetVisible(gridlist, false) painel_Drog = false --<<++-- showCursor (false) playSoundFrontEnd(20) --guiSetVisible(pesquisarNick, false) end end end addEvent (NOME_Painel,true) --<<++-- addEventHandler (NOME_Painel,root,abrir) --<<++-- function X () if painel_Drog == true then if ( isCursorOnElement (x*855, y*170, x*40, y*42) ) then removeEventHandler("onClientRender", root, tag_Drog) guiSetVisible(gridlist, false) showCursor (false) painel_Drog = false playSoundFrontEnd(20) end end end addEventHandler ("onClientClick", root, X) function Actualizar() guiGridListClear(gridlist) for index, player in ipairs(getElementsByType("player")) do FILA = guiGridListAddRow(gridlist) guiGridListSetItemText ( gridlist, FILA, coluna, (string.gsub ( getPlayerName(player), '#%x%x%x%x%x%x', '' ) or getPlayerName(player)), false, false) guiGridListSetItemData ( gridlist, FILA, coluna, getPlayerName(player)) end end addEventHandler("onClientPlayerJoin", getRootElement(), Actualizar) addEventHandler("onClientPlayerQuit", getRootElement(), Actualizar) addEventHandler("onClientPlayerChangeNick", getRootElement(), Actualizar) addEventHandler ("onClientResourceStart",getRootElement(), Actualizar) function pegarnick () if source == gridlist then local nomeplayer = guiGridListGetItemData(gridlist, guiGridListGetSelectedItem(gridlist), 1) local jogadorx = getPlayerFromName(nomeplayer) jogador = jogadorx end end addEventHandler ("onClientResourceStart", getRootElement(), pegarnick) addEventHandler ("onClientGUIClick", gridlist, pegarnick, false) addEventHandler("onClientPlayerJoin", getRootElement(), pegarnick) addEventHandler("onClientPlayerQuit", getRootElement(), pegarnick) addEventHandler("onClientPlayerChangeNick", getRootElement(), pegarnick) function add_dg1 (_,state) if painel_Drog == true then if state == "down" then if isCursorOnElement (x*810, y*446, x*74, y*34) then triggerServerEvent ("buyCrack001", getLocalPlayer(), jogador) playSoundFrontEnd(37) end end end end addEventHandler ("onClientClick", root, add_dg1) function money1_c ( ) triggerServerEvent ("money001", getLocalPlayer(), vendedor) end addEvent( "money1_c1", true ) addEventHandler( "money1_c1", root, money1_c ) function money2_c ( ) triggerServerEvent ("money002", getLocalPlayer(), vendedor) end addEvent( "money2_c2", true ) addEventHandler( "money2_c2", root, money2_c ) function add_dg2 (_,state) if painel_Drog == true then if state == "down" then if isCursorOnElement (x*810, y*488, x*74, y*34) then triggerServerEvent ("buyMaconha001", getLocalPlayer(), jogador) playSoundFrontEnd(37) end end end end addEventHandler ("onClientClick", root, add_dg2 ) function isCursorOnElement(x,y,w,h) local mx,my = getCursorPosition () local fullx,fully = guiGetScreenSize() cursorx,cursory = mx*fullx,my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- -- Configuração do painel lado servidor -- local TAG_Drogas = "Gangues" local NOME_Painel = "PANEL DE DROGAS" local button = "f7" -- Botão para Abrir -- local nome_comando = "abrirdrogas" -- comando para abrir via t/ -- function infos_dro(player) outputChatBox("----------------------------------------------------------", player, 255, 255, 255) outputChatBox("* [F7] Gangs painel de venda", player, 255, 255, 255) outputChatBox("* /abrirdrogas Gangs painel de venda", player, 255, 255, 255) outputChatBox("* /aceitardroga", player, 255, 255, 255) outputChatBox("* /resetdrogas", player, 255, 255, 255) outputChatBox("* /drogaspen", player, 255, 255, 255) outputChatBox("* /getdrogas", player, 255, 255, 255) outputChatBox("* /lanca", player, 255, 255, 255) outputChatBox("* /maconha", player, 255, 255, 255) outputChatBox("----------------------------------------------------------", player, 255, 255, 255) end addCommandHandler ("drogas", infos_dro) -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- function painel_Drog(thePlayer) --<<++-- login = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user."..login, aclGetGroup(TAG_Drogas)) then triggerClientEvent(thePlayer, NOME_Painel, getRootElement()) else end end addCommandHandler (nome_comando, painel_Drog) --<<++-- function onResStartlr() for index, player in ipairs(getElementsByType("player")) do bindKey(player, button , "down", painel_Drog) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStartlr) function onPlayerJoinlr() bindKey(source, button , "down", painel_Drog) --<<++-- end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinlr) function cleanAlllr(player) for index, player in ipairs(getElementsByType("player")) do unbindKey(player, button , "down", painel_Drog) end end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), cleanAlllr) -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- function buyCrack001(jogador) local dinheiro = getPlayerMoney(jogador) if dinheiro >= 2500 + (getElementData(jogador, "p_noia") * 2500) then setElementData(jogador, "p_noia", getElementData(jogador, "p_noia") + 1) outputChatBox("[Vendedor]: Está aguardado confirmar a compra de 1 lança /aceitardroga !!!", jogador, 0, 255, 0) outputChatBox("[painelDG]: Voce vendeu drogas para jogador selecionado !!!", source, 0, 255, 0) else outputChatBox("[painelDG]: O comprador vai ficar sem grana para finalizar a compra !!!", source, 255, 0, 0) end end addEvent("buyCrack001", true) addEventHandler ( "buyCrack001", getRootElement(), buyCrack001) function buyMaconha1(jogador) local dinheiro = getPlayerMoney(jogador) if dinheiro >= 3000 + (getElementData(jogador, "p_laerva") * 3000) then setElementData(jogador, "p_laerva", getElementData(jogador, "p_laerva") + 1) outputChatBox("[Vendedor]: Está aguardado confirmar a compra de 1 Maconha /aceitardroga !!!", jogador, 0, 255, 0) outputChatBox("[painelDG]: Voce vendeu drogas para jogador selecionado !!!", source, 0, 255, 0) --triggerClientEvent ( jogador, "money1_c1", vendedor ) else outputChatBox("[Vendedor]: O comprador vai ficar sem grana para finalizar a compra !!!", source, 255, 0, 0) end end addEvent("buyMaconha001", true) addEventHandler ( "buyMaconha001", getRootElement(), buyMaconha1) -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- function money001(vendedor) givePlayerMoney ( vendedor, 2500 ) outputChatBox("[painelDG]: Voce vendeu e recebeu 2500 !!!", vendedor, 0, 255, 0) end addEvent("money001", true) addEventHandler ( "money001", getRootElement(), money001) function money002() givePlayerMoney ( vendedor, 3000 ) outputChatBox("[painelDG]: Voce vendeu e recebeu 3000 !!!", vendedor, 0, 255, 0) end addEvent("money002", true) addEventHandler ( "money002", getRootElement(), money002) -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- function buyDrogas(player, command) if command == "aceitardroga" then local dataCrack1 = getElementData(player, "p_noia") if dataCrack1 and tonumber(dataCrack1) > 0 then local dinheiro = getPlayerMoney(player) if dinheiro >= 2500 then local acc = getPlayerAccount(player) takePlayerMoney(player, 2500) setElementData(player, "p_noia", getElementData(player, "p_noia") - 1) setElementData(player, "noia", getElementData(player, "noia") + 1) setAccountData(acc, "noia", getElementData(player, "noia")) triggerClientEvent ( player, "money1_c1", player ) outputChatBox("[Vendedor]: Você comprou 1 unidade de lança", player, 0, 255, 0) else outputChatBox("[Vendedor]: Voce nao tem drogas a compra !!!", player, 255, 0, 0) end else outputChatBox("[Vendedor]: Voce nao tem drogas a compra !!!", player, 255, 0, 0) end end end addCommandHandler ("aceitardroga", buyDrogas) function buyDrogas2(player, command) if command == "aceitardroga" then local datalaerva1 = getElementData(player, "p_laerva") if datalaerva1 and tonumber(datalaerva1) > 0 then local dinheiro = getPlayerMoney(player) if dinheiro >= 3000 then local acc = getPlayerAccount(player) takePlayerMoney(player, 3000) setElementData(player, "p_laerva", getElementData(player, "p_laerva") - 1) setElementData(player, "laerva", getElementData(player, "laerva") + 1) setAccountData(acc, "laerva", getElementData(player, "laerva")) triggerClientEvent ( player, "money2_c2", player ) outputChatBox("[Vendedor]: Você comprou 1 unidade de Maconha", player, 0, 255, 0) else outputChatBox("[Vendedor]: Voce nao tem drogas a compra !!!", player, 255, 0, 0) end else outputChatBox("[Vendedor]: Voce nao tem drogas a compra !!!", player, 255, 0, 0) end end end addCommandHandler ("aceitardroga", buyDrogas2) -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- function reset_drogas(player) setElementData(player, "p_noia", 0) setElementData(player, "p_laerva", 0) setElementData(player, "noia", 0) setElementData(player, "laerva", 0) outputChatBox("[Vendedor]: Você resetou todas as drogas", player, 255, 0, 0) end addCommandHandler ("resetdrogas", reset_drogas) function getpendentes(player) local dataCrack2 = getElementData(player, "p_noia") local datalaerva2 = getElementData(player, "p_laerva") outputChatBox("[Vendedor]: Voce tem "..dataCrack2.." de Lança e "..datalaerva2.." de Maconha pendentes.", player, 255, 255, 255) end addCommandHandler ("drogaspen", getpendentes) function getdrogas(player) local dataCrack1 = getElementData(player, "noia") local datalaerva1 = getElementData(player, "laerva") outputChatBox("[Vendedor]: Voce tem "..dataCrack1.." de Lança e "..datalaerva1.." de Maconha.", player, 255, 255, 255) end addCommandHandler ("getdrogas", getdrogas) -------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------- function onResourceStart() local players = getElementsByType("player") for i, p in ipairs(players) do local sourceAccount = getPlayerAccount(p) if isGuestAccount(sourceAccount) then setElementData(p, "p_noia", 0) setElementData(p, "noia", 0) setElementData(p, "p_laerva", 0) setElementData(p, "laerva", 0) else if getAccountData(sourceAccount, "noia") then setElementData(p, "noia", getAccountData(sourceAccount, "noia")) end if getAccountData(sourceAccount, "laerva") then setElementData(p, "laerva", getAccountData(sourceAccount, "laerva")) end if not getAccountData(sourceAccount, "noia") and not getAccountData(sourceAccount, "laerva") then setElementData(p, "noia", 0) setElementData(p, "laerva", 0) end end end end addEventHandler("onResourceStart", resourceRoot, onResourceStart) function onPlayerLogin(_, theCurrentAccount) if getAccountData(theCurrentAccount, "noia") then setElementData(source, "noia", getAccountData(theCurrentAccount, "noia")) end if getAccountData(theCurrentAccount, "laerva") then setElementData(source, "laerva", getAccountData(theCurrentAccount, "laerva")) end end addEventHandler("onPlayerLogin", root, onPlayerLogin) function onPlayerJoin() setElementData(source, "p_noia", 0) setElementData(source, "noia", 0) setElementData(source, "p_laerva", 0) setElementData(source, "laerva", 0) end addEventHandler("onPlayerJoin", root, onPlayerJoin) Consegue ver o por que o vendedor não recebe a droga eo comprador não desconta o dinheiro.
  8. ------------- lado server ------------- function buyDrogas(player, command) if command == "aceitardroga" then local dataCrack1 = getElementData(player, "p_noia") if dataCrack1 and tonumber(dataCrack1) > 0 then local dinheiro = getPlayerMoney(player) if dinheiro >= 2500 then local acc = getPlayerAccount(player) takePlayerMoney(player, 2500) setElementData(player, "p_noia", getElementData(player, "p_noia") - 1) setElementData(player, "noia", getElementData(player, "noia") + 1) setAccountData(acc, "noia", getElementData(player, "noia")) triggerClientEvent ( "money1_c1", root ) outputChatBox("[Vendedor]: Você comprou 1 unidade de lança", player, 0, 255, 0) else outputChatBox("[Vendedor]: Voce nao tem drogas a compra !!!", player, 255, 0, 0) end else outputChatBox("[Vendedor]: Voce nao tem drogas a compra !!!", player, 255, 0, 0) end end end addCommandHandler ("aceitardroga", buyDrogas) function money001(vendedor) givePlayerMoney ( vendedor, 2500 ) outputChatBox("[painelDG]: Voce vendeu e recebeu 2500 !!!", vendedor, 0, 255, 0) end addEvent("money001", true) addEventHandler ( "money001", getRootElement(), money001) ---------------------- lado client ---------------------- local nomeplayerv = getPlayerName(getLocalPlayer()) local vendedorv = getPlayerFromName(nomeplayerv) vendedor = vendedorv function money1_c ( vendedor ) triggerServerEvent ("money001", getLocalPlayer(), vendedor) end addEvent( "money1_c1", true ) addEventHandler( "money1_c", root, money1_c ) -- "os triggerClientEvent e triggerServerEvent não estão se comunicando"
  9. Era isso mesmo obrigado. Vou postar no correto na proxima.
  10. local playerList = guiCreateGridList(0.80, 0.40, 0.15, 0.35, true) guiGridListAddColumn(playerList, "Player", 0.85) for _, player in ipairs(getElementsByType("player")) do guiGridListAddRow(playerList, getPlayerName(player)) end
  11. function onClientRender1() local screenW, screenH = guiGetScreenSize() --[[Ful screen]] local vida = getElementHealth(localPlayer) -- Valor da vida do jogador local colete = getPedArmor(localPlayer) -- Valor do colete do jogador dxDrawRectangle(screenW * 0.4870, screenH * 0.4005, screenW * 0.0260, screenH * 0.0046, tocolor(0, 0, 0, 250), false)--VIDA dxDrawLine((screenW * 0.4870) - 1, (screenH * 0.4005) - 1, (screenW * 0.4870) - 1, screenH * 0.4051, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5130, (screenH * 0.4005) - 1, (screenW * 0.4870) - 1, (screenH * 0.4005) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.4870) - 1, screenH * 0.4051, screenW * 0.5130, screenH * 0.4051, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5130, screenH * 0.4051, screenW * 0.5130, (screenH * 0.4005) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.4870, screenH * 0.4005, screenW * 0.0260 * colete/100, screenH * 0.0046, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.4870, screenH * 0.4074, screenW * 0.0260, screenH * 0.0046, tocolor(0, 0, 0, 250), false)--COLETE dxDrawLine((screenW * 0.4870) - 1, (screenH * 0.4074) - 1, (screenW * 0.4870) - 1, screenH * 0.4120, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5130, (screenH * 0.4074) - 1, (screenW * 0.4870) - 1, (screenH * 0.4074) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.4870) - 1, screenH * 0.4120, screenW * 0.5130, screenH * 0.4120, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5130, screenH * 0.4120, screenW * 0.5130, (screenH * 0.4074) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.4870, screenH * 0.4074, screenW * 0.0260 * vida/100, screenH * 0.0046, tocolor(100, 224, 0, 250), false) end Teria como deixar minha vida/colete mostrando só para os outros players?
×
×
  • Create New...