Raised This Month: $ Target: $400
 0% 

server_cmd()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-05-2009 , 06:18   server_cmd()
Reply With Quote #1

PHP Code:
#include <amxmodx>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /kickme""HookKickMe")
}

public 
HookKickMe(id)
{
    new 
Name[32]
    
get_user_name(idName31)
    
    
server_cmd("amx_kick %s"Name)
    
server_exec()

Is only an example... the problem is that i can use the command ONLY if i am ADMIN... but i want that all players can use this command...

Yeh, i know that the correct method to do this is:

PHP Code:
server_cmd("kick #%d"get_user_userid(id)) 
But like i said... is only an example.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-05-2009 , 06:47   Re: server_cmd()
Reply With Quote #2

If you don't specify a flag, it means it would be available for all players.
__________________
Arkshine is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-05-2009 , 09:15   Re: server_cmd()
Reply With Quote #3

Well.. i show you the code:

PHP Code:
#include <amxmodx>

#define ADMIN_CHECK ADMIN_KICK

new maxplayers

public plugin_init()
{
    
register_plugin("Admin Check edited""1.0""OneEyed && Alucard")
    
    
maxplayers get_maxplayers()
    
    
register_clcmd("say""handle_say")
}

public 
handle_say(id)
{
    new 
said[192]
    
read_args(said,192)
    
    if( ( 
containi(said"quien") != -&& containi(said"admin") != -) || contain(said"/admin") != -)
    {
        new 
adminnames[33][32]
        new 
Name[32]
        new 
icountx
        
        get_user_name
(idName31)
        
        for(
<= maxplayers i++)
        {
            if(
is_user_connected(i) )
            {
                if(
get_user_flags(i) & ADMIN_CHECK)
                    
get_user_name(iadminnames[count++], 31)
            }
        }
        
        if(
count 0)
        {
            for(
count x++)
            {
                
server_cmd("amx_msg %s ^"Admins Online:\n%s%s^""Nameadminnames[x], < (count-1) ? "\n":"")
                
server_exec()
            }
        }
        if(
count 0)
        {
            
server_cmd("amx_msg %s ^"No admins online^""Name)
            
server_exec()
        }
    }
    else
        return 
PLUGIN_CONTINUE
    
return PLUGIN_HANDLED

I tested in lan and in a dedicated server. When i have the name with the Admin... and i use /admins command... show me
"Admins Online:
Alucard^"

Good... but when i use a name without the admin... and /admins command... would show me "No admins online". But no... the msg doesn't appear. Is something of flags, or what?

Thx and sry for my english.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 09-05-2009 , 10:06   Re: server_cmd()
Reply With Quote #4

The count is 0 when there's no admins online and your check is:
PHP Code:
if(count 0

So nothing is displayed.
SnoW is offline
Send a message via MSN to SnoW
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-05-2009 , 12:45   Re: server_cmd()
Reply With Quote #5

Quote:
Originally Posted by SnoW View Post
The count is 0 when there's no admins online and your check is:
PHP Code:
if(count 0

So nothing is displayed.
True, i am rly stupid... but now... have the first problem... when i am not admin and type /admins... i get "[AMXX] You have no acces to this command." or soemthing like this... o.o!
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 09-05-2009 , 20:10   Re: server_cmd()
Reply With Quote #6

register_concmd ("say /kickme", "HookKickMe", ADMIN_LEVEL_Z " ")

If you try that?
Mxnn is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-05-2009 , 21:38   Re: server_cmd()
Reply With Quote #7

I don't think that...

As far as i know... concmd is useless for command like "say /command"... And, like Arskhine said... if you dont specify a flag... it means it would be available for all players.

Also, the /kickme command is only an example... i showed in the last post, the real code.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Reply


Thread Tools
Display Modes

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 15:09.


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