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

Hudmessage .. in the head ?!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-01-2012 , 13:29   Hudmessage .. in the head ?!
Reply With Quote #1

Ok , i think about this , and i question , its possible to see a hudmessage overhead ? if yes , can any look any example ? thanks you.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 02-01-2012 , 13:35   Re: Hudmessage .. in the head ?!
Reply With Quote #2

try this: (this abandoned)

PHP Code:
/*
* Abovehead Name and Health Displayer v1.0 | By: kiki33 | Steam: kkiki33



* Cvars:

* amx_headname "1" <-- Enable/Disable the plugin with this cvar!
* amx_showhealth "1" <-- 

* amx_headname_red "255" <-- 0...255
* amx_headname_green "255" <-- 0...255
* amx_headname_blue "255" <-- 0...255

*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <chr_engine>

#define NEV "Abovehead Name and Health Displayer"
#define VERZIO "1.0"
#define KESZITO "Kiki33"

#pragma tabsize 1

new g_OnOff;
new 
g_ShowHealth;
new 
MessageSay;
new 
bool:g_nemakarom33 ]

public 
plugin_init() 
{
            
register_plugin(NEVVERZIOKESZITO)
            
register_forwardFM_PlayerPreThink"PlayerPreThink")
            
register_event("ResetHUD""eventPlayerSpawn""b");
            
            
register_clcmd"say /headname""block" );
            
register_clcmd"say_team /headname""block" ); 
            
            
register_cvar("amx_headname_red""255")
            
register_cvar("amx_headname_green""155")
            
register_cvar("amx_headname_blue""0")
            
            
g_OnOff register_cvar("amx_headname""1")
            
g_ShowHealth register_cvar("amx_showhealth""1")
            
            
MessageSay get_user_msgid "SayText" )
            
            
set_task(385.0"adv"0""0"b"); 
}

public 
client_disconnect(id)

    
g_nemakarom[id] = true;
    return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)

    
g_nemakarom[id] = true;
    return 
PLUGIN_CONTINUE
}

public 
client_authorized(id)

    
g_nemakarom[id] = true;
    return 
PLUGIN_CONTINUE
}

public 
PlayerPreThink(id)
{
    if(!
g_nemakarom[id] == false)
    if(
get_pcvar_numg_OnOff ) )
    {
        static 
Float:origin[3], players[32], numnum2team;
        
        
team get_user_teamid );
        
arraysetplayers032 );
        
        
pevidpev_originorigin );        
        
        
get_players_distance(origin,players,num,"a")
        
        static 
Float:hudpos[2]
        static 
Float:origin2[3]
        
num2=0
        
for( new k=0numk++ )
        {
            if(
players] && get_user_teamplayers] ) == team )
            {
                static 
nev[33];
                
get_user_nameplayers[k], nev32 );
                
pevplayers[k], pev_originorigin2 );
                
origin2[2] = origin[2] + 10.0;
                if(
get_hudmessage_locs(id,origin2,hudpos) && get_pcvar_numg_ShowHealth ) == )
                {
                    
num2++
                    
set_hudmessageget_cvar_num("amx_headname_red"), get_cvar_num("amx_headname_green"), get_cvar_num("amx_headname_blue"), hudpos[0], hudpos[1], 06.00.20.10.2num2 );
                    
show_hudmessage(id"%s  | Elete: %d",nevget_user_health(players[k]))
                    if(
num2==4) break;
                }
                if(
get_hudmessage_locs(id,origin2,hudpos) && get_pcvar_numg_ShowHealth ) == )
                {
                    
num2++
                    
set_hudmessageget_cvar_num("amx_headname_red"), get_cvar_num("amx_headname_green"), get_cvar_num("amx_headname_blue"), hudpos[0], hudpos[1], 06.00.20.10.2num2 );
                    
show_hudmessage(id"%s",nev)
                    if(
num2==4) break;
                }
            }
        }
     
    }
}
public 
eventPlayerSpawn(id)
{
    if( !
get_pcvar_numg_OnOff ) )
        return 
PLUGIN_CONTINUE;
    
    
colored_print(id"!gA nevek be/ki kapcsolasahoz ird be: say /headname");
    
colored_print(id"!gA plugint keszitette kiki");

    return 
PLUGIN_CONTINUE;
}
public 
block(id)
{
    if( !
get_pcvar_numg_OnOff ) )
        return 
PLUGIN_CONTINUE;

    
g_nemakarom[id] = g_nemakarom[id] ? false true;
    
        if(
g_nemakarom[id] == false)
        {
                
kikapcsolva(id);
        }
            
        if(
g_nemakarom[id] == true)
        {
                
aktivalva(id);
        }
    
     return 
PLUGIN_CONTINUE;
}

public 
adv()
{
    
colored_print(0"A nevek kikapcsolasahoz ird be a chatbe: /headname")
}

stock kikapcsolva(id)
{
    
colored_print(id"!gP!ta!gr!ta!gn!tcs !ga!tk!gt!ti!gv!ta!gl!tv!ga (KIKAPCSOLVA)")
}

stock aktivalva(id)
{
    
colored_print(id"!gP!ta!gr!ta!gn!tcs !ga!tk!gt!ti!gv!ta!gl!tv!ga (BEKAPCSOLVA)")
}

stock colored_print ( const index, const input [ ], any:... )
{
    new 
sz_Message  191 ]
    
    
vformat sz_Messagecharsmax sz_Message ), input)
    
    
replace_all sz_Messagecharsmax sz_Message ), "!g""^4" )
    
replace_all sz_Messagecharsmax sz_Message ), "!t""^3" )
    
replace_all sz_Messagecharsmax sz_Message ), "!y""^1" )
    
    new 
i_Players 32 ]
    new 
i_Count
    
    i_Count 
1
    
    
if ( index )
    {
        
i_Players ] = index
    
}
    
    else
    {
        
get_players i_Playersi_Count"ch" )
    }
    
    new 
i_Number
    
    
for ( i_Number 0i_Number i_Counti_Number ++ )
    {
        if ( 
is_user_connected i_Players i_Number ] ) )
        {
            
message_begin MSG_ONE_UNRELIABLEMessageSay_i_Players i_Number ] )
            
write_byte i_Players i_Number ] )
            
write_string sz_Message )
            
message_end ( )
        }
    }

__________________
kiki33hun is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-01-2012 , 13:39   Re: Hudmessage .. in the head ?!
Reply With Quote #3

Great , exists another method without chr_engine ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 02-01-2012 , 13:40   Re: Hudmessage .. in the head ?!
Reply With Quote #4

Don't use get_pcvar_[num|float|string] in Prethink.

Use this instead :

Code:
new checkCvar public plugin_init( ) {     checkCvar = get_pcvar_num( ... ) } public prethink( ... ) {     if( checkCvar ) }
__________________
You can do anything you set your mind to, man.

Devil259 is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 02-01-2012 , 13:45   Re: Hudmessage .. in the head ?!
Reply With Quote #5

Quote:
Originally Posted by Devil259 View Post
Don't use get_pcvar_[num|float|string] in Prethink.

Use this instead :

Code:
new checkCvar public plugin_init( ) {     checkCvar = get_pcvar_num( ... ) } public prethink( ... ) {     if( checkCvar ) }

But it also works
__________________
kiki33hun is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 02-01-2012 , 13:55   Re: Hudmessage .. in the head ?!
Reply With Quote #6

Yes, but PreThink is called a lot of time per second, so, cache it in a variable is better.
__________________
You can do anything you set your mind to, man.

Devil259 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:09.


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