Raised This Month: $ Target: $400
 0% 

Hooking the first connection of a player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 12-29-2010 , 14:31   Hooking the first connection of a player
Reply With Quote #1

How can I get, if the user got the first time on the server? So basically, I would like to print them a special client_print to their first connect.
bibu is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2010 , 14:44   Re: Hooking the first connection of a player
Reply With Quote #2

First connect in what scope?
__________________
fysiks is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-29-2010 , 15:05   Re: Hooking the first connection of a player
Reply With Quote #3

For example I found a new server, connected to it first time. But the second time or more I should not get the client_print.
bibu is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-29-2010 , 15:10   Re: Hooking the first connection of a player
Reply With Quote #4

You would need to create a list of all the people that have connected to the server. Each time someone connects, you check the list. If they are not in the list then print the message and add them to the list. If they are already in the list, don't print the message.

However, this list can get extremely long and can cause adverse side effects. I would not recommend doing this at all.

It may be possible to pull from stats (for this 'list'; not entirely sure though), if they have stats then don't print the message. I'm not sure how often stats reset though. On my clans server they reset after 3500 unique connections.
__________________
fysiks is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-29-2010 , 15:21   Re: Hooking the first connection of a player
Reply With Quote #5

I really don't know how to work with a list or something, so I thought some users here have maybe experience with that also with that server side effects which you now told.
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-29-2010 , 15:27   Re: Hooking the first connection of a player
Reply With Quote #6

I would use nvault because i don't know how to use other systems ;)

Once you have printed to player, set nvault with his steamid to 1.
nvault_get returns 0 if key doesn't exist, this way you can know if users come for first fime.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-30-2010 , 13:50   Re: Hooking the first connection of a player
Reply With Quote #7

Thanks connor, would something like this be right?

PHP Code:
public client_putinserver(id)
{
    if(
is_user_bot(id))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
szKey[40];
    
formatexszKey charsmaxszKey ) , "%sCONNECT" g_szAuthID[id] );
    
    new 
iConnect nvault_getg_Vault szKey );
    
    if ( 
iConnect )
    {
        
client_printid print_chat "[First Connect] This is your more times to connecting to our server. =)" );
    }
    else
    {
        
nvault_setg_Vault szKey "1" );
        
client_printid print_chat "[First Connect] This is your first time to connecting to our server. =)" );
    }

It returns me everytime true. I also tried removing the vault file, but no success.
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-30-2010 , 14:05   Re: Hooking the first connection of a player
Reply With Quote #8

You don't need to format the nvault key, steamid is enough if the vault is unique.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-31-2010 , 06:08   Re: Hooking the first connection of a player
Reply With Quote #9

Ok, did that, still it doesn't work how it should.
bibu is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 12-31-2010 , 09:55   Re: Hooking the first connection of a player
Reply With Quote #10

Actually it does but how do you think it will print the messages when the player is still connecting.
SpeeDeeR 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 01:59.


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