Raised This Month: $ Target: $400
 0% 

Handle joins to server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wpf
New Member
Join Date: Apr 2007
Old 04-10-2007 , 16:34   Handle joins to server
Reply With Quote #1

Hello!
I'm trying to write a script that will handle player joins to my server. I'm totally new to this so I need a little help and maybe a tip (or lots of).

I have a database with X player names. Each name is associated with a clan id. I'm using AMX Mod X. The idea:

When the first player connects, I want to check if his name does exist in the database. If it does, he will automatically be put in CT or T. If not, he will be banned. The next four from his clan will also be put in the same team.

The next player, whose clan id is not equal to the first player's, will be put in the other team, and of course also the four following clan members. If there's empty slots within, say, 5 minutes, everybody will be kicked out.

Now over to the hard part, get it working. I've read the Wiki and docs on amxmodx.org but I cannot figure out when I will check against the database. I need to hook on some event, but cannot find any "join event".

And how do I kick everybody 5 minutes after the first player has joined if there's less than 10 players connected? Can I use the set_task() function for that?
wpf is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 04-10-2007 , 17:09   Re: Handle joins to server
Reply With Quote #2

Taken from amxmodx.inc:

Code:
/* Called on client connection. */
forward client_connect(id);

/* Called when client gets valid STEAM id (usually
* between client_connect() and client_putinserver()). */
forward client_authorized(id);

/* Called when client is disconnecting from server. */
forward client_disconnect(id);

/* Called when client is entering to a game. */
forward client_putinserver(id);
I would suggest client_putinserver() since I don't know when the player's name is actually accessible. I think you should use steamids instead of names, though.

You can use set_task to execute a function after some period of time, yes.

Something like:

Code:
set_task(300.0, "function")
stupok is offline
wpf
New Member
Join Date: Apr 2007
Old 04-12-2007 , 00:54   Re: Handle joins to server
Reply With Quote #3

thank you!
wpf 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:33.


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