Zombie Infection?
#1

Hey guys, i want to make it to when a zombie attacks a human with a knife or chainsaw the human automatically gets infected. I'm not talking about OnPlayerDeath; i want it to make it to where one slash/swipe infects a human. I've seen it on two servers. How do i do this?

Keep in mind...

players lose health when they fall from high places, explosions, etc



Thanks
Reply
#2

And one of the server is mine, eh? (Maybe not, because in mine you get infected if the zombie hits you with anything).
By the way, why don't you try to re-create It yourself? xD
Reply
#3

Oh no I'm not going to copy it. It's completely different. I just think it's unfair that zombies with no weapons have to fully kill a human.
Reply
#4

What kills you is not a weapon. It's a virus.
Reply
#5

So it checks like if a player is near a player and after enough time and/or encounters you get infected?
Reply
#6

Nope.
It's not used that much in my server so I could tell you the Idea.

When a player press KEY_FIRE, It checks if you're a zombie. (An Admin must first make someone a zombie, or the player was infected by going to close to some secret place)
If you're a zombie, a loop checks all players If they're close to you.
If they're close enough It makes them a zombie.

Simple.
Then you can set their skins, make a timer to do w/e every w/e seconds.
Reply
#7

oh my god that is so simple and i feel so dumb now wait.. if someone spams the button won't it lag the server?
Reply
#8

Not really. I never had any experience of that. Oh, by the way, you should make something like this;

pawn Код:
#define M_PLAYERS  40
and use M_PLAYERS instead of MAX_PLAYERS in loops.

(obviously change 40 to how many players you expect in your server).
This will increase the performance of the loops
Reply
#9

What about using 'foreach'?
Reply
#10

I didn't know about that, I just looked It up.
That'll probably work better
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)