Raised This Month: $ Target: $400
 0% 

Show also while spectating


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-14-2012 , 07:47   Re: Show also while spectating
Reply With Quote #1

You need a repeated task or think that displays the message during whilst spectating. I believe that EV_INT_iuser2 is the correct key to get the player id that a user is spectating.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
mazmaajinsh
Senior Member
Join Date: Apr 2005
Location: Latvia
Old 05-14-2012 , 10:50   Re: Show also while spectating
Reply With Quote #2

how should i do that?
__________________
Ahujena
mazmaajinsh is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-14-2012 , 23:36   Re: Show also while spectating
Reply With Quote #3

In a perfect world you would only want the entity thinking when there are player(s) spectating. I don't feel like doing the extra work though. I also do not have the zombieplague include so I was not able to compile\test.

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <zombieplague>

new const Version[] = "0.1";

const 
MAX_PLAYERS 32;

new 
g_status_sync g_iSpecEntity;

#define IsSpectating(%1)    (is_user_connected(%1)&&!is_user_alive(%1)&&!is_user_bot(%1))

public plugin_init() 
{
    
register_plugin"Spectate Info" Version "@bdul!+Sn!ff3r+bugsy" );
    
    
register_dictionary("zp_aim_info.txt");
    
g_status_sync CreateHudSyncObj()
    
    
g_iSpecEntity create_entity"info_target" );
    
entity_set_stringg_iSpecEntity EV_SZ_classname "spec_entity" );
    
register_think"spec_entity" "fw_SpecEntThink" );
    
entity_set_floatg_iSpecEntity EV_FL_nextthink , ( get_gametime() + 0.2 ) );
}

public 
fw_SpecEntThinkiEntity )
{
    static 
iSpectator iSpectated;
    
    for ( 
iSpectator iSpectator <= MAX_PLAYERS iSpectator++ )
    {
        if ( 
IsSpectatingiSpectator ) && ( iSpectated peviSpectator pev_iuser2 ) ) )
        {
            
//iSpectator is spectating iSpectated
        
            
static name[32];
            
            
get_user_name(iSpectatednamecharsmax(name))
            new 
color1 0color2 0
            
            
new team1 zp_get_user_zombie(iSpectator), team2 zp_get_user_zombie(iSpectated)
            
            if (
team2 == 1)
                
color1 255
            
else
                
color2 255
            
            
if (team1 == team2)    // friend
            
{
                
set_hudmessage(color150color2, -1.00.6010.013.00.010.01, -1)
                
ShowSyncHudMsg(iSpectatorg_status_sync"%L"LANG_PLAYER"AIM_INFO"nameget_user_health(iSpectated), get_user_armor(iSpectated), zp_get_user_ammo_packs(iSpectated))
            }
        }
    }
    
    
entity_set_floatg_iSpecEntity EV_FL_nextthink , ( get_gametime() + 0.2 ) );

__________________
Bugsy 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 00:24.


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