SA-MP Forums Archive
Zombie Infection? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Zombie Infection? (/showthread.php?tid=156509)



Zombie Infection? - VictorMartinez - 22.06.2010

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


Re: Zombie Infection? - Mike Garber - 22.06.2010

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


Re: Zombie Infection? - VictorMartinez - 22.06.2010

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.


Re: Zombie Infection? - Mike Garber - 22.06.2010

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


Re: Zombie Infection? - VictorMartinez - 22.06.2010

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


Re: Zombie Infection? - Mike Garber - 22.06.2010

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.


Re: Zombie Infection? - VictorMartinez - 23.06.2010

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?



Re: Zombie Infection? - Mike Garber - 23.06.2010

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


Re: Zombie Infection? - VictorMartinez - 23.06.2010

What about using 'foreach'?


Re: Zombie Infection? - Mike Garber - 23.06.2010

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