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

Nice OFF Spec by sector


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Carrion
Member
Join Date: Mar 2020
Old 04-03-2020 , 01:46   Nice OFF Spec by sector
Reply With Quote #1

Hello...

here is Nice OFF Spec by sector

sma



i did lil changes and my server crashed

PHP Code:
public plugin_init() {
    
register_plugin("Spectator Kicker""1.0""sector")
    
register_logevent("nice_off_spec"2"1=Round_Start")
    
register_logevent("nice_off_spec"2"1&Restart_Round_""1=Game_Commencing")
    
register_event("TextMsg""nice_off_spec""a""2=#Game_will_restart_in");
    
nMaxplayers register_cvar("max_players""2")
}



public 
nice_off_spec() {
    
nNumplayers get_playersnum()
    if(
nNumplayers >= get_pcvar_num(nMaxplayers)) { 
kick all spectators when there is >= 2 users on server

Last edited by Carrion; 04-03-2020 at 01:46.
Carrion is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-03-2020 , 02:38   Re: Nice OFF Spec by sector
Reply With Quote #2

try this?
PHP Code:
public nice_off_spec() 
{
    
// Now Playing Players num.
    
new nNumPlayers get_playersnum();

    
// there is >= 2 users?
    
if (nNumPlayers get_pcvar_num(nMaxplayers))
        return 
PLUGIN_CONTINUE;

    new 
players[MAX_PLAYERS], pnumuid;
    
get_players(playerspnum"h");

    
// for loop playing players.
    
for (new 0nNumPlayersi++)
    {
        
uid players[i];
        switch (
cs_get_user_team(uid))
        {
            case 
CS_TEAM_UNASSIGNEDCS_TEAM_SPECTATOR
            {
                if (!(
get_user_flags(uid) & ADMIN_IMMUNITY)) 
                    
server_cmd("kick # %d ^"[AMXXSpectating Not Allowed when SERVER is FULL!^""get_user_userid(uid));
            }
            case 
CS_TEAM_CT
                continue;
            case 
CS_TEAM_T
                continue;
        }
    }
    
ColorChat(0NORMAL"^1[^4AMXX^1] ^3All Spectators Kicked!");
    return 
PLUGIN_CONTINUE;

__________________
GitHub
SteamWishlist

六四天安門事件

Last edited by +ARUKARI-; 04-03-2020 at 02:42.
+ARUKARI- is offline
Carrion
Member
Join Date: Mar 2020
Old 04-03-2020 , 22:32   Re: Nice OFF Spec by sector
Reply With Quote #3

Quote:
Originally Posted by +ARUKARI- View Post
try this?
at the end i got this
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <colorchat>

#define MAX_PLAYERS 32

new nMaxplayers

public plugin_init() {
    
register_plugin("Nice OFF Spec""1.0""sector")
    
register_logevent("nice_off_spec"2"1=Round_Start")
    
register_logevent("nice_off_spec"2"1&Restart_Round_""1=Game_Commencing")
    
register_event("TextMsg""nice_off_spec""a""2=#Game_will_restart_in");
    
nMaxplayers register_cvar("nos_max_players""25")
}

public 
nice_off_spec() {
    
    
// Now Playing Players num.
    
new nNumPlayers get_playersnum();
    
    
// there is >= 2 users?
    
if (nNumPlayers get_pcvar_num(nMaxplayers))
        return 
PLUGIN_CONTINUE;
    
    new 
players[MAX_PLAYERS], pnumuid;
    
get_players(playerspnum"h");
    
    
// for loop playing players.
    
for (new 0nNumPlayersi++)
    {
        
uid players[i];
        switch (
cs_get_user_team(uid))
        {
            case 
CS_TEAM_UNASSIGNEDCS_TEAM_SPECTATOR
            {
                if (
get_user_flags(uid) & ADMIN_IMMUNITY)  return PLUGIN_HANDLED;
                
server_cmd("kick #%d ^"[AMXXSpectating Not Allowed when SERVER is FULL!^""get_user_userid(uid));
                
ColorChat(0NORMAL"^1[^4AMXX^1] ^3All Spectators Kicked!");
            }
            case 
CS_TEAM_CT
                continue;
            case 
CS_TEAM_T
                continue;
        }
    }
    return 
PLUGIN_CONTINUE;


/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by Carrion; 04-03-2020 at 22:33.
Carrion is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-03-2020 , 23:23   Re: Nice OFF Spec by sector
Reply With Quote #4

Try this
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <colorchat>

#define MAX_PLAYERS 32

const KickTeams = ( ( << _:CS_TEAM_UNASSIGNED ) | ( << _:CS_TEAM_SPECTATOR ) );

new 
nMaxplayers

public plugin_init() 
{
    
register_plugin"Nice OFF Spec" "1.0" "sector" );
    
    
register_logevent"nice_off_spec" "1=Round_Start" );
    
register_logevent"nice_off_spec" "1&Restart_Round_""1=Game_Commencing" );
    
register_event"TextMsg" "nice_off_spec" "a" "2=#Game_will_restart_in" );
    
    
nMaxplayers register_cvar"nos_max_players" "25" );
}

public 
nice_off_spec() 
{
    new 
playersMAX_PLAYERS ] , pnum uid bool:bSpecsKicked;
    
    
get_playersplayers pnum "h" );
    
    if ( 
pnum >= get_pcvar_numnMaxplayers ) )
    {
        for ( new 
pnum i++ )
        {
            
uid players];
            
            if ( !( 
get_user_flagsuid ) & ADMIN_IMMUNITY ) && ( KickTeams & ( << _:cs_get_user_teamuid ) ) ) )  
            {
                
server_cmd"kick #%d ^"[AMXXSpectating Not Allowed when SERVER is FULL!^"" get_user_useriduid ) );
                
bSpecsKicked true;
            }
        }
        
        if ( 
bSpecsKicked )
            
ColorChatNORMAL "^1[^4AMXX^1] ^3All Spectators Kicked!" );
    }

__________________

Last edited by Bugsy; 04-03-2020 at 23:41.
Bugsy 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:44.


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