Raised This Month: $ Target: $400
 0% 

First Player In Server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-08-2010 , 20:05   First Player In Server
Reply With Quote #1

Ok, So I have been searching for about 2 hours now for a plugin that I can not find.

I'm not sure how hard this is to code or even if it is possible.

I want to have a plugin that when the first user connects to the server he is marked with a flag "b" or something. (CVAR control on the flags would be nice, if not thats fine) And it remains until the player is gone, then the flag is deleted. Also, can it display a message to the user (you are the first user connected, please use .example to start)?

Thank you so much in advance.
__________________
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
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-08-2010 , 20:13   Re: First Player In Server
Reply With Quote #2

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_putinserver( iPlayer ) {     if( !g_iFirstPlayer )     {         g_iFirstPlayer = iPlayer;         set_user_flags( iPlayer, read_pcvar_flags( pCvarFlags ) );                 client_print( iPlayer, print_chat, "please use .example to start" );     } } public client_disconnect( iPlayer ) {     if( g_iFirstPlayer == iPlayer )     {         g_iFirstPlayer = 0;     } } read_pcvar_flags( const pCvar ) {     new szFlags[ 27 ];     get_pcvar_string( pCvar, szFlags, charsmax( szFlags ) );     return read_flags( szFlags ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-08-2010 , 21:55   Re: First Player In Server
Reply With Quote #3

I felt bad making you do more work. So I just deleted my post.

This will work perfectly Thank you for your help
__________________
Dan Hiorns - www.danhiorns.us

Last edited by puttsmobiles; 10-08-2010 at 22:03.
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
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-09-2010 , 13:10   Re: First Player In Server
Reply With Quote #4

It sets the admin but doesnt display the message.
__________________
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
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-09-2010 , 13:51   Re: First Player In Server
Reply With Quote #5

client_putinserver() may be too soon for the player to actually notice it.
Try delaying the message with a task.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-09-2010 , 14:16   Re: First Player In Server
Reply With Quote #6

Also you would need to set access each time client_infochanged is triggered, because admin.amxx will reset flags, don't bother to make checks on names, just set flags again.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-09-2010 , 14:16   Re: First Player In Server
Reply With Quote #7

I think this might work. Not 100% sure.

Not too sound like every other user on the forum but. I'm not quite sure how to do it. :s
__________________
Dan Hiorns - www.danhiorns.us

Last edited by puttsmobiles; 10-09-2010 at 14:49.
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
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-09-2010 , 14:17   Re: First Player In Server
Reply With Quote #8

This is not the way tasks work, try to find an example somewhere.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
puttsmobiles
Senior Member
Join Date: Mar 2009
Location: Chicago
Old 10-09-2010 , 14:20   Re: First Player In Server
Reply With Quote #9

Code:
			set_task( 15.0, "CheckTerrorists", _, _, _, "b" );
			
			// Lets make restart after 20 seconds from map start.
			set_task( 20.0, "RestartRound" );
Pulled from Deatrun Manager.

I know it's not the same thing but you guys said to look for a task right?
__________________
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
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-09-2010 , 14:28   Re: First Player In Server
Reply With Quote #10

Try this :

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 ) )

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 06:19.


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