Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-08-24, 01:44


Fl!k







Wiek: 26
Na forum: 3593 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam wgra?em paczk? dayz ale nie respi? si? zombie :/ z g?ry dziekuje

Skrypt zombies_c

 local myZombies = {};
local distanceTable = {
    [1] = 5,
    [2] = 5,
    [3] = 10,
    [4] = 20,
    [5] = 40
};

addEvent("Zomb_Jump"true);
addEvent("Zomb_Punch"true);
addEvent("Zomb_STFU"true);
addEvent("Zomb_Moan"true);
addEvent("Spawn_Placement"true);

function table.getn(table)
    return #table;
end

addEventHandler("onClientPlayerWasted"localPlayer, function()
    setTimer(Zomb_release40001);
end);

function Zomb_release()
    for k,ped in pairs(myZombies) do
        if isElement(pedthen
            if (getElementData(ped"zombie") == truethen
                setElementData(ped"target"nil);
                setElementData(ped"status""idle");
                table.remove(myZombiesk);
            end
        end
    end
end

addEventHandler("onClientPedWasted"root, function(killerweaponbodypart)
    if (getElementData(source"zombie") == true) and (getElementData(source"status") ~= "dead"then
        setElementData(source"target"nil);
        setElementData(source"status""dead");
    end
end);

function zombie_check()
    if (getElementData(localPlayer"zombie") ~= true) and not isPedDead(localPlayerthen
        local zombies getElementsByType("ped"roottrue);
        local Px,Py,Pz getElementPosition(localPlayer);
        if isPedDucked(localPlayerthen
            local Pz Pz-1;
        end
        for theKey,theZomb in ipairs(zombies) do
            if isElement(theZombthen
                local Zx,Zy,Zz getElementPosition(theZomb);
                local number tonumber(getElementData(localPlayer"visibly"))+tonumber(getElementData(localPlayer"volume"));
                if (number 5then number 5end
                local distance distanceTable[number];
                if (getDistanceBetweenPoints3D(PxPyPzZxZyZz) <= distancethen
                    if getElementData(theZomb"zombie"then
                        if (getElementData(theZomb"status") == "idle"then
                            local isclear isLineOfSightClear(PxPyPz+1ZxZyZz+1truefalsefalsetruefalsefalsefalse);
                            if isclear then
                                setElementData(theZomb"status""chasing");
                                setElementData(theZomb"target"localPlayer);
                                table.insert(myZombiestheZomb);
                                table.remove(zombiestheKey);
                                zombieradiusalert(theZomb);
                            end
                        elseif (getElementData(theZomb"status") == "chasing") and (getElementData(theZomb"target") == nilthen
                            local isclear isLineOfSightClear(PxPyPz+1ZxZyZz+1truefalsefalsetruefalsefalsefalse);
                            if isclear then
                                setElementData(theZomb"target"localPlayer);
                                isthere "no";
                                for _,ped in pairs(myZombies) do
                                    if (ped == theZombthen
                                        isthere "yes";
                                    end
                                end
                                if (isthere == "no"then
                                    table.insert(myZombiestheZomb);
                                    table.remove(zombiestheKey);
                                end
                            end
                        elseif (getElementData(theZomb"target") == localPlayerthen
                            local isclear isLineOfSightClear(PxPyPz+1ZxZyZz+1truefalsefalsetruefalsefalsefalse);
                            if not isclear then
                                setElementData(theZomb"target"nil);
                                triggerServerEvent("onZombieLostPlayer"theZomboldPxoldPyoldPz);
                            end
                        end
                    end
                end
            end
        end
    end
    for k,ped in pairs(myZombies) do
        if not isElement(pedthen
            table.remove(myZombiesk);
        end
    end
    oldPx,oldPy,oldPz getElementPosition(localPlayer);
end

addEventHandler("onClientResourceStart"resourceRoot, function()
    setTimer(clientsetup12341);
    MainClientTimer1 setTimer(zombie_check10000);
end);

function clientsetup()
    for _,theZomb in ipairs(getElementsByType("ped")) do
        if isElement(theZombthen
            if getElementData(theZomb"zombie"then
                setPedVoice(theZomb"PED_TYPE_DISABLED");
            end
        end
    end
end

addEventHandler("onClientElementDataChange"root, function(dataName)
    if (getElementType(source) == "ped" and dataName == "status"then
        local thestatus getElementData(source"status");
        if (thestatus == "idle") or (thestatus == "dead"then        
            for k,ped in pairs(myZombies) do
                if (ped == source and getElementData(ped"zombie")) then
                    setElementData(ped"target"nil);
                    table.remove(myZombiesk);
                    setElementData(localPlayer"dangercount"tonumber(table.getn(myZombies)));
                end
            end
        end
    end
end);

addEventHandler("Zomb_Jump"root, function(ped)
    if isElement(pedthen
        setPedControlState(ped"jump"true);
        setTimer(function(ped) if isElement(pedthen setPedControlState(ped"jump"false); end end8001ped);
    end
end);

addEventHandler("Zomb_Punch"root, function(ped)
    if isElement(pedthen
        setPedControlState(ped"fire"true);
        setTimer(function(ped) if isElement(pedthen setPedControlState(ped"fire"false); end end8001ped);
    end
end);

addEventHandler("Zomb_STFU"root, function(ped)
    if isElement(pedthen
        setPedVoice(ped"PED_TYPE_DISABLED");
    end
end);

addEventHandler("Zomb_Moan"root, function(pedrandnum)
    if isElement(pedthen
        local Zx,Zy,Zz getElementPosition(ped);
        local sound playSound3D("sounds/mgroan"..randnum..".ogg"ZxZyZzfalse);
        setSoundMaxDistance(sound20);
    end
end);

addEventHandler("onClientPedWasted"root, function(killerweaponbodypart)
    if (getElementType(source) == "ped"then
        if (getElementData(source"zombie") == truethen
            setElementCollisionsEnabled(sourcefalse);
        end
    end
end);

function zombieradiusalert(theElement)
    local Px,Py,Pz getElementPosition(theElement);
    for _,theZomb in ipairs(getElementsByType("ped")) do
        if isElement(theZombthen
            if getElementData(theZomb"zombie"then
                if (getElementData(theZomb"status") == "idle"then
                    local Zx,Zy,Zz getElementPosition(theZomb);
                    if (getDistanceBetweenPoints3D(PxPyPzZxZyZz) < 10) and not isPedDead(localPlayerthen
                        isthere "no";
                        for _,ped in pairs(myZombies) do
                            if (ped == theZombthen
                                isthere "yes";
                            end
                        end
                        if (isthere == "no" and not getElementData(localPlayer"zombie")) then
                            if (getElementType(theElement) == "ped"then
                                local isclear isLineOfSightClear(PxPyPzZxZyZztruefalsefalsetruefalsefalsefalse);
                                if isclear then
                                    setElementData(theZomb"status""chasing");
                                    setElementData(theZomb"target"localPlayer);
                                    table.insert(myZombiestheZomb);
                                end
                            else
                                setElementData(theZomb"status""chasing");
                                setElementData(theZomb"target"localPlayer);
                                table.insert(myZombiestheZomb);
                            end
                        end
                    end
                end
            end
        end
    end
end

addEventHandler("Spawn_Placement"root, function(xcoordycoord)
    local x,y,getElementPosition(localPlayer)
    local posx x+xcoord;
    local posy y+ycoord;
    local gz getGroundPosition(posxposyz+500);
    triggerServerEvent("onZombieSpawn"localPlayerposxposygz+1);
end); 


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
tiger18
Wysłany: 2018-08-24, 11:15


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

Jakie? b??dy w DB3?

Podpis
Portfolio marceliborowczak.me
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-24, 13:26


Fl!k







Wiek: 26
Na forum: 3593 dni
Posty: 162

Piwa: 18

Respekt: 50

Jest

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-24, 22:32


Gravgor







Wiek: 22
Na forum: 3620 dni
Posty: 380
Nick w MP: 1944

Piwa: 702

Respekt: 57,8

"Szym34kKacperQ" napisał/a:

Jest


Wy?lij nam ss'a z DB3 wskazuj?c te b??dy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-25, 17:04


Fl!k







Wiek: 26
Na forum: 3593 dni
Posty: 162

Piwa: 18

Respekt: 50

"Gravgor" napisał/a:

"Szym34kKacperQ" napisał/a:

Jest


Wy?lij nam ss'a z DB3 wskazuj?c te b??dy.



Dayz/zombies_s.lua:518") expected near '1'
debugscript3

ZOMBIE_S

local ZombieLimit 10;
local ZombieStreaming 0;
local ZombieSpeed 2;
local moancount 0;
local moanlimit 10;
local chaseanim "fatsprint"; --"Run_Wuzi";
local chaseblock "fat"; --"ped";
local checkspeed 100;
local everyZombie = {};
local zombiePedSkins = {
    13,22,56,67,68,69,
    70,92,97,105,107,
    108,126,127,128
};
local itemTableZombies = {
    {"Box of Matches"5},
    {"Wood Pile"5},
    {"M1911"0.4},
    {"PDW"0.3},
    {"Hunting Knife"7},
    {"Hatchet"7},
    {"Pizza"7},
    {"Soda Bottle"7},
    {"MP5A5"0.1},
    {"Empty Gas Canister"5},
    {"Roadflare"9},
    {"Baseball Bat"0.5},
    {"Milk"5},
    {"Assault Pack (ACU)"6},
    {"Painkiller"7},
    {"M9 SD"0.4},
    {"Empty Soda Cans"6},
    {"Scruffy Burgers"6},
    {"Grenade"0.5},
    {"Desert Eagle"0.3},
    {"Sawn-Off Shotgun"0.2},
    {"SPAZ-12 Combat Shotgun"0.2},
    {"Watch"3},
    {"Heat Pack"6},
    {"Wire Fence"1},
    {"Winchester 1866"0.4},
    {"Alice Pack"0.5},
    {"Tire"1},
    {"Morphine"2},
    {"Civilian Clothing"12},
    {"Map"4},
    {"Golf Club"0.5},
    {"GPS"1},
    {"Pasta Can"5},
    {"Beans Can"5},
    {"SKS-45"0.2},
    {"Burger"2},
    {"Radio Device"3},
    {"Shovel"0.5}
};

addEvent("onZombieSpawn"true);
addEvent("onZombieLostPlayer"true);
addEvent("onZombieGetsKilled"true);
addEvent("createZomieForPlayer"true);


function table.getn(table)
    return #table;
end

function Zomb_Idle(ped)
    if isElement(pedthen
        if (getElementData(ped"status") == "idle") and not isPedDead(ped) and getElementData(ped"zombie"then
            local action math.random(16);
            if (action 4then
                local rdmangle math.random(1359);
                setElementRotation(ped00rdmangle);
                setPedAnimation(ped"PED""Player_Sneak", -1truetruetrue);
                setTimer(Zomb_Idle70001ped);
            elseif (action == 4then
                setPedAnimation(ped"MEDIC""cpr", -1falsetruetrue);
                setTimer(Zomb_Idle40001ped);
            elseif (action == 5then
                setPedAnimation(ped);
                setTimer(Zomb_Idle40001ped);
            end
        end
    end
end

function chaseAnim(ped)
    if isElement(pedthen
        setPedAnimation(pedchaseblockchaseanim, -1truetruetrue);
    end
end

function Zomb_chase(pedZxZyZz)
    if isElement(pedthen
        if (getElementData(ped"status") == "chasing") and (getElementData(ped"zombie") == truethen
            local x,y,getElementPosition(ped);
            if ((getElementData(ped"target") == nil) and getElementData(ped"Tx") ~= falsethen            
                local Px getElementData(ped"Tx");
                local Py getElementData(ped"Ty");
                local Pz getElementData(ped"Tz");
                local Pdistance getDistanceBetweenPoints3D(PxPyPzxy);
                if (Pdistance 1.5then
                    setTimer(setElementData20001ped"status""idle");
                end
            end
            if (getDistanceBetweenPoints3D(xyzZxZyZz ) < 1.5then
                if not getElementData(ped"target"then
                    local giveup math.random(115);
                    if (giveup == 1then
                        setElementData(ped"status""idle");
                    else
                        local action math.random(12);
                        if (action == 2then
                            setPedAnimation(ped);
                            triggerClientEvent("Zomb_Jump"rootped);
                            setTimer(Zomb_chase1001pedxyz);
                        else
                            setPedAnimation(ped);
                            triggerClientEvent("Zomb_Punch"rootped);
                            zmoan(ped);
                            setTimer(chaseAnim8001ped);
                            setTimer(Zomb_chase1001pedxyz);
                        end
                    end
                else 
                    local Ptarget getElementData(ped"target");
                    if isElement(Ptargetthen
                        local Px,Py,Pz getElementPosition(Ptarget);
                        local Pdistance getDistanceBetweenPoints3D(PxPyPzZxZyZz);
                        if (Pdistance 1.5then
                            if isPedDead(Ptargetthen
                                setPedAnimation(ped);
                                setPedAnimation(ped"MEDIC""cpr", -1falsetruefalse);
                                setTimer(setElementData100001ped"status""idle");
                                setTimer(setElementRotation100001ped00getElementRotation(ped)-180);
                                zmoan(ped);
                            else
                                local action math.random(16);
                                if (action == 3then
                                    setPedAnimation(ped);
                                    triggerClientEvent("Zomb_Jump"rootped);
                                    setTimer(Zomb_chase1001pedxyz);
                                else
                                    setPedAnimation(ped);
                                    triggerClientEvent("Zomb_Punch"rootped);
                                    zmoan(ped);
                                    setTimer(chaseAnim8001ped);
                                    setTimer(Zomb_chase1001pedxyz);
                                end
                            end
                        else
                            setPedAnimation(pedchaseblockchaseanim, -1truetruetrue);
                            setTimer(Zomb_chasecheckspeed1pedxyz);
                        end
                    else
                        setElementData(ped"status""idle");
                    end
                end
            else
                setPedAnimation(pedchaseblockchaseanim, -1truetruetrue);
                setTimer(Zomb_chasecheckspeed1pedxyz);
            end
        end
    end
end

function setangle()
    for _,ped in ipairs(everyZombie) do
        if isElement(pedthen
            if (getElementData(ped"status" ) == "chasing"then
                local x,y,z,px,py,pz
                if (getElementData(ped"target") ~= nilthen
                    local ptarget getElementData(ped"target");
                    if isElement(ptargetthen
                        x,y,getElementPosition(ptarget);
                        px,py,pz getElementPosition(ped);
                    else
                        setElementData(ped"status""idle");
                        x,y,getElementPosition(ped);
                        px,py,pz getElementPosition(ped);
                    end
                    zombangle = (360-math.deg(math.atan2((x-px), (y-py))))%360;
                    setElementRotation(ped00zombangle);
                elseif (getElementData(ped"target") == nil) and (getElementData(ped"Tx") ~= falsethen
                    x getElementData(ped"Tx");
                    getElementData(ped"Ty");
                    getElementData(ped"Tz");
                    px,py,pz getElementPosition(ped);
                    zombangle = (360-math.deg(math.atan2((x-px), (y-py))))%360;
                    setElementRotation(ped00zombangle);
                end
            end
        end
    end
end

addEventHandler("onElementDataChange"root, function(dataName)
    if (getElementType(source) == "ped" and dataName == "status"then
        if (getElementData(source"zombie") == truethen
            if (isPedDead(source) == falsethen
                if (getElementData(source"status") ==  "chasing"then
                    local Zx,Zy,Zz getElementPosition(source);
                    setTimer(Zomb_chase10001sourceZxZyZz);
                    local newtarget getElementData(source"target");
                    if isElement (newtargetthen
                        if (getElementType(newtarget) == "player"then
                            setElementSyncer(sourcenewtarget);
                        end
                    end
                    zmoan(source);
                elseif (getElementData(source"status") ==  "idle"then
                    setTimer(Zomb_Idle10001source);
                elseif (getElementData(source"status") ==  "throatslashing"then
                    local tx,ty,tz getElementPosition(source);
                    local ptarget getElementData(source"target");
                    if isElement(ptargetthen
                        local vx,vy,vz getElementPosition(ptarget);
                        if (getDistanceBetweenPoints3D(txtytzvxvyvz) < .8then
                            zmoan(source);
                            setPedAnimation(source"knife""KILL_Knife_Player", -1falsefalsetrue);
                            setPedAnimation(ptarget"knife""KILL_Knife_Ped_Damage", -1falsefalsetrue);
                            setTimer(Playerthroatbitten23001ptargetsource);
                            setTimer(function(source) if (isElement(source)) then setElementData(source"status""idle"); end end50001source);
                        else
                            setElementData(source"status""idle");
                        end
                    else
                        setElementData(source"status""idle");
                    end
                end
            elseif (getElementData(source"status") ==  "dead"then
                setTimer(Zomb_delete100001source);
            end
        end
    end
end)


addEventHandler("onResourceStart"root, function(startedResource)
    newZombieLimit 50;
    if (newZombieLimit ~= falsethen
        if (newZombieLimit ZombieLimitthen 
            newZombieLimit ZombieLimit;
        end
    else
        newZombieLimit ZombieLimit;
    end
    WoodTimer setTimer(WoodSetup20001);
    if (startedResource == getThisResource()) then
        for _,thep in ipairs(getElementsByType("player")) do
            setElementData(thep"dangercount"0);
        end    
        for _,playerValue in ipairs(getAlivePlayers()) do
            setElementData(playerValue"alreadyspawned"true);
        end
        if (ZombieSpeed == 2then
            MainTimer1 setTimer(setangle2000);
        else
            MainTimer1 setTimer(setangle4000);
        end
        MainTimer3 setTimer(clearFarZombies30000);
        if (ZombieStreaming == 1then
            MainTimer2 setTimer(SpawnZombie25000);
        elseif (ZombieStreaming == 2then
            MainTimer2 setTimer(SpawnpointZombie25000);
        end
    end
end);

addEventHandler("onPlayerJoin"root, function()
    setElementData(source"dangercount"0)

function WoodSetup()
    for _,colValue in ipairs(getElementsByType("colshape")) do
        if (getElementData(colValue"purpose" ) == "zombiewood"then
            destroyElement(colValue);
        end
    end    
    for _,objectValue in ipairs(getElementsByType("object")) do
        if (getElementData(objectValue"purpose") == "zombiewood"then
            setElementDimension(objectValue26);
            local x,y,getElementPosition(objectValue);
            local thecol createColSphere(xyz1.6 );
            setElementData(thecol"purpose""zombiewood" );
            setElementParent(thecolobjectValue);
        end
    end    
end

function ReduceMoancount()
    moancount moancount 1;
end

function zmoan(zombie)
    if (moancount moanlimitthen
        moancount moancount 1;
        local randnum math.random(110);
        triggerClientEvent("Zomb_Moan"rootzombierandnum);
        setTimer(ReduceMoancount8001);
    end
end

function Zomb_delete(ped)
    if isElement(pedthen
        if (getElementData(ped"zombie") == truethen
            for theKey,thePed in ipairs(everyZombie) do
                if (ped == thePedthen
                    table.remove(everyZombietheKey);
                    break;
                end
            end
            destroyElement(ped);
        end
    end
end

function Playerthroatbitten(playerattacker)
    local ZxZyZz getElementPosition(attacker);
    local PxPyPz getElementPosition(player);
    local distance getDistanceBetweenPoints3D(PxPyPzZxZyZz);
    if (distance 1then
        killPed(playerattackerweaponbodypart);
    else
        setPedAnimation(player);
    end
end

function SpawnZombie()
    local pacecount 1;
    while (pacecount 5) do
        if (table.getn(everyZombie) + pacecount newZombieLimit) and (ZombieStreaming == 1then    
            local xcoord 0;
            local ycoord 0;
            local xdirection math.random(12);
            if (xdirection == 1then
                xcoord math.random(1540);
            else
                xcoord math.random(-40, -15);
            end
            local ydirection math.random(12);
            if (ydirection == 1then
                ycoord math.random(1540);
            else
                ycoord math.random(-40, -15);
            end
            local liveplayers getAlivePlayers();
            if (table.getn(liveplayers) > 0then
                local lowestcount 99999;
                local lowestguy nil;
                for _,thePlayer in ipairs(liveplayers) do
                    if isElement(thePlayerthen
                        if (getElementData(thePlayer"dangercount")) and (getElementData(thePlayer"zombieProof") ~= true) and (getElementData(thePlayer"alreadyspawned" ) == truethen
                            if (getElementData (thePlayer"dangercount") < lowestcountthen
                                local safezone 0;
                                local gx,gy,gz getElementPosition(thePlayer);
                                for _,theradar in ipairs(getElementsByType("radararea")) do
                                    if (getElementData(theradar"zombieProof") == truethen
                                        if isInsideRadarArea(theradargxgythen
                                            safezone 1;
                                        end
                                    end
                                end
                                if (safezone == 0then
                                    lowestguy thePlayer;
                                    lowestcount getElementData(thePlayer"dangercount");
                                end
                            end
                        end
                    end
                end
                pacecount pacecount 1;
                if isElement(lowestguythen
                    triggerClientEvent("Spawn_Placement"lowestguyycoordxcoord);
                else
                    pacecount pacecount 1;
                end
            else
                pacecount pacecount 1;
            end
        else
            pacecount pacecount 1;
        end
    end
end

function clearFarZombies()
    if (newZombieLimit ~= falsethen
        local toofarzombies = {};
        for ZombKey,theZomb in ipairs(everyZombie) do
            if isElement(theZombthen
                if getElementData(theZomb"zombie"then
                    far 1;
                    local Zx,Zy,Zz getElementPosition(theZomb);
                    for _,thePlayer in ipairs(getElementsByType("player")) do
                        local Px,Py,Pz getElementPosition(thePlayer);
                        if (getDistanceBetweenPoints3D(PxPyPzZxZyZz) < 75then
                            far 0;
                        end
                    end
                    if (far == 1then
                        table.insert(toofarzombiestheZomb);
                    end
                end
            else
                table.remove(everyZombieZombKey);
            end
        end
        if (table.getn(toofarzombies) > 1then
            for _,theZomb in ipairs(toofarzombies) do
                if getElementData(theZomb"zombie") and not getElementData(theZomb"forcedtoexist"then
                    Zomb_delete(theZomb);
                end
            end
        end
    end
end

addEventHandler("onPlayerSpawn"root, function()
    if (ZombieStreaming == or ZombieStreaming == 2then
        local relocatecount 0;
        for _,theZomb in ipairs(everyZombie) do
            if (relocatecount 14then
                if not getElementData(theZomb"forcedtoexist"then
                    if (getElementData(theZomb"status") == "idle") and not isPedDead(theZomb) and getElementData(theZomb"zombie"then
                        relocatecount relocatecount 1;
                        Zomb_delete(theZomb);
                    end
                end
            end
        end
    end
    if not getElementData(source"alreadyspawned"then
        setElementData(source"alreadyspawned"true);
    end
end);

function createZombie(xyzrotskin)
    if (table.getn(everyZombie) < newZombieLimitthen
        local zomb createPed(tonumber(skin), tonumber(x), tonumber(y), tonumber(z));
        if isElement(zombthen
            setElementData(zomb"zombie"true);
            setElementData(zomb"forcedtoexist"true);
            setElementRotation(zomb00rot);
            setElementData(zomb"status""idle");
            table.insert(everyZombiezomb);
            triggerClientEvent("Zomb_STFU"rootzomb);
            return zomb;
        end
    end
    return false;
end

function isPedZombie(ped)
    if isElement(pedthen
        if getElementData(ped"zombie"then
            return true;
        end
    end
    return false;
end

addEventHandler("onZombieLostPlayer"root, function(xyz)
    setElementData(source"Tx"xfalse);
    setElementData(source"Ty"yfalse);
    setElementData(source"Tz"zfalse);
end);

addEventHandler("createZomieForPlayer"root, function(xyz)
    local zombie createZombie(xyzmath.random(360), zombiePedSkins[math.random(#zombiePedSkins)]);
    setElementData(zombie"zombie"true);
    setElementData(zombie"blood"math.random(800012000));
    setElementData(zombie"owner"client);
    setElementData(client"spawnedzombies"getElementData(client"spawnedzombies") + 1);
end);

addEventHandler("onPlayerQuit"root, function()
    for _,v in ipairs(getElementsByType("ped")) do
        if getElementData(v"zombie"then
            if (getElementData(v"owner") == sourcethen
                destroyElement(v);
            end
        end
    end
end);

addEventHandler("onZombieGetsKilled"root, function(killerheadshot)
    if (killer and getElementType(killer) == "player"then
        if headshot then
            setElementData(killer"headshots"getElementData(killer"headshots") + 1);
        end
        setElementData(killer"zombieskilled"getElementData(killer"zombieskilled") + 1);
    end
    local x,y,getElementPosition(source);
    local ped createPed(getElementModel(source), xyz);
    local pedCol createColSphere(xyz1.5);
    killPed(ped);
    setTimer(function(pedpedCol)
        if ped then destroyElement(ped); end
        if pedCol then destroyElement(pedCol); end
    end, (10*60000), 1pedpedCol);
    attachElements(pedColped);
    setElementData(pedCol"parent"ped);
    setElementData(pedCol"playername""Zombie");
    setElementData(pedCol"deadman"true);
    setElementData(pedCol"MAX_Slots"8);
    setElementData(ped"deadzombie"true);
    local time getRealTime();
    setElementData(pedCol"deadreason""Looks like it's finally dead. Estimated time of death: "..time.hour..":"..time.minute.." o'clock.");
    for _,v in ipairs(itemTableZombies) do
        local value math.percentChance(v[2]/2.51);
        setElementData(pedColv[1], value);
        local ammoData,getWeaponZombieAmmoType(v[1]);
        if (ammoData and value 0then
            setElementData(pedColammoData1);
        end
    end
    local zOwner getElementData(source"owner");
    setElementData(zOwner"spawnedzombies"getElementData(zOwner"spawnedzombies"1);
    destroyElement(source);
end);


Postaw piwo autorowi tego posta
 

 
Tagi: zombie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zombie Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku