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

Question about Displaying a user


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-17-2010 , 00:49   Question about Displaying a user
Reply With Quote #1

PHP Code:
#include < amxmodx >

new g_iFirstPlayer;

new 
pCvarFlags;

public 
plugin_init( )
{
    
register_plugin"First Player Flags""0.0.1""Exolent" );
    
    
pCvarFlags register_cvar"first_player_flags""b" );
}

public 
client_putinserveriPlayer )
{
    if( !
g_iFirstPlayer )
    {
        
g_iFirstPlayer iPlayer;
        
set_user_flagsiPlayerread_pcvar_flagspCvarFlags ) );
        
        
client_printiPlayerprint_chat"please use .example to start" );
    }
}

public 
client_disconnectiPlayer )
{
    if( 
g_iFirstPlayer == iPlayer )
    {
        
g_iFirstPlayer 0;
    }
}

read_pcvar_flags( const pCvar )
{
    new 
szFlags27 ];
    
get_pcvar_stringpCvarszFlagscharsmaxszFlags ) );
    return 
read_flagsszFlags );
    
set_hudmessage(255000.00.1506.012.0)
show_hudmessage(id"Admin: ^n iPlayer")

I want to get the users name to display in the HUD message but im not quite sure how to pull the users name out of iPlayer.

Can anyone help me out on this?
__________________
Dan Hiorns - www.danhiorns.us
puttsmobiles is offline
Send a message via AIM to puttsmobiles Send a message via MSN to puttsmobiles Send a message via Yahoo to puttsmobiles Send a message via Skype™ to puttsmobiles
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 10-17-2010 , 00:53   Re: Question about Displaying a user
Reply With Quote #2

new Name[32]
get_user_name(g_iFirstPlayer, Name, sizeof(Name)-1)
show_hudmessage(0, "Admin: ^n %s", Name)
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-17-2010 , 00:56   Re: Question about Displaying a user
Reply With Quote #3

Does it matter where I would add this?

I am still trying to learn forgive me :s
__________________
Dan Hiorns - www.danhiorns.us
puttsmobiles is offline
Send a message via AIM to puttsmobiles Send a message via MSN to puttsmobiles Send a message via Yahoo to puttsmobiles Send a message via Skype™ to puttsmobiles
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 10-17-2010 , 01:01   Re: Question about Displaying a user
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc> 

new g_iFirstPlayer

new 
pCvarFlags

public 
plugin_init() 

    
register_plugin("First Player Flags""0.0.1""Exolent"); 
    
    
pCvarFlags register_cvar"first_player_flags""b"); 


public 
client_putinserver(iPlayer

    if(!
g_iFirstPlayer
    { 
        
g_iFirstPlayer iPlayer
        
set_user_flags(iPlayerread_pcvar_flags(pCvarFlags)); 
        
        new 
Name[32];
        
get_user_name(iPlayerNamesizeof(Name)-1);
        
        
set_hudmessage(255000.00.1506.012.0);
        
show_hudmessage(0"Admin: ^n %s"Name);        
    } 


public 
client_disconnect(iPlayer

    if(
g_iFirstPlayer == iPlayer
    { 
        
g_iFirstPlayer 0
    } 


read_pcvar_flags(const pCvar) {
    new 
szFlags[27]; 
    
get_pcvar_string(pCvarszFlagscharsmax(szFlags)); 
    return 
read_flags(szFlags); 

but it is stupid, because if you're the first player, nobody can see it
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-17-2010 , 01:03   Re: Question about Displaying a user
Reply With Quote #5

Well, once people start to join. More and more people will see it.
__________________
Dan Hiorns - www.danhiorns.us
puttsmobiles is offline
Send a message via AIM to puttsmobiles Send a message via MSN to puttsmobiles Send a message via Yahoo to puttsmobiles Send a message via Skype™ to puttsmobiles
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-17-2010 , 01:34   Re: Question about Displaying a user
Reply With Quote #6

It only shows the hud message to the first person that joins the server, and the first person that enters after he leaves. While the first person is in the server, nobody will see the hud messages when they join or anything. The hud message ONLY appears when it's either the first person to join the server in the very beginning or the person that joins first right after the old "first person" leaves.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-17-2010 , 01:39   Re: Question about Displaying a user
Reply With Quote #7

I sort of messed up and gave you guys the old code :s

PHP Code:
#include < amxmodx > 

#define TASK_PRINT_TEXT 135784 // random num 

new g_iFirstPlayer

new 
pCvarFlags

public 
plugin_init( ) 

    
register_plugin"First Player Flags""0.0.1""Exolent" ); 
     
    
pCvarFlags register_cvar"first_player_flags""b" ); 


public 
client_putinserveriPlayer 

    if( !
g_iFirstPlayer 
    { 
        
g_iFirstPlayer iPlayer
        
SetUserFlagsiPlayer ); 
       
        
remove_task(TASK_PRINT_TEXT); 
        
set_task(15.0"PrintText"TASK_PRINT_TEXT); 
    } 


public 
PrintText() 

    if( 
g_iFirstPlayer && is_user_connected(g_iFirstPlayer) ) 
    { 
        
client_printg_iFirstPlayerprint_chat"[Practice Mod] Please use .menu to configure the server" 
    } 


public 
client_infochangedid 

    if( 
id == g_iFirstPlayer 
    { 
        
SetUserFlagsid ); 
    } 


public 
client_disconnectiPlayer 

    if( 
g_iFirstPlayer == iPlayer 
    { 
        
g_iFirstPlayer 0
        
remove_task(TASK_PRINT_TEXT); 
    } 


SetUserFlagsid 

    new 
szFlags27 ]; 
    
get_pcvar_stringpCvarFlagsszFlagscharsmaxszFlags ) ); 
    
set_user_flagsidread_flagsszFlags ) ) 

Is there a way to get that message to show to all the people that will join the server and use the new code?
__________________
Dan Hiorns - www.danhiorns.us
puttsmobiles is offline
Send a message via AIM to puttsmobiles Send a message via MSN to puttsmobiles Send a message via Yahoo to puttsmobiles Send a message via Skype™ to puttsmobiles
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-17-2010 , 01:46   Re: Question about Displaying a user
Reply With Quote #8

What EXACTLY do you want the hudmessage to say? Just the name of the first person that joined the server before them?

if so, or for anything of that sort, don't include the showing hudmessage in the if statement where it checks if the id == g_iFirstPlayer or w/e in putinserver. Then it will show to everyone who's the admin. But you would have to store the name as a global array if you want to show it to everyone.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-17-2010 , 01:53   Re: Question about Displaying a user
Reply With Quote #9

Well, I want the thing to show who the first player in the server is to everyone.

and display that message so that user knows they have access to the commands menu. (cmds.ini modified)
__________________
Dan Hiorns - www.danhiorns.us
puttsmobiles is offline
Send a message via AIM to puttsmobiles Send a message via MSN to puttsmobiles Send a message via Yahoo to puttsmobiles Send a message via Skype™ to puttsmobiles
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 12:48.


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