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

Voteban only to Vips with flag "b"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gelado
Junior Member
Join Date: May 2010
Old 10-02-2012 , 17:13   Voteban only to Vips with flag "b"
Reply With Quote #1

I have vips plugin in my server that uses "b" flag!
My request is.. can someone modify this plugin "voteban" to only vips or players with b flag can start the vote.. i mean.. only players with flag "b" access can use the /voteban command?

I really need this, please answer me
email: [email protected]
gelado is offline
Torge
Veteran Member
Join Date: Oct 2011
Old 10-02-2012 , 17:58   Re: Voteban only to Vips with flag "b"
Reply With Quote #2

Try this:

PHP Code:
public Menu_VoteBan(idkey)
{
        if (!(
get_user_flags(id) & ADMIN_BAN))
              return;

Torge is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 10-02-2012 , 18:27   Re: Voteban only to Vips with flag "b"
Reply With Quote #3

Quote:
Originally Posted by Torge View Post
Try this:

PHP Code:
public Menu_VoteBan(idkey)
{
        if (!(
get_user_flags(id) & ADMIN_BAN))
              return;


Wrong!

He ask for flag b = ADMIN_RESERVATION
Anyway use this:
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Vote Ban"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define MAX_PLAYERS 33

#define MENU_KEYS (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9)
#define MENU_SLOTS 8

new g_iMenuPage[MAX_PLAYERS];
new 
g_iVotedPlayers[MAX_PLAYERS];
new 
g_iVotes[MAX_PLAYERS];
new 
g_szVoteReason[MAX_PLAYERS][64];

new 
g_iPlayers[MAX_PLAYERS 1];
new 
g_iNum;

new 
g_iMsgidSayText;

enum {
    
CVAR_PERCENT 0,
    
CVAR_BANTYPE,
    
CVAR_BANTIME
};
new 
g_szCvarName[][] = {
    
"voteban_percent",
    
"voteban_type",
    
"voteban_time"
};
new 
g_szCvarValue[][] = {
    
"80",
    
"1",
    
"100"
};
new 
g_iPcvar[3];
new 
g_szLogFile[64];

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_saycmd("voteban""Cmd_VoteBan", -1"");
    
register_clcmd("_voteban_reason""Cmd_VoteBanReason", -1"");
    
    
register_menucmd(register_menuid("\rVOTEBAN \yMenu:"), MENU_KEYS"Menu_VoteBan");
    
    for(new 
i++)
    {
        
g_iPcvar[i] = register_cvar(g_szCvarName[i], g_szCvarValue[i]);
    }
    
g_iMsgidSayText get_user_msgid("SayText");
    
    new 
szLogInfo[] = "amx_logdir";
    
get_localinfo(szLogInfog_szLogFilecharsmax(g_szLogFile));
    
add(g_szLogFilecharsmax(g_szLogFile), "/voteban");
    
    if(!
dir_exists(g_szLogFile))
        
mkdir(g_szLogFile);
        
    new 
szTime[32];
    
get_time("%d-%m-%Y"szTimecharsmax(szTime));
    
format(g_szLogFilecharsmax(g_szLogFile), "%s/%s.log"g_szLogFileszTime);
}

public 
client_disconnect(id)
{
    if(
g_iVotedPlayers[id])
    {
        
get_players(g_iPlayersg_iNum"h");
        
        for(new 
g_iNum i++)
        {
            if(
g_iVotedPlayers[id] & (<< g_iPlayers[i]))
            {
                
g_iVotes[g_iPlayers[i]]--;
            }
        }
        
g_iVotedPlayers[id] = 0;
    }
}

public 
Cmd_VoteBan(id)
{
    
get_players(g_iPlayersg_iNum"h");
    
    if(
g_iNum 3)
    {
        
client_printc(id"\g> \dThis command is unavailable! Need at least 3 players.");
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
get_user_flags(id) & ADMIN_RESERVATION)
    {
        
ShowBanMenu(idg_iMenuPage[id] = 0);
    }
    return 
PLUGIN_CONTINUE;
}

public 
ShowBanMenu(idiPos)
{
    static 
iiPlayerszName[32];
    static 
szMenu[256], iCurrPosiCurrPos 0;
    static 
iStartiEndiStart iPos MENU_SLOTS;
    static 
iKeys;
    
    
get_players(g_iPlayersg_iNum"h");
    
    if(
iStart >= g_iNum)
    {
        
iStart iPos g_iMenuPage[id] = 0;
    }
    
    static 
iLen;
    
iLen formatex(szMenucharsmax(szMenu), "\rVOTEBAN \yMenu:^n^n");
    
    
iEnd iStart MENU_SLOTS;
    
iKeys MENU_KEY_0;
    
    if(
iEnd g_iNum)
    {
        
iEnd g_iNum;
    }
    
    for(
iStart iEnd i++)
    {
        
iPlayer g_iPlayers[i];
        
get_user_name(iPlayerszNamecharsmax(szName));
        
        
iKeys |= (<< iCurrPos++);
        
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen"\r%d\w.%s \d(\r%d%%\d)^n"iCurrPosszNameget_percent(g_iVotes[iPlayer], g_iNum));
    }
    
    if(
iEnd != g_iNum)
    {
        
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\r9\w.Next ^n\r0\w.%s"iPos "Back" "Exit");
        
iKeys |= MENU_KEY_9;
    }
    else
    {
        
formatex(szMenu[iLen], charsmax(szMenu) - iLen"^n\r0\w.%s"iPos "Back" "Exit");
    }
    
show_menu(idiKeysszMenu, -1"");
    return 
PLUGIN_HANDLED;
}

public 
Menu_VoteBan(idkey)
{
    switch(
key)
    {
        case 
8:
        {
            
ShowBanMenu(id, ++g_iMenuPage[id]);
        }
        case 
9:
        {
            if(!
g_iMenuPage[id])
                return 
PLUGIN_HANDLED;
            
            
ShowBanMenu(id, --g_iMenuPage[id]);
        }
        default: {
            static 
iPlayer;
            
iPlayer g_iPlayers[g_iMenuPage[id] * MENU_SLOTS key];
            
            if(!
is_user_connected(iPlayer))
            {
                
ShowBanMenu(idg_iMenuPage[id]);
                return 
PLUGIN_HANDLED;
            }
            if(
iPlayer == id)
            {
                
client_print(idprint_center"*You cannot voteban yourself!*");
                
ShowBanMenu(idg_iMenuPage[id]);
                
                return 
PLUGIN_HANDLED;
            }
            if(
g_iVotedPlayers[id] & (<< iPlayer))
            {
                
client_print(idprint_center"*You already votebanned this player!*");
                
ShowBanMenu(idg_iMenuPage[id]);
                
                return 
PLUGIN_HANDLED;
            }
            
g_iVotes[iPlayer]++;
            
g_iVotedPlayers[id] |= (<< iPlayer);
            
            static 
szName[2][32];
            
get_user_name(idszName[0], charsmax(szName[]));
            
get_user_name(iPlayerszName[1], charsmax(szName[]));
            
            
client_printc(0"\g> \dPlayer \t%s \dvotebanned \t%s\d!"szName[0], szName[1]);
            
            
CheckVotes(iPlayerid);
            
client_cmd(id"messagemode _voteban_reason");
            
            
ShowBanMenu(idg_iMenuPage[id]);
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
Cmd_VoteBanReason(id)
{
    if(!
g_iVotedPlayers[id])
        return 
PLUGIN_HANDLED;
    
    new 
szArgs[64];
    
read_argv(1szArgscharsmax(szArgs));
    
    if(
szArgs[0])
    {
        
formatex(g_szVoteReason[id], charsmax(g_szVoteReason[]), szArgs);
    }
    return 
PLUGIN_HANDLED;
}

public 
CheckVotes(idvoter)
{
    
get_players(g_iPlayersg_iNum"h");
    new 
iPercent get_percent(g_iVotes[id], g_iNum);
    
    if(
iPercent >= get_pcvar_num(g_iPcvar[CVAR_PERCENT]))
    {
        switch(
get_pcvar_num(g_iPcvar[CVAR_BANTYPE]))
        {
            case 
1:
            {
                new 
szAuthid[32];
                
get_user_authid(idszAuthidcharsmax(szAuthid));
                
server_cmd("kick #%d;wait;wait;wait;banid %d ^"%s^";wait;wait;wait;writeid"get_user_userid(id), get_pcvar_num(g_iPcvar[CVAR_BANTIME]), szAuthid);
            }
            case 
2:
            {
                new 
szIp[32];
                
get_user_ip(idszIpcharsmax(szIp), 1);
                
server_cmd("kick #%d;wait;wait;wait;addip %d ^"%s^";wait;wait;wait;writeip"get_user_userid(id), get_pcvar_num(g_iPcvar[CVAR_BANTIME]), szIp);
            }
        }
        
g_iVotes[id] = 0;
        
        new 
szName[2][32];
        
get_user_name(idszName[0], charsmax(szName[]));
        
get_user_name(idszName[1], charsmax(szName[]));
        
client_printc(0"\g> \dPlayer \t%s \dhas been banned for \g%d\dmin. due voteban!"szName[0], get_pcvar_num(g_iPcvar[CVAR_BANTIME]));
        
        
log_to_file(g_szLogFile"Player '%s' voted for banning '%s' for: %s"szName[1], szName[0], g_szVoteReason[voter]);
    }
}

stock get_percent(valuetvalue)
{     
    return 
floatround(floatmul(float(value) / float(tvalue) , 100.0));
}

stock register_saycmd(saycommand[], function[], flags = -1info[])
{
    static 
szTemp[64];
    
formatex(szTempcharsmax(szTemp), "say %s"saycommand);
    
register_clcmd(szTemp, function, flagsinfo);
    
formatex(szTempcharsmax(szTemp), "say_team %s"saycommand);
    
register_clcmd(szTemp, function, flagsinfo);
    
formatex(szTempcharsmax(szTemp), "say /%s"saycommand);
    
register_clcmd(szTemp, function, flagsinfo);
    
formatex(szTempcharsmax(szTemp), "say .%s"saycommand);
    
register_clcmd(szTemp, function, flagsinfo);
    
formatex(szTempcharsmax(szTemp), "say_team /%s"saycommand);
    
register_clcmd(szTemp, function, flagsinfo);
    
formatex(szTempcharsmax(szTemp), "say_team .%s"saycommand);
    
register_clcmd(szTemp, function, flagsinfo);
}

stock client_printc(id, const text[], any:...)
{
    
    new 
szMsg[191], iPlayers[32], iCount 1;
    
vformat(szMsgcharsmax(szMsg), text3);
    
    
replace_all(szMsgcharsmax(szMsg), "\g","^x04");
    
replace_all(szMsgcharsmax(szMsg), "\d","^x01");
    
replace_all(szMsgcharsmax(szMsg), "\t","^x03");
    
    if(
id)
        
iPlayers[0] = id;
    else
        
get_players(iPlayersiCount"ch");
    
    for(new 
iCount i++)
    {
        if(!
is_user_connected(iPlayers[i]))
            continue;
        
        
message_begin(MSG_ONE_UNRELIABLEg_iMsgidSayText_iPlayers[i]);
        
write_byte(iPlayers[i]);
        
write_string(szMsg);
        
message_end();
    }

__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
gelado
Junior Member
Join Date: May 2010
Old 10-02-2012 , 18:35   Re: Voteban only to Vips with flag "b"
Reply With Quote #4

i will try thanks =) then i give u feedback
U guys rullz
gelado is offline
gelado
Junior Member
Join Date: May 2010
Old 10-02-2012 , 18:59   Re: Voteban only to Vips with flag "b"
Reply With Quote #5

The voteban manes in the menu appear with strange caracters like r1w. nickd( %)
I think thers a mistake to not show the nicknames rigth how its supposed to show like
1 - nick ( %)
2- nick ( %)

The code is OK, all i want.. thanks ;-)
Just that error with the nicknames..

Now i'm with anothers problems like that one.. for example this one.. hats

The same history, only vips or players with b flag..
can somebody help with this one? im abusing? sorry :-X

Last edited by gelado; 10-02-2012 at 19:04.
gelado is offline
bhatti
Member
Join Date: Sep 2012
Old 10-02-2012 , 19:24   Re: Voteban only to Vips with flag "b"
Reply With Quote #6

voteban flag b ok
Attached Files
File Type: sma Get Plugin or Get Source (bhattixx.sma - 535 views - 9.0 KB)

Last edited by bhatti; 10-02-2012 at 19:46.
bhatti is offline
gelado
Junior Member
Join Date: May 2010
Old 10-02-2012 , 19:28   Re: Voteban only to Vips with flag "b"
Reply With Quote #7

thanks =) and the hats, do u know?
gelado is offline
bhatti
Member
Join Date: Sep 2012
Old 10-02-2012 , 19:31   Re: Voteban only to Vips with flag "b"
Reply With Quote #8

np
bhatti is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-02-2012 , 19:42   Re: Voteban only to Vips with flag "b"
Reply With Quote #9

Quote:
Originally Posted by bhatti View Post
voteban flag b ok
AMXX file removed, do not upload it again
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 14:47.


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