Jump to content

Deniel

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by Deniel

  1. cheguei a está conclusão addEventHandler("onResourceStart", resourceRoot, function() --ID, NIVEL DE SKILL, STATUS, QUANTIDADE setWeaponProperty("30", "pro", "weapon_range", 350) setWeaponProperty("30", "std", "weapon_range", 350) setWeaponProperty("30", "poor", "weapon_range", 350) --MUNICAO PENTE setWeaponProperty("30", "pro", "maximum_clip_ammo", 40) setWeaponProperty("30","std", "maximum_clip_ammo", 40) setWeaponProperty("30","poor", "maximum_clip_ammo", 40) end ) funcionou normalmente, agradeço pela ajuda!
  2. por exemplo se eu fazer isso addEventHandler("onResourceStart", resourceRoot, function() setWeaponProperty("31", "pro", "target_range", 400) setWeaponProperty("31", "pro", "weapon_range", 400) end )
  3. Olá, seria possível aumentar o alcance das armas? utilizando a função: setWeaponProperty
  4. addEvent("progress", true) addEventHandler("progress", getRootElement(), function(client) if (db) then local Drogas = getElementData(client, "Drogas") or 0 setElementFrozen(client, true) setPedAnimation(client, ajuste.animation.animList, ajuste.animation.animDance, ajuste.animation.timePlant, true, false, false, false) outputChatBox(ajuste.texts.plant, client, 255, 255, 255, true) setTimer(function() setElementData(client, "Drogas",getElementData(client, "Drogas") +10) outputChatBox(ajuste.textos.plantarEnd, client, 255, 255, 255, true) --dbFree(dbQuery(db, "INSERT INTO plantacao (ID, nick, marker_id) VALUES (?, ?, ?) ", getElementData(client, "ID"), getPlayerName(client), tonumber(markerTraf), 0)) end,30000, 1) setTimer (setElementFrozen, 30000, 1, client, false) end end) Um script de drogas simples. Porém não da a droga ao jogador, erro no debugscript: ERROR: [DrogaSys]Server.Lua:9: attempt to perfom arithmetic on a boolean value
  5. Não vai adiantar, por que se eu colocar -99 , a munição ainda buga
  6. E quais são os tipo de script que eu poderia usar?
  7. 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 100 local IDArmaTS = tonumber(getElementData(Vendedor, "TS:IDArma")) or 0 local NomeArma = getElementData(Vendedor, "TS:NomeArma") or "Error" local MunicaoAtual = getElementData(Vendedor, "TS:MuniAtual") or 100 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 valor_permitido = 1000000 --/> Altere Caso Queira uma Quantidade Diferente! if Preco >= tonumber(1) and Preco <= tonumber(valor_permitido) then --/> AQUI 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!") else --/> AQUI triggerClientEvent(Vendedor, "addNotification", root, "#0037FF✘#ffffffINFO#0037FF✘➺ #ffffffApenas Permitidos Valores de 1 a 1,000.000!") --/> AQUI end --/> AQUI end end addEvent ("TS:AceitarWeapon", true) addEventHandler ("TS:AceitarWeapon", root, AceitarWeapon) --------- Não mecha 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 Server.Lua local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1366), (screenH/768) local dxfont0_icons = dxCreateFont("font/icons.ttf", x*12) local dxfont1_icons = dxCreateFont("font/icons.ttf", x*11) local ID = createElement("TS:EditBoxArmas") local Preco = createElement("TS:EditBoxArmas") local Municao = createElement("TS:EditBoxArmas") painel = false painel3 = false --[[ ><><><><><><><><><><><><><><><><><><><>< >< Painel Inicial >< ><><><><><><><><><><><><><><><><><><><>< --]] function painelsamu () exports["Blur"]:dxDrawBluredRectangle(screenW * 0.2848, screenH * 0.2839, screenW * 0.4305, screenH * 0.4323, tocolor(255, 255, 255, 230)) dxDrawRectangle(screenW * 0.2848, screenH * 0.2839, screenW * 0.4305, screenH * 0.4323, tocolor(0, 0, 0, 77), false) dxDrawRectangle(screenW * 0.2848, screenH * 0.2839, screenW * 0.4305, screenH * 0.0599, tocolor(0, 0, 0, 167), false) dxDrawLine(screenW * 0.2848, screenH * 0.3424, screenW * 0.7152, screenH * 0.3424, tocolor(5, 0, 217, 254), 3, false) dxDrawText("Enviar Armas", screenW * 0.4641, screenH * 0.2969, screenW * 0.5381, screenH * 0.3229, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false) dxDrawEditBox("ID Do Jogador", screenW * 0.5124, screenH * 0.3659, screenW * 0.1559, screenH * 0.0534, false, 10, ID) dxDrawEditBox("Preço da Arma", screenW * 0.5124, screenH * 0.4648, screenW * 0.1559, screenH * 0.0534, false, 10, Preco) dxDrawEditBox("Quantidade de Munição", screenW * 0.5124, screenH * 0.5534, screenW * 0.1559, screenH * 0.0534, false, 10, Municao) if isCursorOnElement(screenW * 0.3507, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625) then dxDrawImage(screenW * 0.3507, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625, "0.png", 0, 0, 0, tocolor(5, 0, 217, 255), false) else dxDrawImage(screenW * 0.3507, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625, "0.png", 0, 0, 0, tocolor(5, 0, 217, 123), false) end if isCursorOnElement(screenW * 0.5015, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625) then dxDrawImage(screenW * 0.5015, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625, "0.png", 0, 0, 0, tocolor(5, 0, 217, 255), false) else dxDrawImage(screenW * 0.5015, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625, "0.png", 0, 0, 0, tocolor(5, 0, 217, 123), false) end dxDrawText("Enviar Arma", screenW * 0.3763, screenH * 0.6471, screenW * 0.4502, screenH * 0.6732, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false) dxDrawText("Fechar Painel", screenW * 0.5234, screenH * 0.6484, screenW * 0.5974, screenH * 0.6745, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false) end addEventHandler("onClientResourceStart", resourceRoot, function () Lista_Armas = dxGridW:Create(408, 278, 254, 192) Lista_Armas:AddColumn("Armas", 150) Lista_Armas:AddColumn("Muniçao", 70) Lista_Armas:AddColumn("ID", 100) Lista_Armas:SetVisible(false) end) function Refresh_Jogadores () Lista_Armas:Clear(true) for slot = 0, 12 do local Armamento = getPedWeapon ( localPlayer, slot ) local Municao = getPedTotalAmmo ( localPlayer, slot ) if Armamento > 0 then local NomeDaArma = getWeaponNameFromID ( Armamento ) Lista_Armas:AddItem(1, ""..NomeDaArma) Lista_Armas:AddItem(2, ""..Municao) Lista_Armas:AddItem(3, ""..Armamento) end end end function painelsamu2 () local Jogador = getElementData(localPlayer, "TS:Vendedor") local Preco = getElementData(Jogador, "TS:Preco") or "Error" local Municoes = getElementData(Jogador, "TS:Muni") or "Error" local IDArma = getElementData(Jogador, "TS:IDArma") or "Error" local NomeArma = getWeaponNameFromID(IDArma) dxDrawRectangle(screenW * 0.3426, screenH * 0.0130, screenW * 0.3155, screenH * 0.2578, tocolor(0, 0, 0, 123), false) dxDrawRectangle(screenW * 0.3426, screenH * 0.0130, screenW * 0.3155, screenH * 0.0560, tocolor(0, 0, 0, 162), false) dxDrawLine(screenW * 0.3426, screenH * 0.0690, screenW * 0.6589, screenH * 0.0690, tocolor(10, 0, 198, 254), 3, false) dxDrawText("Venda de Armas", screenW * 0.4605, screenH * 0.0260, screenW * 0.5527, screenH * 0.0560, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false) dxDrawText("Algum jogador está querendo te vender uma "..NomeArma.." por #00FF00R$#FFFFFF "..Preco.." \ncom "..Municoes.." Munições. Você deseja:", screenW * 0.3499, screenH * 0.0820, screenW * 0.4422, screenH * 0.1120, tocolor(255, 255, 255, 255), 1.00, dxfont1_icons, "left", "top", false, false, false, true, false) if isCursorOnElement(screenW * 0.3572, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534) then dxDrawImage(screenW * 0.3572, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534, "0.png", 0, 0, 0, tocolor(10, 0, 198, 255), false) else dxDrawImage(screenW * 0.3572, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534, "0.png", 0, 0, 0, tocolor(10, 0, 198, 126), false) end if isCursorOnElement(screenW * 0.5110, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534) then dxDrawImage(screenW * 0.5110, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534, "0.png", 0, 0, 0, tocolor(10, 0, 198, 255), false) else dxDrawImage(screenW * 0.5110, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534, "0.png", 0, 0, 0, tocolor(10, 0, 198, 126), false) end dxDrawText("Comprar", screenW * 0.3865, screenH * 0.1732, screenW * 0.4348, screenH * 0.2031, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false) dxDrawText("Rejeitar", screenW * 0.5410, screenH * 0.1732, screenW * 0.5893, screenH * 0.2031, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "left", "top", false, false, false, false, false) end --[[ ><><><><><><><><><><><><><><><><><><><>< >< Configurações N Altere >< ><><><><><><><><><><><><><><><><><><><>< --]] function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function AbrirArmas () if getElementData(localPlayer, "TS:Cliente") then return end if painel == false then addEventHandler ( "onClientRender", root, painelsamu ) painel = true showCursor ( true ) playSoundFrontEnd ( 43 ) setElementData(ID, "text2", "") setElementData(Preco, "text2", "") setElementData(Municao, "text2", "") Lista_Armas:SetVisible(true) Refresh_Jogadores () end end bindKey("F3", "down", AbrirArmas) function FecharPainel (_,state) if painel == true then if state == "down" then if isCursorOnElement ( screenW * 0.5015, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625 ) then removeEventHandler("onClientRender", root, painelsamu ) showCursor (false) playSoundFrontEnd ( 43 ) painel = false Lista_Armas:SetVisible(false) end end end end addEventHandler ("onClientClick", root, FecharPainel ) function VenderArmas (_,state) if painel == true then if isCursorOnElement ( screenW * 0.3507, screenH * 0.6328, screenW * 0.1127, screenH * 0.0625 ) then local getID = tonumber(getElementData(ID, "text2")) local getPreco = tonumber(getElementData(Preco, "text2")) or 0 local getMunicao = tonumber(getElementData(Municao, "text2")) or 0 local gridItem = Lista_Armas:GetSelectedItem() local Arma_Selecionada = Lista_Armas:GetItemDetails(1, gridItem, 1) or nil local MunicaoAtual = Lista_Armas:GetItemDetails(2, gridItem, 2) or nil local WeaponID = Lista_Armas:GetItemDetails(3, gridItem, 3) or nil removeEventHandler("onClientRender", root, painelsamu ) showCursor (false) playSoundFrontEnd ( 43 ) painel = false Lista_Armas:SetVisible(false) setElementData(localPlayer, "TS:IDArma", WeaponID) setElementData(localPlayer, "TS:MuniAtual", MunicaoAtual) triggerServerEvent( 'TS:IniciarVendaArmas', getLocalPlayer(), localPlayer, Arma_Selecionada, getID, getPreco, getMunicao, WeaponID) end end end addEventHandler ("onClientClick", root, VenderArmas ) painelcomprador = false function ConfirmacaoWeapon () addEventHandler("onClientRender", root, painelsamu2) end addEvent("TS:ConfirmacaoWeapon", true) addEventHandler("TS:ConfirmacaoWeapon", getRootElement(), ConfirmacaoWeapon) function ParteComprador (_,state) if state == "down" then if isCursorOnElement ( screenW * 0.5110, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534 ) then removeEventHandler("onClientRender", root, painelsamu2 ) triggerServerEvent("TS:Rejeitado", localPlayer) elseif isCursorOnElement(screenW * 0.3572, screenH * 0.1628, screenW * 0.1061, screenH * 0.0534) then removeEventHandler("onClientRender", root, painelsamu2 ) triggerServerEvent("TS:AceitarWeapon", localPlayer) end end end addEventHandler ("onClientClick", root, ParteComprador ) 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 Client.Lua Olá, este script está com um bug onde os jogadores conseguem colocar ''-999'' na MUNIÇÃO, bug do dinheiro foi resolvido ( por um membro do fórum ). Bom, os jogadores colocam -999 e vendem a arma, nisso, a munição da mesma fica 9999. Gostaria de uma pequena ajuda nessa questão, já tentei editar algumas coisas mas sem sucesso. PS: Direitos do script: Tio Stein - criador do mod.
  8. ainda não entendi kkk, como vou fazer pra pegar a posição do player em si?
  9. devo utilizar então getElementPosition
  10. local animTimer = {} local phone = {} function animacao_open_phone ( source ) setPedAnimation (source, "ped","phone_in", 1000, false, false, false, true) setPedAnimationProgress(source, "phone_in", 0.8) phone = createObject(330, 0, 0, 0, 0, 0, 0) animTimer[source] = setTimer(function ( ) setPedAnimationProgress(source, "phone_in", 0.8) end, 500, 0) end addEvent("openPhone", true) addEventHandler("openPhone", getRootElement(), animacao_open_phone) function desativar_animacao ( source ) if isTimer(animTimer[source]) then killTimer(animTimer[source]) end setPedAnimation ( source , "ped", "phone_out", 50, false, false, false, false) end addEvent("closePhone", true) addEventHandler("closePhone", getRootElement(), desativar_animacao) por exemplo assim, porém ainda não aparece.
  11. local phone = {} phone = createObject(330, 0, 0, 0, 0, 0, 0) por exemplo assim
  12. Então galera, tipo eu to com uma dúvida aqui, o createObject é possível colocar ele para que outros jogadores vejam o mesmo? por exemplo um celular na mão de outro player. e isso interfere muito no desempenho?
  13. nossa.. isso por um instante passou por minha cabeça de criar outros 2 scripts separados kkkk, to tentando aprender ainda devagar eu vou. agora todos conseguem ver a animação, porém o celular não aparece na mão, mais é o de menos isso. de coração mesmo mano, Muito Obrigado.
  14. -- client local aberto = false function abrircelular () if aberto == false then aberto = true triggerServerEvent("openPhone", getLocalPlayer(), localPlayer) setPedAnimation (localPlayer, "ped","phone_in", 1000, false, false, false, true) setPedAnimationProgress(localPlayer, "phone_in", 0.8) setPedWeaponSlot(localPlayer, 0) phone = createObject(330, 0, 0, 0, 0, 0, 0) exports.bone_attach:attachElementToBone(phone, localPlayer, 12, 0, 0.01, 0.03, -15, 270, -15) setElementDimension(phone, getElementDimension(localPlayer)) setElementInterior(phone, getElementInterior(localPlayer)) animTimer = setTimer(function() setPedAnimationProgress(localPlayer, "phone_in", 0.8) end, 500, 0) else removePhone() end end bindKey ( "F1", "down", abrircelular) addCommandHandler ( "celular", abrircelular) -- server function animacao_open_phone () if aberto == false then aberto = true setPedAnimation (localPlayer, "ped","phone_in", 1000, false, false, false, true) setPedAnimationProgress(localPlayer, "phone_in", 0.8) setPedWeaponSlot(localPlayer, 0) phone = createObject(330, 0, 0, 0, 0, 0, 0) exports.bone_attach:attachElementToBone(phone, localPlayer, 12, 0, 0.01, 0.03, -15, 270, -15) setElementDimension(phone, getElementDimension(localPlayer)) setElementInterior(phone, getElementInterior(localPlayer)) animTimer = setTimer(function() setPedAnimationProgress(localPlayer, "phone_in", 0.8) end, 500, 0) else removePhone() end end addEvent("openPhone", true) addEventHandler("openPhone", getRootElement(), animacao_open_phone)
  15. no debugscript 3 aparece : trigged serverside event openPhone, but event not added serverside. mais a animação ainda funciona
  16. por exemplo assim? -- server-side local aberto = false function abrircelular () if aberto == false then aberto = true setPedAnimation (localPlayer, "ped","phone_in", 1000, false, false, false, true) setPedAnimationProgress(localPlayer, "phone_in", 0.8) setPedWeaponSlot(localPlayer, 0) phone = createObject(330, 0, 0, 0, 0, 0, 0) exports.bone_attach:attachElementToBone(phone, localPlayer, 12, 0, 0.01, 0.03, -15, 270, -15) setElementDimension(phone, getElementDimension(localPlayer)) setElementInterior(phone, getElementInterior(localPlayer)) triggerClientEvent("openPhone", getRootElement()) animTimer = setTimer(function() setPedAnimationProgress(localPlayer, "phone_in", 0.8) end, 500, 0) else removePhone() end end bindKey ( "F1", "down", abrircelular) addCommandHandler ( "celular", abrircelular) ai no client no caso eu teria que criar uma função para os: addEvent("openPhone", true) addEventHandler("openPhone", getRootElement(), openPhone) por exemplo?
  17. Para mim sincronizar, eu utilizo o triggerServerEvent ?
  18. Tipo a animação é somente o player que faz que consegue ver, eu vejo a minha mais não vejo os outros fazendo. local aberto = false function abrircelular () if aberto == false then aberto = true setPedAnimation (localPlayer, "ped","phone_in", 1000, false, false, false, true) setPedAnimationProgress(localPlayer, "phone_in", 0.8) setPedWeaponSlot(localPlayer, 0) phone = createObject(330, 0, 0, 0, 0, 0, 0) exports.bone_attach:attachElementToBone(phone, localPlayer, 12, 0, 0.01, 0.03, -15, 270, -15) setElementDimension(phone, getElementDimension(localPlayer)) setElementInterior(phone, getElementInterior(localPlayer)) animTimer = setTimer(function() setPedAnimationProgress(localPlayer, "phone_in", 0.8) end, 500, 0) else removePhone() end end bindKey ( "F1", "down", abrircelular) addCommandHandler ( "celular", abrircelular) function removePhone () if aberto == true then if isElement(phone) then destroyElement(phone) end if isTimer(animTimer) then killTimer(animTimer) end aberto = false setPedAnimation (localPlayer, "ped", "phone_out", 50, false, false, false, false) end end addEvent("remover_celular", true) addEventHandler("remover_celular", getRootElement(), removePhone ) Não sei se é por conta da variável. Agradecimento ao member Angelo Pereira que me ajudou.
  19. /debugscript está limpo o script não está dando erro.
  20. local aberto = false local phone = {} local animTimer = {} function abrircelular () if aberto == false then aberto = true setPedAnimation (localPlayer, "ped","phone_in", 1000, false, false, false, true) --/> Puxar Celular setPedAnimationProgress(player, "phone_in", 0.8) setPedWeaponSlot(localPlayer, 0) phone[localPlayer] = createObject(330, 0, 0, 0, 0, 0, 0) exports.bone_attach:attachElementToBone(phone[localPlayer], localPlayer, 12, 0, 0.01, 0.03, -15, 270, -15) setElementDimension(phone[localPlayer], getElementDimension(localPlayer)) setElementInterior(phone[localPlayer], getElementInterior(localPlayer)) animTimer[localPlayer] = setTimer(function(player) if ( isElement(player) ) then setPedAnimationProgress(player, "phone_in", 0.8) end end, 500, 0, localPlayer) elseif aberto == true then setPedAnimation (localPlayer, "ped", "phone_out", 50, false, false, false, false) --/> Guardar Celular aberto = false end end bindKey ( "F1", "down", abrircelular) addCommandHandler ( "celular", abrircelular) addEvent("remover_celular", true) addEventHandler("remover_celular", root, function() removePhone(localPlayer) setPedAnimation (localPlayer, "ped", "phone_out", 50, false, false, false, false) end) Bom, praticamente essa é uma animação que estou montando onde o player abre o celular e fica olhando pra ele, porém tem 2 coisas que estou apanhando. 1. A animação por algum motivo esta bugando, quando eu abro o celular pela segunda vez a animação fica ''flicando'' como se ele estivesse tentando fechar o celular e abrir ao mesmo tempo. 2. Não sei por que mais o addEvent também não está indo. Que praticamente as ultimas 4 linhas eu tinha uma intenção de quando ele ''guardar'' o celular com a animação ''phone_out'', o event remover o celular da mão dele.
  21. function abrircelular(thePlayer) setPedAnimation(thePlayer, "ped", "phone_out", -1, false, false, false, false) else setPedAnimation(thePlayer, "ped", "phone_in", -1, false, false, false, false) end end function abrircelular2 ( player, celular ) bindKey ( thePlayer, "F1") end addCommandHandler ( "celular", abrircelular2 ) A ideia é que quando o player abra o celular, o personagem começa a fazer a animação de puxar o celular, e apertando denovo ele fecha. To começando agora a aprender essa parte de animação/bind key.
  22. 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: -,+, . ,=
  23. 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.
  24. 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.
×
×
  • Create New...