Jump to content

zombie kill


Wei

Recommended Posts

Posted
function removeZombiesIfNotLasVenturas() 
    for k, v in ipairs (getElementByType("ped")) do 
        if not isElementWithinColShape( v, zombiesZone ) then 
            if isPedZombie( v ) then 
            killPed( v ) 
            end 
        end 
    end 
end 
addEventHandler("onClientRender", getRootElement(), removeZombiesIfNotLasVenturas) 

why it doesn't kill the zombie?

or zombie is not ped?

Diet with russian vodka, lose 3 days in one week !

Posted
getElementByType 

It's:

getElementsByType 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

killPed is a server side function.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function removeZombiesIfNotLasVenturas() 
    for k, v in ipairs (getElementByType("ped")) do 
        if not isElementWithinColShape( v, zombiesZone ) then 
            if isPedZombie( v ) then 
            killPed( v ) 
            end 
        end 
    end 
end 
addEventHandler("onClientRender", getRootElement(), removeZombiesIfNotLasVenturas) 

why it doesn't kill the zombie?

or zombie is not ped?

Don't use onClientRender for this. Use onColShapeHit if you created a col shape (https://wiki.multitheftauto.com/wiki/OnColShapeHit) and do it server-side or triggerServerEvent to killPed but I don't see any reason why it should be client-side.

Posted

bump. What's the easiest way to have peds only inside col shape ?

Diet with russian vodka, lose 3 days in one week !

Posted
addEventHandler ( "onColShapeLeave", theColshape, 
    function ( leaveElement ) 
        if ( leaveElement and getElementType ( leaveElement ) == "ped" ) then 
            if ( exports [ "zombies" ]:isPedZombie ( leaveElement ) ) then 
                killPed ( leaveElement ) 
            end 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

but zombies can spawn outside of col shape. I wanna have them in col shape only

Diet with russian vodka, lose 3 days in one week !

Posted

You can make spawnpoints inside the colshape, then set the spawn method at the "meta.xml" of "zombies" to spawn only on spawnpoints.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yeah. I will do that. I thought that there is a easier way. Thanks anyway.

Diet with russian vodka, lose 3 days in one week !

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Scroll the mouse down.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Did you load the "zombies" definition?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I don't remember right now, but there's a button called "definitions" or something like that.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Is the "zombies" resource at the same server your map editor is?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I loaded "zombies" definition without problems.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ok make it work where is some picture ? to use it

Diet with russian vodka, lose 3 days in one week !

Posted
I loaded "zombies" definition without problems.

What was the point of that post? That isn't helpful?

Blazy you need a better understanding of how the editor works? https://wiki.multitheftauto.com/wiki/Resource:Editor/EDF

There should be a file within the zombie resource with a .edf extension. Therefore if you are trying to run map editor thru main menu this resource needs to be in the local mta server resources folder. If you are running a dedicated server (that is, the one independent of the client) and you start map editor from inside the server, you need the resource in the resource folder of the dedicated server's resources folder.

In other words: Starting a server or map editor from MTASA main menu will use a local 'quickstart' server that has totally separate files and resources.

If the edf isn't showing up in the editor then the scan for EDFs failed to find it.

Edit I just did some confirming:

I put zombies in the resources dir, did refresh, started the editor and zombies appeared in the 'definitions' selector

So it's all working

The editor is unrealiable though

He should try installing MTA to a new directory and see if that helps

There you go straight from the dev :)

You can always try our scripting channel at irc.mutitheftauto.com #mta-scripting (or click the IRC CHAT link up top) ... it is not instant gratification but it can be faster than forums.

image.gif.e25ddd8be17e3a9b50a78609787fabd6.gif

Offical B.L.A.S.T.A.ddict
VCP - winners of the official MTA tournament (undefeated!) /smug

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...