Raised This Month: $ Target: $400
 0% 

Spectator Block


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rootdown
Member
Join Date: Mar 2004
Location: .se
Old 06-14-2004 , 21:40   Spectator Block
Reply With Quote #1

Hi, this code is supposed to prevent other than admins to join spectatormode... but it isnt working as it should, care to help me out?

Code:
#include <amxmodx> public admin_check(id, level, cid) {    if (!(get_user_flags(id)&ADMIN_RESERVATION) && (get_cvar_num("amx_spectator") == 1)){       client_print(id,print_chat,"* You can not become spectator!")       new sTeam[10]       get_user_info(id,"team",sTeam,9)       if (equal(sTeam,"")) client_cmd(id,"chooseteam")       return PLUGIN_HANDLED    }    return PLUGIN_CONTINUE } public plugin_init() {         register_plugin("Spectator Block", "1.1", "[AsC]Phil")         register_clcmd("jointeam 6", "admin_check")         register_cvar("amx_spectator","1")         if (get_cvar_num("allow_spectators") == 0) set_cvar_num("allow_spectators",1)         return PLUGIN_CONTINUE }

when using the above code a non-admin player can still join spectatormode through menus ("m" then "6"). But if the player uses command "jointeam 6" through console he gets the message "* You can not become spectator!"


Code:
#include <amxmodx> public admin_check(id, level, cid) {    if (!(get_user_flags(id)&ADMIN_RESERVATION) && (get_cvar_num("amx_spectator") == 1)){       client_print(id,print_chat,"* You can not become spectator!")       new sTeam[10]       get_user_info(id,"team",sTeam,9)       if (equal(sTeam,"")) client_cmd(id,"chooseteam")       return PLUGIN_HANDLED    }    return PLUGIN_CONTINUE } public plugin_init() {         register_plugin("Spectator Block", "1.1", "[AsC]Phil")         register_clcmd("jointeam 6", "admin_check")         register_clcmd("menuselect 6", "admin_check")         register_cvar("amx_spectator","1")         if (get_cvar_num("allow_spectators") == 0) set_cvar_num("allow_spectators",1)         return PLUGIN_CONTINUE }

when using this code (just added register_clcmd("menuselect 6", "admin_check") ) you cannot as a player join spectatormode through menus or through "jointeam 6" in console, which is good.... But as you see the problem is when you use menuselect 6 in a other situation (for example buying AWM through menus) and not being able to perform the command.
You can still buy awm's through buyscripts, but as you can guess it wont be so funny to get "* You can not become spectator!" in every situation you use menuselect 6, and not getting the command executed.
__________________
rootdown is offline
Send a message via ICQ to rootdown Send a message via MSN to rootdown
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-14-2004 , 22:23  
Reply With Quote #2

you should use this code that I found in olo's old autoteam select plugin and that I use in my autoassign plugin

Code:
register_event("ShowMenu","admin_check","b","4&Team_Select") register_event("VGUIMenu","admin_check","b","1=2","1=26","1=27")

to detect the team select menu
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose 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 03:03.


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