AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved Limit Spectactors (https://forums.alliedmods.net/showthread.php?t=302853)

BakSuZ 11-13-2017 11:26

Limit Spectactors
 
Hi, i need a Plugin where i can Limit the Spectators on my CS 1.6 Server and if its possible i want an Plugin where only my Admins are allowed to join Spectators.

Thanks in advance.

Napoleon_be 11-13-2017 12:32

Re: Limit Spectactors
 
Code:
/* *   _______     _      _  __          __ *  | _____/    | |    | | \ \   __   / / *  | |         | |    | |  | | /  \ | | *  | |         | |____| |  | |/ __ \| | *  | |   ___   | ______ |  |   /  \   | *  | |  |_  |  | |    | |  |  /    \  | *  | |    | |  | |    | |  | |      | | *  | |____| |  | |    | |  | |      | | *  |_______/   |_|    |_|  \_/      \_/ * * * *  Last Edited: 12-30-07 * *  ============ *   Changelog: *  ============ * *  v2.1 *    -Fixed Bug * *  v2.0 *    -Added ML *    -Optimized Code * *  v1.0 *    -Initial Release * */ #define VERSION "2.1" #include <amxmodx> #include <amxmisc> #include <cstrike> new pcvar public plugin_init() {     register_plugin("Only Admin Spectators",VERSION,"GHW_Chronic")     pcvar = register_cvar("spec_admin","a")     register_dictionary("GHW_Admin_Spec.txt") } public client_putinserver(id) {     set_task(2.0,"check_team",id,"",0,"b") } public check_team(id) {     static adminflags[32]     get_pcvar_string(pcvar,adminflags,31)     if(!is_user_connected(id))     {         remove_task(id)     }     else if(!(get_user_flags(id) & read_flags(adminflags)) && cs_get_user_team(id)==CS_TEAM_SPECTATOR)     {         client_print(id,print_center,"[AMXX] %L",id,"MSG_NOSPEC")         new num, players[32], Float:ct         get_players(players,num,"g")         for(new i=0;i<num;i++)         {             if(players[i]!=id && cs_get_user_team(players[i])==CS_TEAM_CT) ct += 1.0         }         if(float(num) / 2.0 >= ct) cs_set_user_team(id,CS_TEAM_CT)         else cs_set_user_team(id,CS_TEAM_T)     } }

You can also try this, both codes are untested though. The one above is approved so should be working imo.

Code:
#include <amxmodx> #define PLUGIN "Team join info" #define VERSION "1.0" #define AUTHOR "AMXX Community" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event( "TeamInfo", "join_team", "a") } public join_team() {         new id = read_data(1)     static user_team[32]         read_data(2, user_team, 31)             if(!is_user_connected(id) || !(get_user_flags(id) & ADMIN_KICK))         return PLUGIN_HANDLED           switch(user_team[0])     {         case 'C':           {             // player join to ct's                 }                 case 'T':         {             // player join to terrorist         }                         case 'S':           {             client_cmd(id, "chooseteam")             client_print(id, print_chat, "[AMXx] Only admins can join spectator.")             return PLUGIN_HANDLED         }                     }     return PLUGIN_HANDLED     }

wickedd 11-13-2017 19:42

Re: Limit Spectactors
 
Code:

allow_spectators 0
Add that to the server.cfg. The Spectators option will not be available to anyone.

Alber9091 11-13-2017 19:45

Re: Limit Spectactors
 
Quote:

Originally Posted by wickedd (Post 2560332)
Code:

allow_spectators 0
Add that to the server.cfg. The Spectators option will not be available to anyone.

He asks, only admins can :)

BakSuZ 11-13-2017 22:50

Re: Limit Spectactors
 
Thank You very much, that is what i needed.


All times are GMT -4. The time now is 17:27.

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