AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Submissions (https://forums.alliedmods.net/forumdisplay.php?f=35)
-   -   Hero: Ally Push (https://forums.alliedmods.net/showthread.php?t=144077)

Jelle 11-28-2010 14:19

Hero: Ally Push
 
1 Attachment(s)
Ally Push

Description
If you die your teammates will get more HP

shconfig.cfg CVARS
Code:

//Ally Push
ally_level 5    //Level needed for this hero
ally_hptoadd 500    //HP to add to allies when player with this hero dies

Code:

/* Changelog:
* v1.4 - Jelle - 15/7/12
*      - Used another native to add the HP
* v1.3 - Jelle - 18/1/11
*      - Fixed some player index error
* v1.2 - Jelle - 11/30/10
*      - Fixed an error if you put SH_MAXSLOTS to anything but 32
*      - Minor optimization
* v1.1 - Jelle - 11/29/10
*      - Fixed a few errors thanks to fr33m@n!
* v1.0 - Jelle - 11/28/10
*      - Initial release
*/



**SuperHero Mod 1.2.0 & up ONLY**


Credits:
A warcraft 3 custom map called Tech Wars tournament where I get the idea from.

Fr33m@n 11-29-2010 10:45

Re: Hero: Ally Push
 
the description doesn't correspond to that the hero do.

first the effect only happen if the victim is on ct team, and if the effect happen not teamate but both team will win hp.

Jelle 11-30-2010 14:37

Re: Hero: Ally Push
 
I just thought of something. Maybe it would be an idea to post that it has been updated.

So...

It is now updated!!!!

Fr33m@n 11-30-2010 15:37

Re: Hero: Ally Push
 
cache the get_pcvar_num before the loop.
don't use SH_MAXSLOTS for players array.
explanation here : http://fs.alliedmods.net/index.php?d...2007&project=7

Jelle 11-30-2010 15:50

Re: Hero: Ally Push
 
Quote:

Originally Posted by Fr33m@n (Post 1360353)
cache the get_pcvar_num before the loop.

Why? It has an if condition, so it only gets the pcvar num if it actually needs it.

Quote:

Originally Posted by Fr33m@n (Post 1360353)
don't use SH_MAXSLOTS for players array.
explanation here : http://fs.alliedmods.net/index.php?d...2007&project=7

Crap, forgot about that. Will change it when I get home from school!

Emp` 11-30-2010 16:25

Re: Hero: Ally Push
 
Quote:

Originally Posted by Jelle (Post 1360364)
Why? It has an if condition, so it only gets the pcvar num if it actually needs it.

Fr33m@n is right, caching it will call get_pcvar_num once versus calling it for each teammate.

Jelle 11-30-2010 17:27

Re: Hero: Ally Push
 
New version uploaded.

Vantri 01-17-2011 13:04

Re: Hero: Ally Push
 
Quote:

L 01/17/2011 - 18:29:56: [CSTRIKE] Player out of range (0)
L 01/17/2011 - 18:29:56: [AMXX] Displaying debug trace (plugin "sh_allypush.amxx")
L 01/17/2011 - 18:29:56: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 01/17/2011 - 18:29:56: [AMXX] [0] sh_allypush.sma::sh_client_death (line 42)
How to fix?

Fr33m@n 01-17-2011 17:23

Re: Hero: Ally Push
 
Jelle correct this dammit...

PHP Code:

players[i] = player 

player will always be 0...
and you zeroed identification numbers of players you just getting.

PHP Code:

player players[i


Jelle 01-17-2011 19:24

Re: Hero: Ally Push
 
Oh damn. Well, fixed.


All times are GMT -4. The time now is 03:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.