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

Super Admin Slash change to ! instead of /


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
enjoi.
Veteran Member
Join Date: Mar 2011
Old 11-20-2011 , 13:09   Super Admin Slash change to ! instead of /
Reply With Quote #1

PHP Code:
/*
*    
*   Admin Slash by mike_cao <[email protected]>
*   Super enhancements by [DeathTV] Sid 6.7
*    This file is provided as is (no warranties).
*
*    This plugin allows admins to execute amx commands
*    using 'say' and a slash '/'. It can also execute
*    a command on all players or a team using '@all' and
*    '@team' in place of the authid/nick parameter.
*
*    Examples:
*    To kick a player type '/kick playername'
*    To kick all players type '/kick @all'
*    To kick all players on a team type '/kick @team:TEAMID'
*    To ban all players for 10 minutes, type '/ban 10 @all'
*
*
*    Important: place this plugin at the bottom of your plugins.ini file 
*    so it doesn't interfere with other plugin that may use the '/'.
*
*     Super Enhancements:
*   Slash is available only to admins now, so it will not interfere with things such as
*   /rope or /chickenme for normal players. This means super_admin_slash's position
*   in the plugins.ini file is not as important

*     Say /command @ blahblah, the empty @ sign will popup a menu of users and teams

*   (Counter-Strike) Say /R command @all blahblah, the command will repeat every new round
*   say / and the wipe action menu will popup

*     There is an X-Target system that will emulate @ functionality for commands that can't.
*   For commands that can you can use the native @ALL @CT etc.

*   Ex.   say /swap @ @  and you may pick 2 ppl to swap teams

*/ 

#include <amxmodx>
#include <amxmisc>

#define VERBOSE
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 80
#define MAX_PLAYERS 32
new PLUGIN[] = "Super Admin Slash"

new sMessage[MAX_TEXT_LENGTH], Array:repeatStorage, Array:repeatIDsrepeaters[MAX_PLAYERS+1]

enum {
    
GET_TEAM_TARGET_ISNOBODY,
    
GET_TEAM_TARGET_ISALL,
    
GET_TEAM_TARGET_ISTEAMCT,
    
GET_TEAM_TARGET_ISTERRORIST
}

enum {
    
GET_TEAM_TARGET_SKIPNOBODY,
    
GET_TEAM_TARGET_SKIPBOTS,
    
GET_TEAM_TARGET_SKIPDEADPEOPLE
}

stock tokenlen(string[]){
    for(new 
istrlen(string)+1i++){
        if(
string[i] < 33) return i
    
}
    return 
0
}

stock get_team_target(arg[],players[32],&pnum,skipMode=GET_TEAM_TARGET_SKIPNOBODY){
    
//Modular Tea    m Targeting code by Sid 6.7
    
new whoTeam
    
new cmdflags[4]
    switch(
skipMode){
        case 
GET_TEAM_TARGET_SKIPBOTScmdflags "ce"
        
case GET_TEAM_TARGET_SKIPNOBODYcmdflags "e"
        
case GET_TEAM_TARGET_SKIPDEADPEOPLEcmdflags "ae"
    
}
    if(
equali(arg[1],"ALL",tokenlen(arg[1])))     {
        switch(
skipMode){
            case 
GET_TEAM_TARGET_SKIPBOTScmdflags "c"
            
case GET_TEAM_TARGET_SKIPNOBODYcmdflags ""
            
case GET_TEAM_TARGET_SKIPDEADPEOPLEcmdflags "a"
        
}
        
whoTeam GET_TEAM_TARGET_ISALL
        get_players
(players,pnum,cmdflags)
    }
        
    if(
equali(arg[1],"TERRORIST",tokenlen(arg[1]))) {
        
whoTeam GET_TEAM_TARGET_ISTERRORIST
        get_players
(players,pnum,cmdflags,"TERRORIST")
    }
    if(
equali(arg[1],"CT",2)    || equali(arg[1],"C",1)) {
        
whoTeam GET_TEAM_TARGET_ISTEAMCT
        get_players
(players,pnum,cmdflags,"CT")
    }
    return 
whoTeam
}

public 
admin_slash(id){
    if(!
is_user_admin(id)) return PLUGIN_CONTINUE
    
new sArg[MAX_NAME_LENGTH]    
    
read_argv(1,sArg,charsmax(sArg))
    
    
// Check for '/' char
    
if ( sArg[0] == '/' ){
        
read_args(sMessage,charsmax(sMessage))
        
remove_quotes(sMessage)
        
replace(sMessage,charsmax(sMessage),"/","")
        
process(id,sMessage)        
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

process(id,line[sizeof sMessage]){
    if(
equal(line,"")){
        new 
menu menu_create("Wipe Repeaters","imh")
        
menu_additem(menu,"Wipe All","wipe0")
        new 
pnump[32], n[24], c[32]
        
get_players(p,pnum,"c")
        for(new 
ipnumi++){
            
get_user_name(p[i],n,charsmax(n))
            
formatex(c,charsmax(c),"[%d] %s",repeaters[p[i]],n)
            
formatex(n,6,"wipe%d",p[i])
            
menu_additem(menu,c,n)
        }
        
menu_display(id,menu)
        return
    }
    new 
contain(line,"@")
    if(
!= -&& !isalnum(line[a+1])) intellimenu(id,line)
    else {
        
//check for @Xall @XT @XCT, these are manual controls for commands not supporting @ symbol
        
new line2[sizeof line]
        
copy(line2,charsmax(line2),line)
        if(
line[0] == 'R') {
            
replace(line2,charsmax(line2),"R","")
            
addrepeater(id,line2)
            
client_print(id,print_chat,"[%s] Command set for repeat on new rounds",PLUGIN)
            return
        }
        
contain(line,"@X")
        if(
== -1client_cmd(id,"amx_%s",line)
        else {
            new 
teammates[32], pnum
            
//start cycling thru targets
            
client_print(id,print_chat,"[%s] Emulation called for @%s",PLUGIN,line[a+2])
            
replace(line2,charsmax(line2),"@X","@")
            if(
get_team_target(line2[a],teammates,pnum) == GET_TEAM_TARGET_ISNOBODY)
                
client_print(id,print_chat,"[%s] No clients on team",PLUGIN)
            else {
                new 
r[16], j[2]
                
strtok(line2[a],r,charsmax(r),j,1)
                
replace(line2,charsmax(line2),r,"#%d")
                
#if defined VERBOSE
                
server_print(line2,12345)
                
#endif
            
}
            new 
line3[sizeof line]
            for(new 
ipnumi++){
                
formatex(line3,charsmax(line3),line2,get_user_userid(teammates[i]))
                
#if defined VERBOSE
                
server_print(line3)
                
#endif
                
client_cmd(id,"amx_%s",line3)
            }
        }
    }
}

intellimenu(id,const line[sizeof sMessage]){
    new 
players[32], pnumcommandlabel[48], gumstick[sizeof line], userid[8]
    
get_players(players,pnum)
    new 
menu menu_create("AMXX Super Slash Users Menu","imh")
    new 
targets[][] = {"@ALL","@CT","@T"}
    if(
cstrike_running()){
        if(
line[0] == 'R'){
            
copy(gumstick,charsmax(gumstick),line[1])
            
commandlabel "Repeat\R\yON"
        
} else {
            
formatex(gumstick,charsmax(gumstick),"R%s",line)
            
commandlabel "Repeat\R\dOFF"
        
}
        
menu_additem(menu,commandlabel,gumstick)
        for(new 
isizeof targetsi++){
            
copy(gumstick,charsmax(gumstick),line)
            
replace(gumstick,charsmax(gumstick),"@",targets[i])
            
menu_additem(menu,targets[i],gumstick)
        }
    }
    
menu_addblank(menu,0)
    for(new 
ipnumi++){
        
copy(gumstick,charsmax(gumstick),line)
        
formatex(userid,charsmax(userid),"#%d",get_user_userid(players[i]))
        
replace(gumstick,charsmax(gumstick),"@",userid)
        
get_user_name(players[i],commandlabel,charsmax(commandlabel))
        if(
cstrike_running()) 
            if(
get_user_flags(players[i]) & ADMIN_IMMUNITYstrcat(commandlabel,"\R\yIMMUNITY",charsmax(commandlabel))
        
menu_additem(menu,commandlabel,gumstick)
    }
    
menu_addblank(menu,0)
    new 
Xtargets[][] = {"@XALL","@XCT","@XT"}
    for(new 
icstrike_running() ? sizeof Xtargets 1i++){
        
copy(gumstick,charsmax(gumstick),line)
        
replace(gumstick,charsmax(gumstick),"@",Xtargets[i])
        
menu_additem(menu,Xtargets[i],gumstick)
    }
    
menu_display(id,menu)            
}

public 
imh(idmenuitem){
    if(
item <= MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
abubblegum[MAX_TEXT_LENGTH], name[32]
    
menu_item_getinfo(menuitemabubblegumcharsmax(bubblegum),name,sizeof(name)-1a)
    
menu_destroy(menu)
    if(
equal(bubblegum,"wipe",4)) wiperepeaters(str_to_num(bubblegum[4]))
    else 
process(id,bubblegum)
    return 
PLUGIN_HANDLED
}

public 
plugin_init(){
    
register_plugin(PLUGIN,"2008","mike_cao & Sid 6.7")
    
register_clcmd("say","admin_slash",0,"say /command < params >")
    if(
cstrike_running()) register_logevent("logevent_round_start"2"1=Round_Start")
    
repeatStorage ArrayCreate(MAX_TEXT_LENGTH)
    
repeatIDs ArrayCreate()
}

public 
logevent_round_start(){
    for(new 
iArraySize(repeatIDs); i++){
        
ArrayGetString(repeatStorage,i,sMessage,charsmax(sMessage))
        
process(ArrayGetCell(repeatIDs,i),sMessage)
    }
}

addrepeater(idr[]){
    
ArrayPushCell(repeatIDs,id)
    
ArrayPushString(repeatStorage,r)
    
repeaters[id]++
}

//id 0 = all
wiperepeaters(id){
    for(new 
iArraySize(repeatIDs); i++){
        if(!
id || ArrayGetCell(repeatIDs,i) == id){
            
repeaters[ArrayGetCell(repeatIDs,i)]--
            
ArrayDeleteItem(repeatIDs,i)
            
ArrayDeleteItem(repeatStorage,i)
            
i--
        }
    }
}

public 
client_disconnect(id){
    
wiperepeaters(id)

super admin slash how can i make it so its !kick and stuff because it interferes with a plugin of ours
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]

Last edited by enjoi.; 12-24-2011 at 18:44.
enjoi. is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 11-20-2011 , 13:53   Re: Scripting Help
Reply With Quote #2

Do you realize how little you helped us? All you said is that it interferes with plugins that you have, yet you didn't post the names nor the code of the plugins that it interferes with...
__________________
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
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 11-20-2011 , 15:25   Re: Scripting Help
Reply With Quote #3

PHP Code:
public admin_slash(id){ 
    if(!
is_user_admin(id)) return PLUGIN_CONTINUE 
    
new sArg[MAX_NAME_LENGTH]     
    
read_argv(1,sArg,charsmax(sArg)) 
     
    
// Check for '/' char 
    
if ( sArg[0] == '/' ){ 
        
read_args(sMessage,charsmax(sMessage)) 
        
remove_quotes(sMessage
        
replace(sMessage,charsmax(sMessage),"/",""
        
process(id,sMessage)         
        return 
PLUGIN_HANDLED 
    

    return 
PLUGIN_CONTINUE 

PHP Code:
public admin_slash(id){ 
    if(!
is_user_admin(id)) return PLUGIN_CONTINUE 
    
new sArg[MAX_NAME_LENGTH]     
    
read_argv(1,sArg,charsmax(sArg)) 
     
    
// Check for '/' char 
    
if ( sArg[0] == '/' || sArg[0] == '!'){ 
        
read_args(sMessage,charsmax(sMessage)) 
        
remove_quotes(sMessage
        
process(id,sMessage[1])         
        return 
PLUGIN_HANDLED 
    

    return 
PLUGIN_CONTINUE 

__________________

Working on:
nothing
schmurgel1983 is offline
enjoi.
Veteran Member
Join Date: Mar 2011
Old 11-20-2011 , 15:40   Re: Scripting Help
Reply With Quote #4

can u give me the code cuz i got an error.

// C:\Users\..\Desktop\Files\Server\dINk Compiler\waladmin.sma(109) : error
047: array sizes do not match, or destination array is too small
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-20-2011 , 15:45   Re: Scripting Help
Reply With Quote #5

Change your title to something descriptive before you post again.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 11-20-2011, 15:49
enjoi.
This message has been deleted by enjoi..
Old 12-23-2011, 20:42
enjoi.
This message has been deleted by ConnorMcLeod. Reason: RULES, read them please !!
enjoi.
Veteran Member
Join Date: Mar 2011
Old 12-24-2011 , 18:45   Re: Super Admin Slash change to ! instead of /
Reply With Quote #6

Here is the original thread.
http://forums.alliedmods.net/showthread.php?p=654362
Sorry for that double post I removed the other. Anyone?
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-24-2011 , 19:25   Re: Super Admin Slash change to ! instead of /
Reply With Quote #7

https://forums.alliedmods.net/showthread.php?t=69913
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
enjoi.
Veteran Member
Join Date: Mar 2011
Old 12-25-2011 , 11:27   Re: Super Admin Slash change to ! instead of /
Reply With Quote #8

Emp do you think you can make it to ! also because like i have this /cam plugin but i dont feel like editing it and it only works in teamchat and id like it to work in all chats bcuz the super admin slash im using only works on all chat but not team chat you know what i mean
__________________
Block Maker v6.0 []
Point Slay v3.0 []
Contact [ PM ]
enjoi. is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-25-2011 , 11:38   Re: Super Admin Slash change to ! instead of /
Reply With Quote #9

And you can't change that? And you're the guy which is selling plugins?

ROFL
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 12-25-2011 , 15:52   Re: Super Admin Slash change to ! instead of /
Reply With Quote #10

Quote:
Originally Posted by enjoi. View Post
but i dont feel like editing it
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 21:34.


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