Jump to content

Zombies Weapons


BorderLine

Recommended Posts

Posted

Hi forum's people.

I need a big help, and is how i can give to zombies some weapons, like bat, or knife or other.

The script is the same of slothman, and i dont know how start :S

just i know how setteam to some ped, but i dont know if this is same.

If someone know how doit, please :)

my server is Biohazard, if someone want visit it :D (sorry offtopic, just say information)

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

-- server side:

addEvent("onZombieSpawn",true) 
addEventHandler("onZombieSpawn",root, 
function () 
   if (source and getElementType(source) == "ped") then 
        giveWeapon(source, 8, 1, true) 
   end 
end) 

I'm not sure if it'll work.

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

dont work :/ and debugscript 3 dont detect errors :S

thanks, im try to make something if i can doit

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

i cant :/ some other player know how do this?

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted
ped = createPed( 19, -1634.5775, 1203.85, 7.1796 ) 
  
addCommandHandler( "give", 
  function ( player, command, id, amount ) 
    if not tonumber ( id ) then return end 
  
    if not tonumber ( amount ) then 
        amount = 9001 
    end 
  
    giveWeapon( ped, id, amount, true ) 
  end 
) 

You can give him a weapon with "give " command in console.

Posted

Sounds like the 'source' of onZombieSpawn is a player, I don't get it, why isn't a zombie?

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

This will do the job

addEvent("Zomb_STFU",true) 
addEventHandler("Zomb_STFU",root, 
function ( zomb ) 
   if zomb and getElementType ( zomb ) == "ped" then 
        giveWeapon ( zomb, 8, 1, true ) 
   end 
end) 

Posted

Yes, I had the same idea Benxamix.

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

thank benxamix.. but dont work :S.

and debugscript dnt show errors.

some pleyer toldme, he make this with bot sistem

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted
addEvent("Zomb_STFU",true) 
addEventHandler("Zomb_STFU",root, 
function ( zomb ) 
   if zomb and getElementType ( zomb ) == "ped" then 
        giveWeapon ( zomb, 8, 1, true ) 
        outputChatBox ( "zomb with weapon!" ) 
   end 
  
        outputChatBox ( "zombie spawned!" ) 
end) 

Try it and tell me what does it say when a zombie spawns.

Posted

dont show message, but im change Zomb_STFU to onZombieSpawn

  
  
addEvent("onZombieSpawn",true) 
addEventHandler("onZombieSpawn",root, 
function ( zomb ) 
   if zomb and getElementType ( zomb ) == "ped" then 
        giveWeapon ( zomb, 8, 1, true ) 
        outputChatBox ( "zomb with weapon!" ) 
   end 
  
        outputChatBox ( "zombie spawned!" ) 
end) 
  

then show message "zombie spawned!"

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

Yes, that's the same thing I'd, you should read the posts above, John.

P.S: I think Slothman should put the source as the ped.

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 just understood my mistake and why all doesn't work.

CLIENT.

addEvent("Zomb_STFU",true) 
addEventHandler("Zomb_STFU",root, 
function ( zomb ) 
   triggerServerEvent ( "onZombieSpawned", zomb ) 
end) 

SERVER:

addEvent("onZombieSpawned",true) 
addEventHandler("onZombieSpawned",root, 
function ( ) 
  giveWeapon ( source, 8, 1, true ) 
end) 

That should work :D

Posted

Why would the source be a player? lol.

In this case, do this:

  
addEvent( "onZombieSpawn", true ) 
--ADD THIS 
addEvent("onZombieCreate", true) 
function RanSpawn_Z ( gx, gy, gz, rot) 
    local safezone = 0 
    local allradars = getElementsByType("radararea") 
    for theKey,theradar in ipairs(allradars) do 
        if getElementData(theradar, "zombieProof") == true then 
            if isInsideRadarArea ( theradar, gx, gy ) then 
                safezone = 1 
            end 
        end 
    end 
    if safezone == 0 then 
        if table.getn ( everyZombie ) < newZombieLimit then 
            if not rot then 
                rot = math.random (1,359) 
            end 
            randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) )           
            local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz ) 
            if zomb ~= false then 
                setElementData ( zomb, "zombie", true  ) 
                table.insert( everyZombie, zomb )    
                setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot ) 
                setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb ) 
                setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb ) 
                triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb ) 
                --ADD THIS 
                triggerEvent("onZombieCreate", zomb) 
            end 
        end 
    end 
end 
addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z ) 
  

In zombie_server.lua in the zombies resource.

Then, just use the onZombieCreate event.

Posted
Why would the source be a player?
function Spawn_Place(xcoord, ycoord) 
    local x,y,z = getElementPosition( getLocalPlayer() ) 
    local posx = x+xcoord 
    local posy = y+ycoord 
    local gz = getGroundPosition ( posx, posy, z+500 ) 
    triggerServerEvent ("onZombieSpawn", getLocalPlayer(), posx, posy, gz+1 ) 
end 

Also I already made a solution, why do you create another one? :P

Posted
I just understood my mistake and why all doesn't work.

CLIENT.

addEvent("Zomb_STFU",true) 
addEventHandler("Zomb_STFU",root, 
function ( zomb ) 
   triggerServerEvent ( "onZombieSpawned", zomb ) 
end) 

SERVER:

addEvent("onZombieSpawned",true) 
addEventHandler("onZombieSpawned",root, 
function ( ) 
  giveWeapon ( source, 8, 1, true ) 
end) 

That should work :D

This work perfect

thank a lot Benxamix2, and solid and jhon..

and the last question. i dont disturb.

how i can add more weapons.

I mean. not all zombies have same weapons, some chainsaw, others knife or katana

what is that fuction for do that?

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

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...