manawydan Posted May 15, 2013 Share Posted May 15, 2013 ola, estou tentando criar um script que quando anoitece aparece mais zombie que de manhã. porem como posso mudar o numero total de zombies e o modo de spawn deles com alguma função? obrigado! Link to comment
gustavorn Posted May 16, 2013 Share Posted May 16, 2013 Você poderia inserir seu sintaxe, assim ajudaria. Link to comment
DNL291 Posted May 16, 2013 Share Posted May 16, 2013 Qual modo de jogo você está usando? Procure por uma função exportada que altera o número de zumbis. Link to comment
RaceXtreme Posted May 16, 2013 Share Posted May 16, 2013 É claro, mas depende do script que você está utilizando. Se você baixou ele no MTA community, provavelmente em alguma parte do arquivo deve ter alguma variável definindo o número de zumbis. Daí é só criar uma função que calcula o número máximo de spawn que pode haver, por exemplo: maxZombieSpawn = 15 function onWorldUpdate () hour,_ = getTime () if hour >= 18 and hour <= 7 then maxZombieSpawn = math.random(1,3) * maxZombieSpawn else maxZombieSpawn = 15 end end Link to comment
manawydan Posted May 17, 2013 Author Share Posted May 17, 2013 bom o script de zombie que estou usando é da comunidade (criado por slothman). o que eu pretendo fazer? usar getTime (para verificar as horas do jogo) usar um timer ou onClientRender então se as horas for de manha faze com que os zombies spawnem normalmente (StreamMethod = 1) ja se for noite, mudar o StreamMethod para 2 (zombies spawnam por spawnpointer) e mudar o numero maximo de zombie para um valor maior que de manha ( por exemplo dia =5 noite = 10). resumindo queria mudar as settings dos zombies com o tempo do jogo. Link to comment
RaceXtreme Posted May 17, 2013 Share Posted May 17, 2013 Pois é. Está ai a sua tarefa. Dê uma olhada nos scripts de Slothman e tente criar uma extensão para ele. Se você travar em alguma parte, nós estaremos aqui para te ajudar Link to comment
LucasBaker Posted May 18, 2013 Share Posted May 18, 2013 Você poderia utilizar como base o leatherface é um script criado pelo KingGTA, faz com que o bot apareça só as 20:59 quando da umas 6:00 ele desaparece Client: renderedFrames = 0 fps = 1 addEventHandler("onClientRender", getRootElement(), function() renderedFrames = renderedFrames + 1 end ) setTimer( function() fps = renderedFrames renderedFrames = 0 end , 1000, 0) zones = { "Whetstone", "Shady Creeks", "Back o Beyond", "Flint County", "Mount Chiliad" } function isLocalPlayerInLeatherfaceArea() local x, y, z = getElementPosition(getLocalPlayer()) local inZone = false for i, zone in ipairs(zones) do if getZoneName(x, y, z) == zone then inZone = true end end if inZone == true then return true else return false end end addEvent("onClientPlayerLeatherfaceAreaEnter", true) addEvent("onClientPlayerLeatherfaceAreaLeave", true) addEvent("onClientWeatherChangeRequest", true) addEvent("clientSyncMyTime", true) addEventHandler("onClientWeatherChangeRequest", getLocalPlayer(), function(weatherID) setWeather(weatherID) end ) addEventHandler("onClientPlayerLeatherfaceAreaEnter", getLocalPlayer(), function() setWeather(9) triggerServerEvent("syncMyTime", getLocalPlayer()) end ) addEventHandler("clientSyncMyTime", getLocalPlayer(), function(hour, minute) setTime(hour, minute) end ) wasInLeatherfaceArea = false addEventHandler("onClientRender", getRootElement(), function() if isLocalPlayerInLeatherfaceArea() and wasInLeatherfaceArea == false then triggerEvent("onClientPlayerLeatherfaceAreaEnter", getLocalPlayer()) triggerServerEvent("onPlayerLeatherfaceAreaEnter", getLocalPlayer()) wasInLeatherfaceArea = true elseif isLocalPlayerInLeatherfaceArea() == false and wasInLeatherfaceArea == true then triggerEvent("onClientPlayerLeatherfaceAreaLeave", getLocalPlayer()) triggerServerEvent("onPlayerLeatherfaceAreaLeave", getLocalPlayer()) wasInLeatherfaceArea = false end end ) function isLeatherfaceAtmosphere() local h, m = getTime() if h > 20 then return true elseif h < 6 then return true else return false end end function isRealLeatherfacePresent() for i, peds in ipairs(getElementsByType("ped")) do if getElementData(peds, "type") == "RealLeatherface" then return true end end return false end addEvent("onClientScreamPlay", true) addEventHandler("onClientScreamPlay", getRootElement(), function(sound) if isLocalPlayerInLeatherfaceArea() and isLeatherfaceAtmosphere() and isRealLeatherfacePresent() == false then local soundElement = playSound(sound) setSoundEffectEnabled(soundElement, "reverb", true) setSoundVolume(soundElement, 0.075) end end ) setTimer( function() if isLocalPlayerInLeatherfaceArea() then if getWeather() ~= 9 then setWeather(9) end end for i, peds in ipairs(getElementsByType("ped")) do if getElementData(peds, "type") == "ghost" then if getElementAlpha(peds) == 0 or getElementAlpha(peds) < 10 then destroyElement(peds) else setElementAlpha(peds, getElementAlpha(peds) - 10) end end end for i, leatherface in ipairs(getElementsByType("ped")) do if getElementData(leatherface, "type") == "RealLeatherface" then local alpha = getElementAlpha(leatherface) if alpha < 255 - 10 then setElementAlpha(leatherface, alpha + 10) elseif alpha > 255 - 10 and alpha < 255 then setElementAlpha(leatherface, 255) end end end end , 50, 0) addEvent("onClientRealLeatherfaceSpawn", true) addEventHandler("onClientRealLeatherfaceSpawn", getRootElement(), function(x, y, z) setPedVoice(source, "PED_TYPE_DISABLED") setPedFootBloodEnabled(source, true) end ) function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end setTimer( function() if isLocalPlayerInLeatherfaceArea() and isLeatherfaceAtmosphere() and isRealLeatherfacePresent() == false then if math.random(0, 50) == 50 then local x, y, z, lookX, lookY = getCameraMatrix() local lx, ly, lz = getPointFromDistanceRotation(x, y, 25, findRotation(lookX, lookY, x, y) + math.random(-45, 45)) lz = getGroundPosition(lx, ly, 576) + 1 triggerServerEvent("onRealLeatherfaceSpawn", getRootElement(), lx, ly, lz) elseif math.random(0, 100) == 100 then local x, y, z, lookX, lookY = getCameraMatrix() local lx, ly, lz = getPointFromDistanceRotation(x, y, 25, findRotation(lookX, lookY, x, y) + math.random(-45, 45)) lz = getGroundPosition(lx, ly, 576) triggerServerEvent("onGlendaleSpawn", getLocalPlayer(), lx, ly, lz) elseif math.random(0, 1) == 1 then local x, y, z = getElementPosition(getLocalPlayer()) local ax, ay = getPointFromDistanceRotation(x, y, 50, math.random(0, 360)) local az = getGroundPosition(ax, ay, 576) local gPed = createPed(33, ax, ay, az + 1) local rotZ = findRotation(ax, ay, x, y) setPedRotation(gPed, rotZ) setPedHeadless(gPed, true) setElementData(gPed, "type", "ghost") end end end , 1000, 0) Server zones = { "Whetstone", "Shady Creeks", "Back o Beyond", "Flint County", "Mount Chiliad" } RealLeatherface = nil function isRealLeatherfacePresent() if RealLeatherface == nil then return false elseif isElement(RealLeatherface) then return true else return false end end function isElementInLeatherfaceZone(element) local x, y, z = getElementPosition(element) local inZone = false for i, zone in ipairs(zones) do if getZoneName(x, y, z) == zone then inZone = true end end if inZone == true then return true else return false end end function isLeatherfaceAtmosphere() local h, m = getTime() if h > 20 then return true elseif h < 6 then return true else return false end end addEvent("onPlayerLeatherfaceAreaEnter", true) addEvent("onPlayerLeatherfaceAreaLeave", true) addEvent("syncMyTime", true) addEvent("onGlendaleSpawn", true) addEventHandler("onGlendaleSpawn", getRootElement(), function(x, y, z) local glendale = createVehicle(getVehicleModelFromName("Glendale Damaged"), x, y, z + 10) local px, py, pz = getElementPosition(source) local rotZ = findRotation(x, y, px, py) setElementRotation(glendale, 0, 0, rotZ) setVehicleEngineState(glendale, true) setVehicleLocked(glendale, true) setTimer( function() if isElement(glendale) then blowVehicle(glendale) local x, y, z = getElementPosition(glendale) createExplosion(x, y, z, 4) destroyElement(glendale) end end , 20000, 1) end ) addEventHandler("syncMyTime", getRootElement(), function() local h, m = getTime() triggerClientEvent("clientSyncMyTime", source, h, m) end ) addEventHandler("onPlayerLeatherfaceAreaLeave", getRootElement(), function() local weather = getWeather() triggerClientEvent("onClientWeatherChangeRequest", source, weather) end ) addEvent("onScreamPlay", true) setTimer( function() if isLeatherfaceAtmosphere() and isRealLeatherfacePresent() == false then local sound = math.random(1, 9) if sound == 1 then sound = "horror001.mp3" end if sound == 2 then sound = "horror002.mp3" end if sound == 3 then sound = "horror003.mp3" end if sound == 4 then sound = "horror004.mp3" end if sound == 5 then sound = "horror005.mp3" end if sound == 6 then sound = "horror006.mp3" end if sound == 7 then sound = "horror007.mp3" end if sound == 8 then sound = "horror010.mp3" end if sound == 9 then sound = "horror012.mp3" end triggerClientEvent("onClientScreamPlay", getRootElement(), sound) triggerEvent("onScreamPlay", getRootElement(), sound) end end , 20000, 0) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end Leatherface = nil function getPlayerNearestToPosition(x, y, z) local nearestPlayer = nil local nearestDistance = nil for i, players in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(players) local distance = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if nearestPlayer == nil then nearestPlayer = players nearestDistance = distance elseif distance < nearestDistance then nearestDistance = distance nearestPlayer = players end end if nearestPlayer == nil then return false else return nearestPlayer end end setTimer( function() if isRealLeatherfacePresent() then local x, y, z = getElementPosition(RealLeatherface) local player = getPlayerNearestToPosition(x, y, z) if player then local px, py, pz = getElementPosition(player) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < 50 then if isElementInWater(RealLeatherface) then return destroyElement(RealLeatherface) end local rotZ = findRotation(x, y, px, py) setPedRotation(RealLeatherface, rotZ) if getDistanceBetweenPoints3D(px, py, pz, x, y, z) < 1 then local health = getElementHealth(player) if health < 5 or health == 5 then setElementHealth(player, 0) local leX, leY, leZ = getElementPosition(RealLeatherface) destroyElement(RealLeatherface) createExplosion(leX, leY, leZ, 5) else setElementHealth(player, health - 5) end end else destroyElement(RealLeatherface) end end end end , 50, 0) addEvent("onRealLeatherfaceSpawn", true) addEventHandler("onRealLeatherfaceSpawn", getRootElement(), function(x, y, z) if isLeatherfaceAtmosphere() then local localPed = createPed(33, x, y, z) giveWeapon(localPed, 9, 1, true) setPedAnimation(localPed, "FAT", "FatRun_Csaw", -1, true, true, false) setElementData(localPed, "type", "RealLeatherface") setPedStat(localPed, 24, 1000) setElementHealth(localPed, 1000) setElementAlpha(localPed, 0) RealLeatherface = localPed triggerClientEvent("onClientRealLeatherfaceSpawn", RealLeatherface, x, y, z) end end ) addEventHandler("onPedWasted", getRootElement(), function(ammo, killer) if isElement(RealLeatherface) then if source == RealLeatherface then local x, y, z = getElementPosition(RealLeatherface) destroyElement(RealLeatherface) createExplosion(x, y, z, 5) end end end ) Boa Sorte Link to comment
manawydan Posted May 21, 2013 Author Share Posted May 21, 2013 obrigado pessoal, irei dar uma boa olhada nos zombies e tentarei criar a "extensão"! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now