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

Trying to make simple plugin to kick HLTV if server is full


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 06-02-2013 , 07:26   Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #1

Hello.


I have an AFK kicker on my server, but it never affects HLTV. I have 2 HLTV's in my server (2 upstreams for better perfomance) and i want them to go off if player needs a slot. So i think it would be better to make separate plugin for this.

So basically i need a plugin which will make a check on "public client_putinserver": if players == 32 then kick one HLTV if there is any in the server. If no HLTV on server then just do nothing. 3 sec delay is needed for my ban system to kick players if he(she) is banned. [so players would get disconnected and there will not needed to kick hltv]

The main problem, that i need it to be done silently. HLTV is auto reconnected, so if this message would be shows then there would be too much flood. I need it to be done without any messages (but other admin's kicks and bans should continue to be showed). How can i kick silently? Also i have no idea how to simply detect all hltvs currently in server.

Could someone help with this?

I've started...:
PHP Code:
public client_putinserver(id)
{
    
set_task(3.0"check"id)
}

public 
check(id)
{
    if(!
is_user_connected(id)) return
    if (
get_playersnum(1) != 32 ) return
    
Here we need to detect all HLTV's in server and kick one of them silently (no messages in chat) - how can i do this?



Last edited by Mofforg; 06-02-2013 at 07:27.
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-02-2013 , 08:01   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #2

is_user_hltv( )
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 06-02-2013 , 08:27   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #3

Quote:
Originally Posted by Backstabnoob View Post
is_user_hltv( )
The check applying is not for this player. On the 'check' function i need to check all current users on being hltv (is_user_hltv), how can i do it on 'all players' not for this player, which connected?
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
Unkolix
Veteran Member
Join Date: Sep 2012
Old 06-02-2013 , 08:39   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #4

Quote:
Originally Posted by Mofforg View Post
The check applying is not for this player. On the 'check' function i need to check all current users on being hltv (is_user_hltv), how can i do it on 'all players' not for this player, which connected?
Use get players and then is_user_hltv and kick him.
Unkolix is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-02-2013 , 08:55   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #5

Code:
if( is_user_hltv( Client ) )
{
        static Name[ 32 ];
        get_user_name( Client, Name, charsmax( Name ) );
        server_cmd( "amx_kick ^"%s^"", Name );
        return 1;
}

Last edited by TheDS1337; 06-02-2013 at 08:56.
TheDS1337 is offline
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 06-02-2013 , 10:31   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #6

Quote:
Originally Posted by Unkolix View Post
Use get players and then is_user_hltv and kick him.
Thanks, but i am confused how to use it....

PHP Code:
public client_putinserver(id)
{
    
set_task(3.0"check"id)
}

public 
check(id)
{
    if(!
is_user_connected(id)) return
    if (
get_playersnum(1) != 32 ) return
    
// Here we need to detect all HLTV's in server and kick one of them - how can i do this?
    
get_playersplayersnum"cd")
    if( 
is_user_hltvClient ) ) server_cmd("amx_kick #%d"get_user_userid(Selected))    


Last edited by Mofforg; 06-02-2013 at 10:31.
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 06-04-2013 , 15:57   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #7

Someone help pls) I need to use get_players and then kick one of HLTV's. However i don't understand how to use it...
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-04-2013 , 16:16   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #8

I already gave you a solution:
Code:
#include < amxmodx > public client_putinserver( Client ) {     if( is_user_hltv( Client ) )     {         static Name[ 32 ];         get_user_name( Client, Name, charsmax( Name ) );         server_cmd( "amx_kick ^"%s^"", Name );         return 1;     }     return 0; }
TheDS1337 is offline
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 06-04-2013 , 18:03   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #9

Quote:
Originally Posted by DeagLe.Studio View Post
I already gave you a solution:
Code:
#include < amxmodx > public client_putinserver( Client ) {     if( is_user_hltv( Client ) )     {         static Name[ 32 ];         get_user_name( Client, Name, charsmax( Name ) );         server_cmd( "amx_kick ^"%s^"", Name );         return 1;     }     return 0; }
It will just kick all HLTV's which join to the server.

I need to kick HLTV if where are more 32 players in the server at the moment when new player joins. Not when HLTV joins.
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-04-2013 , 19:01   Re: Trying to make simple plugin to kick HLTV if server is full
Reply With Quote #10

So what is your Scripting question?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 09:38.


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