Raised This Month: $32 Target: $400
 8% 

Subplugin Submission [ZP] Human HP Disguise


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   Exolent[jNr] (178)
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 15:09   [ZP] Human HP Disguise
Reply With Quote #1

[ZP] Human HP Disguise 1.0
BOYSplayCS

Description:
When the humans HP drops below a certain amount, they will turn semi-invisible.


Cvars:
zp_disguise_health "35" - Determines the health needed to turn semi-invisible
zp_disguise_alpha "0" - Determines the invisibility amount


Credits:
Exolent - Provided coding help/optimization


Changelog:
4/4/09: Plugin Released (1.0)
4/4/09: Code Changed (1.0) //thanks to Exolent

Attached Files
File Type: sma Get Plugin or Get Source (zp_human_disguise.sma - 3893 views - 1.2 KB)

Last edited by BOYSplayCS; 04-04-2009 at 16:59.
BOYSplayCS is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 04-04-2009 , 15:18   Re: [ZP] Human HP Disguise
Reply With Quote #2

o0o, shouldn't this be under the zp topic?

By the way, nice plugin
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 15:20   Re: [ZP] Human HP Disguise
Reply With Quote #3

You know, I'm not so sure. I've been reading about where to post it and everything is confusing me. I think I post it here first, I am not sure at all.

Thank you
BOYSplayCS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-04-2009 , 16:10   Re: [ZP] Human HP Disguise
Reply With Quote #4

All submitted plugins should be posted here.
If it is for a certain mod that has it's own sub-forum, it will be moved if it is approved.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 16:30   Re: [ZP] Human HP Disguise
Reply With Quote #5

Thank you Exolent. I need some feedback for this plugin so I can get it approved. It does work for me though.
BOYSplayCS is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 16:44   Re: [ZP] Human HP Disguise
Reply With Quote #6

Notice: View the regular version here!
BOYSplayCS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-04-2009 , 16:49   Re: [ZP] Human HP Disguise
Reply With Quote #7

Okay, lets start.

1. I suggest a cvar for the visibility.

2. I don't think you need ".inc" in the #include.
Code:
#include <zombieplague> // should be enough

3.
Code:
if (get_user_health( id ) > get_pcvar_num( hplevel ) || zp_get_user_zombie(id)) {     return PLUGIN_CONTINUE }
This won't help much, but it will help.
Code:
if (zp_get_user_zombie(id) || get_user_health( id ) > get_pcvar_num( hplevel )) {     return PLUGIN_CONTINUE }

4.
Code:
client_print(id, print_chat, "[ZP] Your health is below %d, you are now semi-invisible.", hplevel);
You printed the cvar pointer value, not the cvar value, lol.[/pawn]

5. I haven't tested, but it seems like the message will be displayed every time the player is hurt after the message has shown the first time.

6. I would do it like this:
Code:
#include <amxmodx> #include <amxmisc> #include <zombieplague> #include <fun> #define PLUGIN "Human HP Disguise" #define VERSION "1.0" #define AUTHOR "BOYSplayCS" new hplevel // Amount of HP before turning Semi-Invisible. new invisamount // Alpha amount for when player has become Semi-Invisible new g_old_health[33]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("Health", "EventHealth", "b");         hplevel = register_cvar("zp_disguise_health", "35");     invisamount = register_cvar("zp_disguise_alpha", "0"); } public EventHealth(client) {     new health = read_data(2);     if( health == g_old_health[client] ) return;         if( !zp_get_user_zombie(id) && health > 0 )     {         new disguise_amount = get_pcvar_num(hplevel);         if( health <= disguise_amount && g_old_health[client] > disguise_amount )         {             set_user_rendering(client, kRenderFxNone, 0, 0, 0, kRenderTransAdd, get_pcvar_num(invisamount));             client_print(client, print_chat, "[ZP] Your health is below %d, you are now semi-invisible.", disguise_amount);         }     }         g_old_health[client] = health; }

Also, you can take these same suggestions for the "Normal" version.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 16:52   Re: [ZP] Human HP Disguise
Reply With Quote #8

I was actually in the middle of adding a cvar for the invis amount.

About the %d, that was a mistake, lol. I was rushing through it and must have accidentally typed d.

I will add your suggestions, thank you
BOYSplayCS is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-04-2009 , 16:53   Re: [ZP] Human HP Disguise
Reply With Quote #9

No, %d isn't the problem. %d and %i are the same. The problem is that you used "hplevel" in the formatting instead of "get_pcvar_num(hplevel)".
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 04-04-2009 , 16:59   Re: [ZP] Human HP Disguise
Reply With Quote #10

I thought that for a cvar value you always used %i though? Guess not, thanks!

Updated
BOYSplayCS is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:46.


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