AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trying to make simple plugin to kick HLTV if server is full (https://forums.alliedmods.net/showthread.php?t=217381)

Mofforg 06-02-2013 07:26

Trying to make simple plugin to kick HLTV if server is full
 
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?




Backstabnoob 06-02-2013 08:01

Re: Trying to make simple plugin to kick HLTV if server is full
 
is_user_hltv( )

Mofforg 06-02-2013 08:27

Re: Trying to make simple plugin to kick HLTV if server is full
 
Quote:

Originally Posted by Backstabnoob (Post 1962953)
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?

Unkolix 06-02-2013 08:39

Re: Trying to make simple plugin to kick HLTV if server is full
 
Quote:

Originally Posted by Mofforg (Post 1962964)
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.

TheDS1337 06-02-2013 08:55

Re: Trying to make simple plugin to kick HLTV if server is full
 
Code:

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


Mofforg 06-02-2013 10:31

Re: Trying to make simple plugin to kick HLTV if server is full
 
Quote:

Originally Posted by Unkolix (Post 1962971)
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))    



Mofforg 06-04-2013 15:57

Re: Trying to make simple plugin to kick HLTV if server is full
 
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...

TheDS1337 06-04-2013 16:16

Re: Trying to make simple plugin to kick HLTV if server is full
 
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; }

Mofforg 06-04-2013 18:03

Re: Trying to make simple plugin to kick HLTV if server is full
 
Quote:

Originally Posted by DeagLe.Studio (Post 1964639)
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.

YamiKaitou 06-04-2013 19:01

Re: Trying to make simple plugin to kick HLTV if server is full
 
So what is your Scripting question?


All times are GMT -4. The time now is 16:25.

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