Wysłany: 2020-01-04, 17:36
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
Witam co tutaj jest nie tak? Chcia?bym by moje zombie na serwerze potrafi?y skaka?. Odwdzi?cz? si? za pomoc!
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 )
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 )
checkkrzyk = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "krzyk") 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(checkkrzyk, 2000, 0)
setElementData ( localPlayer, "spawnedzombies", 0 )
checksnegovik = function()
for i,ped in ipairs(getElementsByType("ped",root,true)) do
if getElementData(ped, "snegovik") 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(checksnegovik, 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
Ostatnio zmieniony przez NotPaladyn 2020-01-08, 14:37, w całości zmieniany 2 razy
Wysłany: 2020-01-04, 17:46
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
No to u?yj funkcji
i jako argument akcji podaj "jump".
Widz?, ?e to ju??masz u siebie to podaj ewentualne b?edy DB3.
Wysłany: 2020-01-04, 17:52
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :No to u?yj funkcji
i jako argument akcji podaj "jump".
Widz?, ?e to ju??masz u siebie to podaj ewentualne b?edy DB3.
Mog?bym prosi? o to by? mito poprawi? odpowiednio?
Wysłany: 2020-01-04, 18:16
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Sk?d ja mam wiedzie? co jest nie tak? Napisa?em jasno: wstaw b??dy /debugscript 3.
Zobacz czy w og?le WYKONUJESZ te funkcje, mo?e masz je w kodzie ale nie nadajesz tych czynno?ci zombie.
Wysłany: 2020-01-04, 19:27
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :Sk?d ja mam wiedzie? co jest nie tak? Napisa?em jasno: wstaw b??dy /debugscript 3.
Zobacz czy w og?le WYKONUJESZ te funkcje, mo?e masz je w kodzie ale nie nadajesz tych czynno?ci zombie.
W debugu nic nie ma na ten temat.
Mo?e tutaj co??
Kod: elseif ztype == 11 then
setElementData ( zomb, "zombie", true )
setElementData ( zomb, "boss_chucky", true )
setPedControlState(source,"jump",true)
setElementData(zomb, "blood", boss_chucky_blood)
setElementData(zomb, "damage", boss_chucky_damage)
setElementData(zomb, "speed", "sprint")
setElementAlpha ( zomb, 5 )
--??? ??
Wysłany: 2020-01-04, 20:19
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
No i co, wykonuje si? ta funkcja? ztype wynosi 11?
Wysłany: 2020-01-05, 05:02
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :No i co, wykonuje si? ta funkcja? ztype wynosi 11?
ztype 11 to numer dzi?ki kt?remu przy pozycji oznaczamy numer danego rodzaju zombie.. a skok?
Wysłany: 2020-01-05, 21:42
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
W tym warunku z ztype (11) masz w?a?nie funkcj? odpowiadaj?ca za skok.
To chyba logiczne, ?eby zombie skoczy?o to musi wykona? si? taka funkcja.
Musisz sprawdzi? czy ta funkcja gdzie? si? w og?le wykonuje.
Wysłany: 2020-01-06, 22:02
VVrongVVay
Wiek: 37 Na forum: 4486 dni Posty: 47
Nick w MP: VVrongVVay
Piwa : 1
"Wilq" napisał/a :W tym warunku z ztype (11) masz w?a?nie funkcj? odpowiadaj?ca za skok.
To chyba logiczne, ?eby zombie skoczy?o to musi wykona? si? taka funkcja.
Musisz sprawdzi? czy ta funkcja gdzie? si? w og?le wykonuje.
Pr?bowa?em tam do tego doda? skok, ale nic z tego.. co mam tam dopisa??
Tagi: zamknąć
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: