Jump to content

josedabela

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by josedabela

  1. Guys i have a boss script that uses slothbot and extra health and i want to make the boss jump is a player is in a high place can someone help? -- server.lua -- Sistema de bosses completo com loot, respawn correto, dano por ataque e animação controlada local attackCooldown = {} -- cooldown de ataque por boss local nextSpawn = {} -- timestamp do próximo spawn permitido de cada boss -- Função para spawnar o boss local function spawnBoss(bossID) local boss = Config.Bosses[bossID] if not boss then return end -- Checa se o boss já existe if boss.ped and isElement(boss.ped) then return end local ped = exports.slothbot:spawnBot( boss.position[1], boss.position[2], boss.position[3], boss.position[4] or 0, boss.skin, 0, 0, nil, boss.weapon, "guard", nil ) if ped and isElement(ped) then boss.ped = ped setElementInterior(ped, boss.interior) setElementDimension(ped, boss.dimension) setElementHealth(ped, boss.baseHealth) exports.extra_health:setElementExtraHealth(ped, boss.extraHealth) setElementData(ped,"extra_health",boss.extraHealth) setElementData(ped,"extra_health_current",boss.extraHealth) setElementData(ped,"boss",true) setElementData(ped,"boss:id",bossID) setElementData(ped,"boss:name",boss.name) setElementData(ped,"boss:reward",boss.reward) setElementData(ped,"boss:damage",boss.damage or 5) setElementData(ped,"boss:runAnimation",boss.runAnimation or false) -- Muta o boss automaticamente triggerClientEvent("Boss_STFU", getRootElement(), ped) end end -- Spawn automático respeitando respawnTime setTimer(function() local now = os.time() for bossID,boss in pairs(Config.Bosses) do if (not boss.ped or not isElement(boss.ped)) then if (not nextSpawn[bossID] or now >= nextSpawn[bossID]) then spawnBoss(bossID) end end end end, 10000, 0) -- Função de loot local function dropBossLoot(boss, ped, killer) if not boss.reward or not boss.reward.items then return end if getElementType(killer) ~= "player" then return end local x,y,z = getElementPosition(ped) local marker = createMarker(x,y,z-1,"cylinder",2,255,0,0,25) local objeto = createObject(2969,x,y,z-0.9) setElementCollisionsEnabled(objeto,false) setObjectScale(objeto,1.5) addEventHandler("onMarkerHit", marker, function(hitElement) if getElementType(hitElement) ~= "player" then return end if isPedInVehicle(hitElement) then return end triggerClientEvent(hitElement,"addBox",hitElement,"Pressione 'E' para saquear!","info") bindKey(hitElement,"e","down",function(p) if not isElement(p) then return end unbindKey(p,"e","down") setPedAnimation(p,"BOMBER","BOM_Plant",2000,false,true,false,false) setTimer(function() if not isElement(p) then return end local itensLoot = {} local msg = "Não encontraste nada!" for _, loot in ipairs(boss.reward.items) do local roll = math.random(100) if roll <= (loot.chance or 100) then local qtd = loot.amount or 1 table.insert(itensLoot,{itemID=loot.id or loot.itemID,quantidade=qtd}) end end for _, item in ipairs(itensLoot) do exports["[arena]Inventario"]:giveItem(p,item.itemID,item.quantidade) end if #itensLoot > 0 then msg = "Você saqueou o boss!" end if isElement(objeto) then destroyElement(objeto) end if isElement(marker) then destroyElement(marker) end setPedAnimation(p,false) triggerClientEvent(p,"addBox",p,msg,#itensLoot>0 and "success" or "warning") end,2000,1) end) end) addEventHandler("onMarkerLeave", marker, function(hitElement) if getElementType(hitElement) ~= "player" then return end unbindKey(hitElement,"e","down") end) setTimer(function() if isElement(objeto) then destroyElement(objeto) end if isElement(marker) then destroyElement(marker) end end,3*60000,1) end -- Morte do boss addEventHandler("onPedWasted", root, function(_, killer) local ped = source if not getElementData(ped,"boss") then return end local bossID = getElementData(ped,"boss:id") local boss = Config.Bosses[bossID] if not boss then return end -- Atualiza próximo spawn baseado no respawnTime da config nextSpawn[bossID] = os.time() + boss.respawnTime -- Recompensa em dinheiro if isElement(killer) and getElementType(killer) == "player" then local reward = boss.reward if reward.money then givePlayerMoney(killer,reward.money) outputChatBox("Recebeste $"..reward.money.." por matar "..boss.name.."!",killer,0,255,0) end -- Aqui dispara XP pro sistema de XP triggerEvent("onBossWasted", root, killer, bossID) end -- Loot do boss dropBossLoot(boss,ped,killer) -- Limpa o boss if isElement(boss.ped) then destroyElement(boss.ped) end boss.ped = nil end) -- Limpeza ao reiniciar resource addEventHandler("onResourceStop", resourceRoot, function() for _, boss in pairs(Config.Bosses) do if boss.ped and isElement(boss.ped) then destroyElement(boss.ped) boss.ped = nil end end end)
  2. Bem tenho um servidor e ja esta na reta final so que me esta acontecendo um bug muito chato e bem aleatorio, em certos momentos o player perde acesso as teclas apenas pode usar f1,f2,f3 etc já wasd espaço shift etc fica bloqueado alguem sabe oque pode ser ?
  3. Cara já procurei em todo o lado e não acho, nao tenho muita experiencia a fazer scripts so queria saber se voçe conseguia fazer um colorpicker para mim que abra na tecla f2 e que salva as cores do carro. 

    baseado neste que esta aqui, porque tenho uma conce e tenho um colorpicker feito pelo chat gpt mas quando guardo o carro e volto a spawnar a cor dele some, e se as alteraçoes na cor sao feitas pelo painel admin a cor permanece.. ja procurei nao acho nada me ajuda

×
×
  • Create New...