Deniel

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Deniel

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Server.Lua function IniciarVendaArmas (source, Arma_Selecionada, getID, getPreco, getMunicao, WeaponID) local Jogador = getPlayerID(getID) local Preco = tonumber(getPreco) local Municao = tonumber(getMunicao) local MunicaoAtual = getElementData(source, "TS:MuniAtual") or 0 if not Jogador then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffJogador não encontrado!") return end if source == Jogador then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê não pode vender arma para você mesmo!") return end --if getElementData(Jogador, "TS:Vendedor") then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador já esta em uma negociação!") return end if tonumber(MunicaoAtual) < tonumber(getMunicao) then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê não tem essa munição!") else local Posx, Posy, Poz = getElementPosition ( source ) local Posx1, Posy1, Pos1z = getElementPosition ( Jogador ) local Distancia = getDistanceBetweenPoints3D ( Posx, Posy, Poz, Posx1, Posy1, Pos1z ) if Distancia > 3 then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador está muito longe!") return end setElementData(source, "TS:Cliente", Jogador) setElementData(Jogador, "TS:Vendedor", source) setElementData(source, "TS:Preco", getPreco) setElementData(source, "TS:Muni", Municao) setElementData(source, "TS:NomeArma", Arma_Selecionada) triggerClientEvent(Jogador, "TS:ConfirmacaoWeapon", Jogador) end end addEvent ("TS:IniciarVendaArmas", true) addEventHandler ("TS:IniciarVendaArmas", root, IniciarVendaArmas) function Rejeitado () local Vendedor = getElementData(source, "TS:Vendedor") if Vendedor then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador recusou a negociação!") triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê rejeitou a negociação!") setElementData(Vendedor, "TS:Cliente", nil) setElementData(source, "TS:Vendedor", nil) setElementData(Vendedor, "TS:Preco", nil) setElementData(Vendedor, "TS:Muni", nil) setElementData(Vendedor, "TS:IDArma", nil) setElementData(Vendedor, "TS:NomeArma", nil) end end addEvent ("TS:Rejeitado", true) addEventHandler ("TS:Rejeitado", root, Rejeitado) function AceitarWeapon () local Vendedor = getElementData(source, "TS:Vendedor") if Vendedor then local Preco = tonumber(getElementData(Vendedor, "TS:Preco")) or 0 local Municoes = getElementData(Vendedor, "TS:Muni") or 5 local IDArmaTS = tonumber(getElementData(Vendedor, "TS:IDArma")) or 0 local NomeArma = getElementData(Vendedor, "TS:NomeArma") or "Error" local MunicaoAtual = getElementData(Vendedor, "TS:MuniAtual") or 0 local MunicaoTotalVendedor = MunicaoAtual - Municoes if getPlayerMoney(source) < Preco then triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffDinheiro Insuficiente!") triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador não tem dinheiro suficiente!") setElementData(Vendedor, "TS:Cliente", nil) setElementData(source, "TS:Vendedor", nil) setElementData(Vendedor, "TS:Preco", nil) setElementData(Vendedor, "TS:Muni", nil) setElementData(Vendedor, "TS:IDArma", nil) setElementData(Vendedor, "TS:NomeArma", nil) return end takePlayerMoney(source, Preco) givePlayerMoney(Vendedor, Preco) takeWeapon(Vendedor, IDArmaTS, Municoes) giveWeapon(source, IDArmaTS, Municoes, true ) setElementData(Vendedor, "TS:Cliente", nil) setElementData(source, "TS:Vendedor", nil) setElementData(Vendedor, "TS:Preco", nil) setElementData(Vendedor, "TS:Muni", nil) setElementData(Vendedor, "TS:IDArma", nil) setElementData(Vendedor, "TS:NomeArma", nil) triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffO jogador aceitou a negociação !") triggerClientEvent(source, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffVocê aceitou a negociação!") end end addEvent ("TS:AceitarWeapon", true) addEventHandler ("TS:AceitarWeapon", root, AceitarWeapon) function getPlayerID(id) v = false for i, player in ipairs (getElementsByType("player")) do if getElementData(player, "ID") == id then v = player break end end return v end O problema é que da pra bugar o dinheiro na hora de vender a arma. O cara vende por -999999 e o cara que compra fica com a grana toda. Vocês conhecem alguma function para evitar que eles coloquem caracteristicas EX: -,+, . ,=
  2. local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local font2 = dxCreateFont("gfx/Blix-Black.ttf", 19) local dxfont1_font = dxCreateFont("gfx/font.ttf", 11) local dxfont2_font = dxCreateFont("gfx/font.ttf", 10) gridListDoar = guiCreateGridList(495, 302, 176, 257, false) colunaDoar = guiGridListAddColumn(gridListDoar, "Jogadores", 0.9) guiGridListSetSelectionMode(gridListDoar, 2) guiSetAlpha(gridListDoar, 0.50) guiSetVisible(gridListDoar, false) editBoxDoar = guiCreateEdit(724, 343, 184, 23, tonumber("0"), false) guiSetVisible(editBoxDoar, false) guiSetAlpha(editBoxDoar, 0.50) guiEditSetMaxLength(editBoxDoar, 85555) for _, player in ipairs(getElementsByType("player")) do local rowDoar = guiGridListAddRow(gridListDoar) guiGridListSetItemText(gridListDoar, rowDoar, colunaDoar, getPlayerName(player), false, false) guiGridListSetItemColor(gridListDoar, rowDoar, colunaDoar, 0, 255, 145) end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function SetAll() if (trans == true) then if tonumber(guiGetText(editBoxDoar)) ~= nil then totalDoar = tonumber(guiGetText(editBoxDoar)) end end end setTimer(SetAll, 50, 0) cor = {} totalDoar = 0 trans = false function server() local dinheiro = exports.dinheirosujo:getPlayerDirty(getLocalPlayer()) cor[1] = tocolor(255,255,255,255) cor[2] = tocolor(0, 0, 0, 140) if cursorPosition(x*948,y*259,x*962,y*288) then cor[1] = tocolor(255,0,0,255) end if cursorPosition(x*774,y*376,x*91,y*27) then cor[2] = tocolor(247, 142, 7, 200) end dxDrawRectangle(474, 265, 498, 323, tocolor(0, 0, 0, 226), false) dxDrawRectangle(474, 265, 498, 26, tocolor(0, 0, 0, 187), false) dxDrawText("Enviar Dinheiro Sujo", 473, 265, 972, 292, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*774,y*376,x*91,y*27,cor[2], false) dxDrawText("Enviar", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Dinheiro SUJO : "..dinheiro,x*756,y*413,x*1040,y*430, tocolor(255, 255, 255, 255), 1.00, dxfont2_font, "left", "top", false, false, false, false, false) end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function getGridlistPlayer() local player = getPlayerFromName(guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1)) if (player) then return player end end function dxDrawXeets(absX, absY, sizeX, sizeY, color, ancho) dxDrawRectangle(absX, absY, sizeX, ancho, color) dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color) dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color) dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho * 2, color) end function onGridClick() local player = getGridlistPlayer() if (player == "" or player == nil) then return else triggerServerEvent("onGridClick", getLocalPlayer(), player) end end function refreshDoar() guiGridListClear(gridListDoar) if coluna then for _, playeritem in ipairs(getElementsByType("player")) do local rowDoar = guiGridListAddRow(gridListDoar) setTimer(guiGridListSetItemText, 2000, 1, gridListDoar, rowDoar, colunaDoar, getPlayerName(playeritem), false, false) setTimer(guiGridListSetItemColor, 2000, 1, gridListDoar, rowDoar, colunaDoar, 0, 255, 145) end end end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function convertNumber(number) local formated = number while true do formated, k = string.gsub(formated, "^(-?%d+)(%d%d%d)", "%1,%2") if (k == 0) then break end end return formated end local componentes = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo"} local tableSkins = {1, 2, 7, 9, 10, 11, 12, 14, 15, 16, 18, 28, 310, 311, 312} function enviar(_,state) if trans == true then if state == "down" then if cursorPosition(x*774,y*376,x*91,y*27) then selectedDoar = guiGridListGetItemText(gridListDoar, guiGridListGetSelectedItem(gridListDoar), 1) amount = guiGetText(editBoxDoar) triggerServerEvent("onGridClickDoar", getLocalPlayer(), selectedDoar, amount) end end end end addEventHandler ("onClientClick", root, enviar) function OpenTrasf() if trans == false then showCursor (true) addEventHandler ("onClientRender", root, server) trans = true guiSetVisible (gridListDoar,true) guiSetVisible (editBoxDoar,true) guiSetVisible (coluna,true) else showCursor (false) removeEventHandler ("onClientRender", root,server) trans = false guiSetVisible (gridListDoar,false) guiSetVisible (editBoxDoar,false) guiSetVisible (colunaDoar,false) end end bindKey ("F6", "down", OpenTrasf) function cursorPosition(x, y, w, h) if (not isCursorShowing()) then return false end 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 O painel está funcionando perfeitamente porém, não está atualizando a lista dos players. Exemplo: quando um jogador troca de nome em jogo, o nome dele não muda na lista dentro do painel.
  3. Server.Lua function onGridClick(player) if (not isElement(player)) then return end triggerClientEvent(source, "setPlayerDetails", getRootElement(), player) end addEvent("onGridClick", true) addEventHandler("onGridClick", getRootElement(), onGridClick) local t = {} function checkValues(source, arg1, arg2) if (arg2 >= 60) then t[source]['min'] = tonumber(t[source]['min'] or 0) + 1 t[source]['sec'] = 0 end if (arg1 >= 60) then t[source]['min'] = 0 t[source]['hour'] = tonumber(t[source]['hour'] or 0) + 1 end return arg1, arg2 end function onGridClickDoar(selectedDoar, amount) local dinheiro = exports.dinheirosujo:getPlayerDirty(source) if tonumber(amount) >= 0 then if tonumber(amount) <= dinheiro then playerMoney = getPlayerFromName(selectedDoar) if playerMoney ~= false then exports.dinheirosujo:givePlayerDirty(playerMoney, amount) exports.dinheirosujo:takePlayerDirty(source, amount) name = getPlayerName(source) outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffVoce Enviou #00ff00R$ : " .. amount .. " #FFFFFFPara O Jogador "..selectedDoar, source, 255, 255, 255, true) outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffO Jogador "..name.." #FFFFFFEnviou #00FF00R$ : "..amount, playerMoney, 255, 0, 0, true) else outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffSelecione Um Jogador", source, 255, 0, 0, true) end else outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffVoce Nao Tem Dinheiro Suficiente", source, 255, 0, 0, true) end else outputChatBox("#000000║#ffffff✘ #FFD700Info #ffffff ✘#000000║ - #ffffffUtilize Valores De 1 A 10000", source, 255, 0, 0, true) end end addEvent("onGridClickDoar", true) addEventHandler("onGridClickDoar", getRootElement(), onGridClickDoar) Client.Lua local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local font2 = dxCreateFont("gfx/Blix-Black.ttf", 19) local dxfont1_font = dxCreateFont("gfx/font.ttf", 11) local dxfont2_font = dxCreateFont("gfx/font.ttf", 10) gridListDoar = guiCreateGridList(495, 302, 176, 257, false) colunaDoar = guiGridListAddColumn(gridListDoar, "Jogadores", 0.9) guiGridListSetSelectionMode(gridListDoar, 2) guiSetAlpha(gridListDoar, 0.50) guiSetVisible(gridListDoar, false) editBoxDoar = guiCreateEdit(724, 343, 184, 23, tonumber("0"), false) guiSetVisible(editBoxDoar, false) guiSetAlpha(editBoxDoar, 0.50) guiEditSetMaxLength(editBoxDoar, 85555) for _, player in ipairs(getElementsByType("player")) do local rowDoar = guiGridListAddRow(gridListDoar) guiGridListSetItemText(gridListDoar, rowDoar, colunaDoar, getPlayerName(player), false, false) guiGridListSetItemColor(gridListDoar, rowDoar, colunaDoar, 0, 255, 145) end function SetAll() if (trans == true) then if tonumber(guiGetText(editBoxDoar)) ~= nil then totalDoar = tonumber(guiGetText(editBoxDoar)) end end end setTimer(SetAll, 50, 0) cor = {} totalDoar = 0 trans = false function server() local dinheiro = exports.dinheirosujo:getPlayerDirty(getLocalPlayer()) cor[1] = tocolor(255,255,255,255) cor[2] = tocolor(0, 0, 0, 140) if cursorPosition(x*948,y*259,x*962,y*288) then cor[1] = tocolor(255,0,0,255) end if cursorPosition(x*774,y*376,x*91,y*27) then cor[2] = tocolor(247, 142, 7, 200) end dxDrawRectangle(474, 265, 498, 323, tocolor(0, 0, 0, 226), false) dxDrawRectangle(474, 265, 498, 26, tocolor(0, 0, 0, 187), false) dxDrawText("Enviar Dinheiro Sujo", 473, 265, 972, 292, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*774,y*376,x*91,y*27,cor[2], false) dxDrawText("Enviar", 773, 376, 864, 402, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("Dinheiro SUJO : "..dinheiro,x*756,y*413,x*1040,y*430, tocolor(255, 255, 255, 255), 1.00, dxfont2_font, "left", "top", false, false, false, false, false) end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function getGridlistPlayer() local player = getPlayerFromName(guiGridListGetItemText(gridList, guiGridListGetSelectedItem(gridList), 1)) if (player) then return player end end function dxDrawXeets(absX, absY, sizeX, sizeY, color, ancho) dxDrawRectangle(absX, absY, sizeX, ancho, color) dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color) dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color) dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho * 2, color) end function onGridClick() local player = getGridlistPlayer() if (player == "" or player == nil) then return else triggerServerEvent("onGridClick", getLocalPlayer(), player) end end function refreshDoar() guiGridListClear(gridListDoar) if coluna then for _, playeritem in ipairs(getElementsByType("player")) do local rowDoar = guiGridListAddRow(gridListDoar) setTimer(guiGridListSetItemText, 2000, 1, gridListDoar, rowDoar, colunaDoar, getPlayerName(playeritem), false, false) setTimer(guiGridListSetItemColor, 2000, 1, gridListDoar, rowDoar, colunaDoar, 0, 255, 145) end end end function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function convertNumber(number) local formated = number while true do formated, k = string.gsub(formated, "^(-?%d+)(%d%d%d)", "%1,%2") if (k == 0) then break end end return formated end local componentes = {"armour", "wanted", "weapon", "money", "health", "clock", "breath", "ammo"} local tableSkins = {1, 2, 7, 9, 10, 11, 12, 14, 15, 16, 18, 28, 310, 311, 312} function enviar(_,state) if trans == true then if state == "down" then if cursorPosition(x*774,y*376,x*91,y*27) then selectedDoar = guiGridListGetItemText(gridListDoar, guiGridListGetSelectedItem(gridListDoar), 1) amount = guiGetText(editBoxDoar) triggerServerEvent("onGridClickDoar", getLocalPlayer(), selectedDoar, amount) end end end end addEventHandler ("onClientClick", root, enviar) function OpenTrasf() if trans == false then showCursor (true) addEventHandler ("onClientRender", root, server) trans = true guiSetVisible (gridListDoar,true) guiSetVisible (editBoxDoar,true) guiSetVisible (coluna,true) else showCursor (false) removeEventHandler ("onClientRender", root,server) trans = false guiSetVisible (gridListDoar,false) guiSetVisible (editBoxDoar,false) guiSetVisible (colunaDoar,false) end end bindKey ("F6", "down", OpenTrasf) function cursorPosition(x, y, w, h) if (not isCursorShowing()) then return false end 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 Como eu disse está tudo funcionando só que quando um player troca o nome dele em jogo não aparece no painel, como estou aprendendo ainda não sei se isso é em relação ao getPlayerFromPartialName e getPlayerName.
  4. function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 1158.344, -1293.679, 16.445, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (takeAllWeapons, source, true) setTimer (setPlayerWantedLevel, thePlayer,0, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted)
  5. function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function revistar_jogador ( thePlayer, comando, nick ) if nick then if getPlayerFromPartialName ( nick ) then local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Everyone") ) then -- Acl Pra Quem Pode Usar o Comando local player_a_ser_revistado = getPlayerFromPartialName ( nick ) local dinheiro_do_jogador = getPlayerMoney ( thePlayer, dinheiro_jogador ) local jogadorx, jogadory, jogadorz = getElementPosition ( thePlayer ) local revistadox, revistadoy, revistadoz = getElementPosition ( player_a_ser_revistado ) -- Encontrar posição de quem sera revistado local dist = getDistanceBetweenPoints3D ( jogadorx, jogadory, jogadorz, revistadox, revistadoy, revistadoz ) -- Calcular a distancia entre os dois elementos if ( dist > 5 ) then -- se a distancia for 5 executara a função a seguir outputChatBox("#000000[#808080Anônimo#000000] #c1c1c1Chegue Mais Perto Do Jogador Pra Executar Este Comando!", thePlayer, 255, 255, 255, true) -- Chat Box elseif ( dist < 4 )then -- Caso ao contrario a distancia for 4 executara a função a seguir setPedAnimation( thePlayer, "POLICE", "plc_drgbst_01", 3100, true, false, false, false) setTimer ( function() outputChatBox("#000000[#808080Anônimo#000000] #FFFF00Dinheiro do #ff0000Cidadão #00FF00:"..dinheiro_do_jogador.."", thePlayer, 255, 0, 0, true) end, 3390, 1 ) triggerClientEvent(thePlayer, "doShowDXProgressBar", thePlayer) end end end end end addCommandHandler ( "revi", revistar_jogador ) Este é o Server.Lua onde estou com o problema de revistar porém aparece sempre meu dinheiro e não o do outro player.
  6. A intenção éra fazer um script que quando o player passa no marker ele perde as armas. por favor alguem me ajude. local myMarker = createMarker(2278.8884277344,-1306.3186035156,24.002649307251, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( takeAllWeapons, player ) outputChatBox("Armas removidas", source,255,255,255,true) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) addEventHandler("onMarkerHit", getRootElement(), function() takeAllWeapons(player) onMarkerHit( takeAllWeapons, 1000, 1, player) end) addEventHandler("takeAllWeapons",onMarkerHit,player)