Wysłany: 2020-01-08, 02:02
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
Kod: checkZombies = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "zombie") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*1.2 + visibly*1.2 and scal <= 0 ) or ( distance > sound*1.4 + visibly*1.4 ) then -- Расстояние за которую он вас увидит и услышит (средне)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkZombies, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkAnimal = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "animal") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*3 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "animalStopFollow", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkAnimal, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkKiller = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "killer") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*3 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkKiller, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkboss4aki = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "boss_chucky") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*3 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkboss4aki, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkbossleatherface = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "boss_leatherface") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*3 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(bossleatherface, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkbosshulk = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "boss_hulk") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*3 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkbosshulk, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkbossoctopus = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "boss_octopus") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 3
local visibly = getElementData(getLocalPlayer(), "visibly") / 3
local ready = true
if ( distance > sound*1 + visibly*1 and scal <= 0 ) or ( distance > sound*1 + visibly*1 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkbossoctopus, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkblood = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "boss_blood") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 2
local visibly = getElementData(getLocalPlayer(), "visibly") / 2
local ready = true
if ( distance > sound*3 + visibly*3 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkblood, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkBots = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "bots") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*5 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "botsStartAttack", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkBots, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkbossBenz = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "bossBenz") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*5 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkbossBenz, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checkbossCrais = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "bossCrais") then
local x,y,z = getElementPosition ( localPlayer )
local zx,zy,zz = getElementPosition (ped)
local zfrontx, zfronty, zfrontz = getPositionInfrontOfElement(ped, 3)
local vect1X, vect1Y = zx-x, zy-z
local vect2X, vect2Y = zfrontx-zx, zfronty - zy
local scal = vect2X*vect1X+vect2Y*vect1Y
local distance = getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz )
local sound = getElementData(getLocalPlayer(), "volume") / 5
local visibly = getElementData(getLocalPlayer(), "visibly") / 5
local ready = true
if ( distance > sound*3 + visibly*5 and scal <= 0 ) or ( distance > sound*3 + visibly*3 ) then -- Расстояние за которую он вас увидит и услышит (ДАЛЕКО)
ready = false
end
if ready then
triggerServerEvent ( "chasedStartAttackC", getLocalPlayer(), ped )
end
end
end
end
setTimer(checkbossCrais, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
function zombieJump(ped)
if (isElement(source)) then
setPedControlState(source,"jump",true)
setTimer(function(source)
if (isElement(source)) then
setPedControlState(source,"jump",false)
end
end,800,1,source)
end
end
addEventHandler("bot_Jump",getRootElement(),zombieJump)
addEvent("bot_Jump",true)
function getPositionInfrontOfElement(element, meters)
if not element or not isElement(element) then
return false
end
if not meters then
meters = 3
end
local posX, posY, posZ = getElementPosition(element)
local _, _, rotation = getElementRotation(element)
posX = posX - math.sin(math.rad(rotation)) * meters
posY = posY + math.cos(math.rad(rotation)) * meters
return posX, posY, posZ
end
local fires = 0
local shotCheckAvailable = true
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
if getElementData ( localPlayer, "isPlayerZombie" ) then return true end
if shotCheckAvailable then
if weapon > 9 and weapon ~= 23 then
shotCheckAvailable = false
setTimer ( function () shotCheckAvailable = true end, 4000, 1 )
local zombs = getElementsByType ( "ped", getRootElement(), true )
local x,y,z = getElementPosition ( localPlayer )
for i,zomb in ipairs(zombs) do
if not getElementData ( zomb, "target" ) and not getElementData ( zomb, "zHeared" ) then
local zx,zy,zz = getElementPosition (zomb)
if getDistanceBetweenPoints3D ( x,y,z, zx,zy,zz ) < 50 then
triggerServerEvent ("zombieHeared", localPlayer, zomb )
end
end
end
end
end
end
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc )
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
Kod: --By Fanbox
fast_blood = 15000 -- ??? ? ?????
sold_blood = 20000 -- ??? ? ??????
zomb_blood = 5000 -- ??? ? ????? ???
fast_damage = 3111 -- ?? ?????
sold_damage = 4112 -- ?? ????? ???
zomb_damage = 1121 -- ?? ????? ???
--???????
bear_blood = 20000
wolf_blood = 7000
fox_blood = 5000
bear_damage = 6111
wolf_damage = 3112
fox_damage = 1121
animal_blood = 2000
animal_damage = 100
boss_chucky_blood = 500000
boss_chucky_damage = 30000
boss_hulk_blood = 1000000
boss_hulk_damage = 100000
boss_octopus_blood = 2000000
boss_octopus_damage = 100000
boss_blood_blood = 3000000
boss_blood_damage = 8000
boss_leatherface_blood = 800000
boss_leatherface_damage = 100000
boss_all_blood = 50000
boss_all_damage = 4212
function chasedStartAttack (zomb)
if isElement ( zomb ) and not getElementData ( zomb, "target" ) then
if getElementData ( zomb, "zHeared" ) then
setElementData ( zomb, "zHeared", false )
end
setElementSyncer ( zomb, source )
setPedAnimation ( zomb )
if not exports.npc_hlc:isHLCEnabled ( zomb ) then
exports.npc_hlc:enableHLCForNPC( zomb, getElementData ( zomb,"speed") or "sprint")
end
exports.npc_hlc:clearNPCTasks (zomb)
exports.npc_hlc:addNPCTask ( zomb, {"killPed", source, 2, 2} )
setElementData ( zomb, "target", source )
setElementAlpha ( zomb, 255 )
end
end
addEvent( "chasedStartAttackC", true )
addEventHandler( "chasedStartAttackC", getRootElement(), chasedStartAttack )
local stats = {
[ 69 ] = 500,
[ 70 ] = 999,
[ 71 ] = 999,
[ 72 ] = 999,
[ 73 ] = 500,
[ 74 ] = 999,
[ 75 ] = 500,
[ 76 ] = 999,
[ 77 ] = 999,
[ 78 ] = 999,
[ 79 ] = 999,
[ 160 ] = 999,
[ 229 ] = 999,
[ 230 ] = 999
}
function applyStats(player)
for stat,value in pairs(stats) do
setPedStat(player, stat, value)
end
end
function spawnNewZombie(x, y, z, creator, ztype, skin)
local zomb = createPed(skin,x,y,z+0.5,math.random(0,360),true)
setElementData(zomb,"spawn_x",x)
setElementData(zomb,"spawn_y",y)
setElementData(zomb,"spawn_z",z)
setElementData(zomb,"spawn_ztype",ztype)
setElementData(zomb,"spawn_skin",skin)
if isElement ( zomb ) then
if not isElementInWater ( zomb ) then
setTimer ( activateZombie, 1000, 1, zomb, x, y, z, ztype )
setElementData ( zomb, "creator", creator )
return true
else
destroyElement ( zomb )
return false
end
end
return false
end
function activateZombie (zomb, x, y, z, ztype)
if isElement ( zomb ) then
local zSphere = createColSphere ( x, y, z, 50 )
local zSphereFar = createColSphere ( x, y, z, 150 )
local zSphereNear = createColSphere ( x, y, z, 3 )
attachElements ( zSphere, zomb )
attachElements ( zSphereFar, zomb )
attachElements ( zSphereNear, zomb )
setElementData ( zSphere, 'shapeZomb', true )
setElementData ( zSphereFar, 'shapeZomb', true )
setElementData ( zSphereNear, 'shapeZomb', true )
setElementData ( zomb, "zombieShape", zSphere )
setElementData ( zSphere, "zombieShape", true )
setElementData ( zSphere, "zombieElement", zomb )
setElementData ( zomb, "shapeFar", zSphereFar )
setElementData ( zomb, "shapeNear", zSphereNear )
setElementData ( zSphereNear, "zShapeNear", true )
--setElementData ( zomb, "zombie", true ) --??????? ???? ????? (?????)
--setElementData ( zomb, "animal", true ) --?????? ???? ????? (??????)
--setElementData ( zomb, "killer", true ) --??????? ???? ????? (??????)
--setElementData ( zomb, "boss", true ) --??????? ???? ????? (????)
if ztype == 3 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "soldier", true )
setElementData(zomb, "blood", sold_blood)
setElementData(zomb, "damage", sold_damage)
setElementData(zomb, "speed", "sprint")
elseif ztype == 2 then
setElementData ( zomb, "zombie", true )
setElementData(zomb, "blood", fast_blood)
setElementData ( zomb, "fast", true )
setElementData(zomb, "damage", fast_damage)
setElementData(zomb, "speed", "run")
elseif ztype == 4 then
setElementData ( zomb, "killer", true )
setElementData(zomb, "blood", bear_blood)
setElementData ( zomb, "bear", true )
setElementData(zomb, "damage", bear_damage)
setElementData(zomb, "speed", "run")
elseif ztype == 5 then
setElementData ( zomb, "killer", true )
setElementData(zomb, "blood", wolf_blood)
setElementData ( zomb, "wolf", true )
setElementData(zomb, "damage", wolf_damage)
setElementData(zomb, "speed", "sprint")
elseif ztype == 6 then
setElementData ( zomb, "killer", true )
setElementData(zomb, "blood", fox_blood)
setElementData ( zomb, "fox", true )
setElementData(zomb, "damage", fox_damage)
setElementData(zomb, "speed", "sprint")
elseif ztype == 7 then
setElementData ( zomb, "animal", true )
setElementData(zomb, "blood", animal_blood)
setElementData(zomb, "damage", animal_damage)
setElementData(zomb, "speed", "sprint")
elseif ztype == 9 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_all", true )
setElementData(zomb, "blood", boss_all_blood)
setElementData(zomb, "damage", boss_all_blood)
setElementData(zomb, "speed", "sprint")
elseif ztype == 10 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "pila", true )
setElementData(zomb, "blood", boss_all_blood)
setElementData(zomb, "damage", boss_all_blood)
setElementData(zomb, "speed", "run")
applyStats(zomb)
giveWeapon(zomb, 9, 9999, true)
elseif ztype == 11 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_chucky", true )
setElementData(zomb, "blood", boss_chucky_blood)
setElementData(zomb, "damage", boss_chucky_damage)
setElementData(zomb, "speed", "sprint")
setElementAlpha ( zomb, 5 )
elseif ztype == 14 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_hulk", true )
setElementData(zomb, "blood", boss_hulk_blood)
setElementData(zomb, "damage", boss_hulk_damage)
setElementData(zomb, "speed", "sprint")
setElementAlpha ( zomb, 5 )
elseif ztype == 15 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_octopus", true )
setElementData(zomb, "blood", boss_octopus_blood)
setElementData(zomb, "damage", boss_octopus_damage)
setElementData(zomb, "speed", "run")
setElementAlpha ( zomb, 5 )
--??? ??
elseif ztype == 12 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "pila", true )
setElementData(zomb, "blood", boss_all_blood)
setElementData(zomb, "damage", boss_all_blood)
setElementData(zomb, "speed", "run")
applyStats(zomb)
giveWeapon(zomb, 29, 9999, true)
elseif ztype == 16 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "pila", true )
setElementData(zomb, "blood", boss_all_blood)
setElementData(zomb, "damage", boss_all_blood)
setElementData(zomb, "speed", "run")
applyStats(zomb)
giveWeapon(zomb, 27, 9999, true)
elseif ztype == 17 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_leatherface", true )
setElementData(zomb, "blood", boss_leatherface_blood)
setElementData(zomb, "damage", boss_leatherface_damage)
setElementData(zomb, "speed", "run")
elseif ztype == 13 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_blood", true )
setElementData(zomb, "blood", boss_blood_blood)
setElementData(zomb, "damage", boss_damage_blood)
setElementData(zomb, "speed", "sprint")
applyStats(zomb)
else
setElementData ( zomb, "zombie", true )
setElementData(zomb, "blood", zomb_blood)
setElementData(zomb, "damage", zomb_damage)
setElementData(zomb, "speed", "run")
end
wentZombieToWalk ( zomb )
end
end
function wentZombieToWalk (zomb)
if zomb then
if isElement ( zomb ) then
if not isPedDead ( zomb ) then
if checkPlayersInView ( zomb ) then
if not getElementData ( zomb, "target" ) and not getElementData ( zomb, 'rotating' ) then
local rdmangle = math.random( 1, 359 )
setPedRotation( zomb, rdmangle )
setPedAnimation ( zomb, "PED", "WALK_fatold", -1, true, true, true)
setTimer ( wentZombieToWalk, 10000, 1, zomb )
if getElementData ( zomb, "boss_blood" ) then
setElementAlpha ( zomb, 5 )
end
end
else
if isElement ( getElementData ( zomb, "zombieShape" ) ) then destroyElement ( getElementData ( zomb, "zombieShape" ) ) end
if isElement ( getElementData ( zomb, "shapeFar" ) ) then destroyElement ( getElementData ( zomb, "shapeFar" ) ) end
if isElement ( getElementData ( zomb, "shapeNear" ) ) then destroyElement ( getElementData ( zomb, "shapeNear" ) ) end
local attaches = getAttachedElements ( zomb )
if attaches then
for ElementKey, ElementValue in ipairs ( attaches ) do
if isElement ( ElementValue ) then
if not getElementData ( ElementValue, "zRadZone" ) then
destroyElement ( ElementValue )
end
end
end
end
local creator = getElementData ( zomb, "creator" )
if isElement ( creator ) then
setElementData ( creator, "spawnedzombies", ( getElementData ( creator, "spawnedzombies" ) or 1 ) - 1 )
end
setElementData ( zomb, "target", false )
setElementData ( zomb, "rotating", nil )
if not getElementData ( zomb, "target" ) and not getElementData ( zomb, 'rotating' ) then
local rdmangle = math.random( 1, 359 )
setPedRotation( zomb, rdmangle )
setPedAnimation ( zomb, "PED", "WALK_fatold", -1, true, true, true)
setTimer ( wentZombieToWalk, 10000, 1, zomb )
if getElementData ( zomb, "boss_blood" ) then
setElementAlpha ( zomb, 5 )
end
end
end
end
end
end
end
function checkPlayersInView ( zomb )
local shapeFar = getElementData ( zomb, "shapeFar" )
if isElement(shapeFar) then
if #getElementsWithinColShape ( shapeFar, 'player' ) == 0 then
return false
else return true end
end
end
function zombieKilledPlayer (task)
if getElementData ( source, "zombie" ) then
if task[1] == "walkToPos" then
if getElementData ( source, "rotating" ) then
setElementRotation ( source, 0, 0, task[6] )
setTimer ( function ( zomb ) if isElement ( zomb ) then setElementData ( zomb, "rotating", false ); wentZombieToWalk ( zomb ) end end, 3000, 1, source )
end
end
if getElementData ( source, "target" ) then
local diedPlayer = task[2]
setElementData ( source, "target", nil )
wentZombieToWalk ( source )
end
end
end
addEventHandler ( "npc_hlc:onNPCTaskDone", root, zombieKilledPlayer )
function killPlayerOfSick()
for i, v in ipairs ( getElementsByType ("ped")) do
if getElementData ( v, "zombie" ) then
local target = getElementData ( v, "target" )
if target and target == source then
setElementData ( v, "target", false )
exports.npc_hlc:clearNPCTasks(v)
setTimer ( wentZombieToWalk, 3000, 1, v )
end
end
end
end
addEvent("killPlayerOfSick",true)
addEventHandler("killPlayerOfSick",getRootElement(),killPlayerOfSick)
function checkUnactiveZombies ()
for i, v in ipairs ( getElementsByType ("ped")) do
if getElementData ( v, "zombie" ) then
local target = getElementData ( v, "target" )
if target and not isElement ( target ) then
setElementData ( v, "target", false )
wentZombieToWalk ( v )
end
end
end
end
setTimer (checkUnactiveZombies,10000,0)--600000
function zombieWasAttackedS ( zomb )
if not isPedDead ( zomb ) and not getElementData ( source, "isPlayerZombie" ) then
setPedAnimation ( zomb )
if not exports.npc_hlc:isHLCEnabled ( zomb ) then
exports.npc_hlc:enableHLCForNPC( zomb, getElementData ( zomb,"speed") or "sprint")
end
exports.npc_hlc:clearNPCTasks (zomb)
exports.npc_hlc:addNPCTask ( zomb, {"killPed", source, 2, 2} )
setElementData ( zomb, "target", source )
setTimer ( wentZombieToWalk, 1000, 1, zomb )
end
end
addEvent( "zombieWasAttacked", true )
addEventHandler( "zombieWasAttacked", getRootElement(), zombieWasAttackedS )
function zombieHearedS ( zomb )
if isElement ( zomb ) then
if not isPedDead ( zomb ) then
if not getElementData ( zomb, "target" ) and not getElementData ( source, "zHeared" ) and not getElementData ( source, "isPlayerZombie" ) then
setPedAnimation ( zomb )
if not exports.npc_hlc:isHLCEnabled ( zomb ) then
exports.npc_hlc:enableHLCForNPC( zomb, getElementData ( zomb,"speed") or "sprint")
end
exports.npc_hlc:clearNPCTasks (zomb)
setElementData ( zomb, "zHeared", source )
local x,y,z = getElementPosition ( source )
exports.npc_hlc:addNPCTask ( zomb, {"walkToPos", x, y, z, 2})
end
end
end
end
addEvent( "zombieHeared", true )
addEventHandler( "zombieHeared", getRootElement(), zombieHearedS )
function rotateZombieToPlayer ( rotation, x, y, z )
if not isPedDead ( source ) then
if not getElementData ( source, "target" ) then
setPedAnimation ( source )
if not exports.npc_hlc:isHLCEnabled ( source ) then
exports.npc_hlc:enableHLCForNPC( source, getElementData ( source,"speed") or "sprint")
end
exports.npc_hlc:clearNPCTasks (source)
exports.npc_hlc:addNPCTask ( source, {"walkToPos", x, y, z, 1, rotation})
end
end
end
addEvent( "rotateZombieToPlayer", true )
addEventHandler( "rotateZombieToPlayer", getRootElement(), rotateZombieToPlayer )
function zombieNearLeave ( thePlayer )
if getElementType ( thePlayer ) == "player" and getElementData ( source, "zombieShape" ) then
local zomb = getElementData ( source, "zombieElement" )
if isElement ( zomb ) and exports.npc_hlc:isHLCEnabled ( zomb ) then
if getElementData ( zomb, "fast" ) then
return true
end
local thistask = getElementData(zomb,"npc_hlc:thistask")
if thistask then
local task = getElementData(zomb,"npc_hlc:task."..thistask)
if task then
if task[1] == "killPed" and isElement ( task[2] ) then
if task[2] == thePlayer then
exports.npc_hlc:clearNPCTasks (zomb)
setElementData(zomb,"target",false)
wentZombieToWalk(zomb)
end
end
end
end
end
end
end
addEventHandler ( "onColShapeLeave", root, zombieNearLeave )
--???? ? ????? ??
function PanicAnimals(zomb)
if isElement(zomb) then
local rdmangle = math.random( 1, 359 )
setPedRotation( zomb, rdmangle )
setPedAnimation ( zomb, "PED", "sprint_panic", -1, true, true, true)
setTimer ( PanicAnimals, 20000, 1, zomb ) --??????? ???? ? ?? ????
end
end
function animalStopFollow(zomb)
PanicAnimals(zomb)
end
addEvent("animalStopFollow",true)
addEventHandler("animalStopFollow",getRootElement(),animalStopFollow)
--
Wie kto? dlaczego nie dzia?a ustawianie zadawanych obra?e??
Wysłany: 2020-01-08, 04:31
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Wklej kod tylko zabierania tego ?ycia, po co ty tu wklejasz ca?y kod. Logiczne, ?e lepiej b?dzie jak podasz od razu to, z czym masz problem.
Wysłany: 2020-01-08, 07:40
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :Wklej kod tylko zabierania tego ?ycia, po co ty tu wklejasz ca?y kod. Logiczne, ?e lepiej b?dzie jak podasz od razu to, z czym masz problem.
Kod: ss_all_blood = 50000
boss_all_damage = 4212
Przyk?adowo bass_all_damage = 4212 to tu ustawia? si? powinno by boss po uderzeniu zabiera? 4212 krwi.
Kod: elseif ztype == 13 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_blood", true )
setElementData(zomb, "blood", boss_blood_blood)
setElementData(zomb, "damage", boss_damage_blood)
setElementData(zomb, "speed", "sprint")
applyStats(zomb)
I tutaj jest numer zombie 13, a ni?ej skrypt odnosi si? to wcze?niej ustalonej ilo?ci krwi, przynajmniej tak by? powinno.
Wysłany: 2020-01-08, 09:31
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Zacznijmy od tego, ?e ty tu nigdzie nie zabierasz tego ?ycia graczowi. Gdzie wykorzystujesz te elementDat? "blood", kt?r? ma zombie o numerze 13?
Wysłany: 2020-01-08, 11:23
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :Zacznijmy od tego, ?e ty tu nigdzie nie zabierasz tego ?ycia graczowi. Gdzie wykorzystujesz te elementDat? "blood", kt?r? ma zombie o numerze 13?
To obra?enia zadawane przez zombie bossy
Wysłany: 2020-01-08, 11:39
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
No dobra, tyle to i ja wiem. Ale ja potrzebuje skrypt, w kt?rym ty co? robisz z t? elementdat?. Nie wiem, jakis event onClientPedDamage nie wiem musisz to znale?? u siebie.
Wysłany: 2020-01-08, 12:31
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :No dobra, tyle to i ja wiem. Ale ja potrzebuje skrypt, w kt?rym ty co? robisz z t? elementdat?. Nie wiem, jakis event onClientPedDamage nie wiem musisz to znale?? u siebie.
Mo?e to by? w gamemodzie DayZ? Czy pr?dzej gdzie? w zombie?
Wysłany: 2020-01-08, 14:44
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
To mo?e by? wsz?dzie, nawet w pliku lua gdzie tylko tworzysz map?.
Wysłany: 2020-01-08, 14:48
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
Co? nie tak jest w kodzie po stronie serwera, kt?ry wstawi?em. Wcze?niej to dzia?a?o normalnie, a teraz co? w pliku nz_s.lua zepsu?em
Wysłany: 2020-01-08, 15:00
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Co ja mam do tego? Pom?c mog? je?li wstawisz b??dy DB3 jesli wyst?puj?. No i zmie? to, co spowodowa?o problemy ze skryptem.
Wysłany: 2020-01-08, 18:13
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :Co ja mam do tego? Pom?c mog? je?li wstawisz b??dy DB3 jesli wyst?puj?. No i zmie? to, co spowodowa?o problemy ze skryptem.
Nic na ten temat nawet nie wy?wietla si? w DB3.
[ Dodano : 2020-01-08, 18:27 ]
"Wilq" napisał/a :Co ja mam do tego? Pom?c mog? je?li wstawisz b??dy DB3 jesli wyst?puj?. No i zmie? to, co spowodowa?o problemy ze skryptem.
Obra?enia zadawane przez zombie zbiera mi z gamemoda domy?lne dla ka?dego..
''gameplayVariables["zombiedamage"] = math.random(800,2000)''
Wysłany: 2020-01-08, 18:29
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
No widzisz, to musisz sprawdzi? w miejscu gdzie zadajesz obra?enia, czy ten zombie to boss i jesli tak to odejmowa? warto?? z elementDaty "blood".
Wysłany: 2020-01-08, 18:43
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :No widzisz, to musisz sprawdzi? w miejscu gdzie zadajesz obra?enia, czy ten zombie to boss i jesli tak to odejmowa? warto?? z elementDaty "blood".
Znalaz?em co? takiego:
Kod: function playerGetDamageDayZ ( attacker, weapon, bodypart, loss )
cancelEvent()
if getElementData(localPlayer,"inGreenZone") then
return
end
if attacker and getElementType(attacker) == "vehicle" then
speedx, speedy, speedz = getElementVelocity ( attacker )
actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5)
kmh = actualspeed * 180
if kmh >= 90 then
local vehkiller = getVehicleOccupant ( attacker )
setElementData(source,"blood",0)
if getElementData(source,"blood") <= 0 then
triggerServerEvent("kilLDayZPlayer",source,vehkiller)
end
end
end
damage = 100
headshot = false
if weapon == 37 then
return
end
local pl_model = getElementModel ( localPlayer )
if attacker then
if getElementData(attacker,"zombie") then
local number = math.random(0,10)
local sound = playSound("sounds/mgroan"..number..".ogg")
local damageded = Damage_ToCloth (bodypart)
local reduce = getClothDamageReduce (pl_model, bodypart)
setElementData(localPlayer,"blood",getElementData(localPlayer,"blood")-gameplayVariables["zombiedamage"]*damageded*reduce)
local number = math.random(1,5)
if number == 3 then
setElementData(getLocalPlayer(),"infection",true)
end
local number = math.random(1,7)
if number == 4 then
setElementData(localPlayer,"bleeding",getElementData(localPlayer,"bleeding") + math.floor(loss*5))
end
elseif getElementData ( attacker, "bots" ) or getElementData ( attacker, "snegovik" ) or getElementData ( attacker, "santa" ) or getElementData ( attacker, "boss4aki" ) or getElementData ( attacker, "bossBenz" ) or getElementData ( attacker, "bossCrais" ) then
local damageded = Damage_ToCloth (bodypart)
local reduce = getClothDamageReduce (pl_model, bodypart)
setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-getElementData(attacker,"BOSSdamage")*damageded*reduce)
local number = math.random(1,7)
if number == 4 then
setElementData(getLocalPlayer(),"bleeding",getElementData(getLocalPlayer(),"bleeding") + math.floor(loss*5))
end
end
end
[ Dodano : 2020-01-09, 22:31 ]
ref
Tagi: zawsze :: przy :: uderzeniu :: zabiera :: krwi
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: