Raised This Month: $51 Target: $400
 12% 

[CSS] Hostages Health


Post New Thread Reply   
 
Thread Tools Display Modes
Afronanny
Veteran Member
Join Date: Aug 2009
Old 11-07-2010 , 17:58   Re: [CSS] Hostages Health
Reply With Quote #11

You only need to hook the events once in OnPluginStart. Re-hooking on mapstart may lead to the callbacks being fired multiple times.
Afronanny is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 11-10-2011 , 16:51   Re: [CSS] Hostages Health
Reply With Quote #12

Nice job for your first released plugin.

Some things I noticed.

PHP Code:
        new ent = -1;
        new 
prev 0;
        while ((
ent FindEntityByClassname(ent"hostage_entity")) != -1)
        {
            if (
prevHostage(prev);
            
prev ent;
        }
        if (
prevHostage(prev); 
You can simplify this. You just need ent since prev isn't going to be deleted (like the example you saw)

PHP Code:
        new ent = -1;
        while ((
ent FindEntityByClassname(ent"hostage_entity")) != -1)
        {
            if (
entHostage(ent);
        } 
PHP Code:
public Event_HostageFollows(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    new 
hostage GetEventInt(event"hostage");
    new 
health GetEntProp(hostageProp_Data"m_iHealth"1);

    if(
GetConVarInt(cvar_showhp) == && GetConVarInt(cvar_god) == 0)
    {
        
PrintToChat(client"\x01Hostage health \x04%i\x01HP"health);
    }

Since you don't always need client, hostage or health you should check the cvars first then grab them if you need to.

Everything else looks good. Once the changes are made ill approve it.

Last edited by Dr!fter; 11-10-2011 at 16:54.
Dr!fter is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-10-2011 , 17:01   Re: [CSS] Hostages Health
Reply With Quote #13

XD
That's so true. Didn't remember that I have done this.
__________________
Do not Private Message @me
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-11-2011 , 10:09   Re: [CSS] Hostages Health
Reply With Quote #14

Updated
I wanted made lot change, even it go more worse.

Approved or not
__________________
Do not Private Message @me
Bacardi is offline
GamingUnited
Junior Member
Join Date: May 2015
Old 05-09-2015 , 20:41   Re: [CSS] Hostages Health
Reply With Quote #15

Hi , is the Plugin work?
GamingUnited is offline
twpower
Junior Member
Join Date: Mar 2019
Old 03-15-2019 , 02:56   Re: [CSS] Hostages Health
Reply With Quote #16

This feature no longer exists
Will he update?
twpower 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 07:26.


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