Raised This Month: $ Target: $400
 0% 

Subplugin Submission [ZP] Human HP Disguise


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-04-2009 , 16:49   Re: [ZP] Human HP Disguise
Reply With Quote #1

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
Speed!
BANNED
Join Date: Jan 2009
Old 04-05-2009 , 20:19   Re: [ZP] Human HP Disguise
Reply With Quote #2

Quote:
Originally Posted by Exolent[jNr] View Post
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.
using static's and using cached cvars at round start would be nice
Speed! is offline
Reply



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 16:52.


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