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

Advanced Block RTV


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Server Management       
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 10-30-2011 , 16:12   Advanced Block RTV
Reply With Quote #1

[IMG]http://img163.**************/img163/4531/63888648.png[/IMG]

[Description]
This plugin turn off the option rtv when a admin is online and isn't on the spectator team.

Original Post:
http://forums.alliedmods.net/showthread.php?t=145621

Why create another post?
I create this new post because the plugin have a bug and the original author is banned. The bug was this: if you leave a space before /rtv the plugin didn't work.

[Attention]
If you have GALILEO installed in your server and the version is above 1.2, you don't need this plugin...
If you have GALILEO installed in your server and the version is lower 1.2, you need to change the cvar:
Code:
// Indicates which say commands can be used to rock the vote.
gal_rtv_commands 3

(TO)

gal_rtv_commands 2
[Messages]
Warn for the players when a admin is on and say rtv.
Code:
[en]
[AMXX] There are admins on server, therefore you can't say rtv.
[bp]
[AMXX] Tem admins no server, por isso voce nao pode dizer rtv.
[es]
[AMXX] Tiene los administradores del servidor, por lo que no se puede decir rtv.
[de]
[AMXX] Es sind Admins auf dem Server, deswegen kann rtv momentan nicht genutzt werden.
[sr]
[AMXX] Imaju Admini na Serveru, zato trenutno rtv nemoze da se koristi.
[fr]
[AMXX] La commande rtv est inactive lorsqu'il y'a des admins sur le serveur.
[bg]
[AMXX] Ima administratori v servera i zatova ne moje da polzvate rtv.
[hu]
[AMXX] A szerveren van admin, ezert nem tudsz rtvzni!
[tr]
[AMXX] Serverda Admin Oldugu Icin RTV Komutu Gecersiz.
[pl] 
[AMXX] Na serwerze sa admini, wiec nie mozesz uzyc komendy rtv.
[ro]
[AMXX] Sunt admini pe acest server, nu poti folosi RTV.
[Cvars]
PHP Code:
// 1 active, 0 disables
amx_block_rtv <or 0
[RTV Messages Block]
You can add in the file advanced_block_rtv.ini more things, default:
Code:
; Advanced Block RTV
; Maximun Caracteres: 300

rtv
/rtv
.rtv
rockthevote
/rockthevote
.rockthevote
rock the vote
/rock the vote
.rock the vote
[Instaling]
- Put the file advanced_block_rtv.ini in: amxmodx/configs/
- Put the file advanced_block_rtv.txt in: amxmodx/data/lang/
- Put the file advanced_block_rtv.amxx in: amxmodx/plugins/
- Open the file amxmodx/configs/plugins.ini and write advanced_block_rtv.amxx

[Modules]
- Cstrike.

[Credits]
MMYTH - Original Plugin;
GalegO - Related bug plugin;
Dark Style(me) - Fixed bug at the plugin.

[Translations]

[Changelog]
Code:
0.0.1b 	- 	Fixed some bugs and test it.
0.0.2 	- 	Optmized functions.
0.0.3 	- 	Optmized functions,
Added a new and better form to get admin on.
Attached Files
File Type: ini advanced_block_rtv.ini (154 Bytes, 341 views)
File Type: sma Get Plugin or Get Source (advanced_block_rtv.sma - 979 views - 2.2 KB)
File Type: txt advanced_block_rtv.txt (918 Bytes, 272 views)

Last edited by Dark Style; 11-11-2011 at 06:40. Reason: Version 0.0.3
Dark Style is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-30-2011 , 16:22   Re: Advanced Block RTV
Reply With Quote #2

Instead of reading the file every time a player talks, read it when the plugin starts, and store the strings into a Trie. Also, it would be better if you stored whether or not an admin was in the server as a bool. So when the player connects, determine whether he is an admin or not and set the bool to true if he is. Then when all admins leave, set the bool to false.

Then you could do

PHP Code:
if( TrieKeyExistsg_tCommandsszMessage ) && g_bAdminInServer )
{ ... } 
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please

Last edited by nikhilgupta345; 10-30-2011 at 16:23.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 10-30-2011 , 16:50   Re: Advanced Block RTV
Reply With Quote #3

Update 0.0.2
Dark Style is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-30-2011 , 17:09   Re: Advanced Block RTV
Reply With Quote #4

Quote:
Originally Posted by Dark Style View Post
Update 0.0.2
Instead of doing it like you did, do the following:

PHP Code:
/*
[Description]
This plugin turn off the option rtv when a admin is online.

Original Post:
http://forums.alliedmods.net/showthread.php?t=145621

[Cvars]
// 1 active, 0 disables 
amx_block_rtv <1 or 0>

[Changelog]
0.0.1b - Fixed some bugs and test it.
0.0.2 - Optmized functions.
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#pragma semicolon 1

#define PLUGIN         "Advanced Block RTV"
#define VERSION     "0.0.2"
#define AUTHOR         "MMYTH&Dark Style"

new g_oniadminon;

new 
Trie:rtv;

new 
configdir[50], buffer[301], form[40];

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_dictionary("advanced_block_rtv.txt");
    
    
g_on register_cvar("amx_block_rtv""1");
    
    
register_clcmd("say""HandleSay");
    
register_clcmd("say_team""HandleSay");
    
    
get_configsdir(configdircharsmax(configdir));
    
add(configdircharsmax(configdir), "/advanced_block_rtv.ini"0);
    
    
rtv TrieCreate();
    
    new 
fp fopen(configdir"rt");
    
    if(
fp)
    {
        while(!
feof(fp))
        {
            
fgets(fpbuffercharsmax(buffer));
            
            
trim(buffer);
            
            if(!
buffer[0] || buffer[0] == ';' || buffer[0] == '/' && buffer[1] == '/'
                continue;

            
TrieSetCellrtvbuffer);
        }
    }
    else
    {
        
set_fail_state("File ^"advanced_block_rtv.ini^" Required");
    }
    
    
fclose(fp);
}

public 
plugin_end()
{
    
TrieDestroy(rtv);
}

public 
client_putinserver(id)
{
    if(
is_user_admin(id))
        
adminon ++;
}

public 
client_disconnect(id)
{
    if(
is_user_admin(id))
        
adminon --;
}

public 
HandleSay(id)
{
    if(
get_pcvar_num(g_on) && adminon != && is_user_connected(id)) 
    {
        new 
args[128];
        
read_args(args127);
        
remove_quotes(args);
        
        if( 
TrieKeyExistsrtvargs ) )
        {
            
client_print(idprint_chat"%L"id"BLOCK_RTV_MSG1");
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 10-30-2011 , 19:07   Re: Advanced Block RTV
Reply With Quote #5

Quote:
Originally Posted by nikhilgupta345 View Post
Instead of doing it like you did, do the following:

PHP Code:
/*
[Description]
This plugin turn off the option rtv when a admin is online.

Original Post:
http://forums.alliedmods.net/showthread.php?t=145621

[Cvars]
// 1 active, 0 disables 
amx_block_rtv <1 or 0>

[Changelog]
0.0.1b - Fixed some bugs and test it.
0.0.2 - Optmized functions.
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#pragma semicolon 1

#define PLUGIN         "Advanced Block RTV"
#define VERSION     "0.0.2"
#define AUTHOR         "MMYTH&Dark Style"

new g_oniadminon;

new 
Trie:rtv;

new 
configdir[50], buffer[301], form[40];

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_dictionary("advanced_block_rtv.txt");
    
    
g_on register_cvar("amx_block_rtv""1");
    
    
register_clcmd("say""HandleSay");
    
register_clcmd("say_team""HandleSay");
    
    
get_configsdir(configdircharsmax(configdir));
    
add(configdircharsmax(configdir), "/advanced_block_rtv.ini"0);
    
    
rtv TrieCreate();
    
    new 
fp fopen(configdir"rt");
    
    if(
fp)
    {
        while(!
feof(fp))
        {
            
fgets(fpbuffercharsmax(buffer));
            
            
trim(buffer);
            
            if(!
buffer[0] || buffer[0] == ';' || buffer[0] == '/' && buffer[1] == '/'
                continue;

            
TrieSetCellrtvbuffer);
        }
    }
    else
    {
        
set_fail_state("File ^"advanced_block_rtv.ini^" Required");
    }
    
    
fclose(fp);
}

public 
plugin_end()
{
    
TrieDestroy(rtv);
}

public 
client_putinserver(id)
{
    if(
is_user_admin(id))
        
adminon ++;
}

public 
client_disconnect(id)
{
    if(
is_user_admin(id))
        
adminon --;
}

public 
HandleSay(id)
{
    if(
get_pcvar_num(g_on) && adminon != && is_user_connected(id)) 
    {
        new 
args[128];
        
read_args(args127);
        
remove_quotes(args);
        
        if( 
TrieKeyExistsrtvargs ) )
        {
            
client_print(idprint_chat"%L"id"BLOCK_RTV_MSG1");
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;

Your version isn't compatible with containi, but thanks.
Dark Style is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-30-2011 , 19:10   Re: Advanced Block RTV
Reply With Quote #6

You just need to lower all the characters of the string before checking the trie.
__________________

Last edited by Arkshine; 10-30-2011 at 19:15.
Arkshine is offline
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 10-30-2011 , 19:12   Re: Advanced Block RTV
Reply With Quote #7

Give me an exemple.
Dark Style is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-30-2011 , 19:14   Re: Advanced Block RTV
Reply With Quote #8

http://www.amxmodx.org/funcwiki.php?go=func&id=60 ...
__________________
Arkshine is offline
Dark Style
BANNED
Join Date: Feb 2011
Location: Brazil
Old 11-01-2011 , 19:14   Re: Advanced Block RTV
Reply With Quote #9

Update 0.0.3

Quote:
- I didin't need use strtolower(), i just use trim() and it's ok now.

Last edited by Dark Style; 11-02-2011 at 10:40.
Dark Style is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 11-02-2011 , 09:56   Re: Advanced Block RTV
Reply With Quote #10

WTF? Don't use Google Translator... it is a very bad translation...

Change:
Code:
[es]
[AMXX] Tiene los administradores del servidor, por lo que no se puede decir rtv.

Code:
[es]
[AMXX] Hay administradores en el servidor, no se puede escribir rtv.
Korxu 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 10:25.


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