Raised This Month: $ Target: $400
 0% 

* How Kick a Player? *


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
D3v1L
Junior Member
Join Date: Jun 2010
Old 06-17-2010 , 12:13   * How Kick a Player? *
Reply With Quote #1

Hello all!

Who can help me and fix it? I need, if an admin say in chat, but not in console:
  • .kick <username> - and <username> will be kicked.

I have scripted, but it doesn't works. Here is a code:
Code:
/* Edited Code */
/* ********* */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN    "Kick Plugin"
#define VERSION    "0.1"
#define AUTHOR    "D3v1L"

#define ACCESS    ADMIN_KICK
#define PREFIX    "[NEF]"

new g_kickCmd[] = ".kick"
new g_fCvarMsg

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say", "cmd_Kick")
    g_fCvarMsg = register_cvar("amx_show_msg_1all_0id", "1")
}

public cmd_Kick(id)
{
    new args[32]
    read_args(args, charsmax(args))

    new target = cmd_target(id, args, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)

    if (!target)
        return PLUGIN_CONTINUE

    new admin_name[32], target_name[32]
    get_user_name(id, admin_name, charsmax(admin_name))
    get_user_name(target, target_name, charsmax(target_name))

    new fix[192]
    format(fix, charsmax(fix), "%s", target)

    if (containi(args, g_kickCmd) != -1 && containi(args, fix) != -1)
    {
        if (!access(id, ACCESS))
        {
            client_print(id, print_chat, "%s You have no access to that command.", PREFIX)
            return PLUGIN_HANDLED
        }

        server_cmd("kick #%d", get_user_userid(target))
        client_print(get_pcvar_num(g_fCvarMsg) ? 0 : id, print_chat, "%s Admin %s: kicked %s", PREFIX, admin_name, target_name)
    }

    return PLUGIN_CONTINUE
}
Sorry for my very bad english.
Thanks for all!

Last edited by D3v1L; 06-17-2010 at 15:51.
D3v1L is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-17-2010 , 12:26   Re: * How Kick a Player? *
Reply With Quote #2

Code:
    if (!cmd_access(id, level, cid, 2))     {         client_print(id, print_chat, "%s You have no access to tha command.")         return PLUGIN_HANDLED     }

With this, if someone don't have the ACCESS and don't send the second parameter, the say is blocked, so that is wrong. You have to check first if the first paramter is ".kick"

Code:
    new args[32]     read_args(args, charsmax(args))     new target = cmd_target(id, args, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)

With read_args( ) you are getting a line of all arguments (all the message said by player).

You can't use cmd_target( ) for that.
__________________
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^
D3v1L
Junior Member
Join Date: Jun 2010
Old 06-17-2010 , 14:23   Re: * How Kick a Player? *
Reply With Quote #3

Thanks for the explanation.
So, do you can fix it to go "Kick Plugin" working?
D3v1L is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 06-17-2010 , 14:53   Re: * How Kick a Player? *
Reply With Quote #4

Well, sry but you are in Scripting help, so... you have to learn, if you want a request you have the request forum.

First fix the things that i mentioned, and then post your 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^
D3v1L
Junior Member
Join Date: Jun 2010
Old 06-17-2010 , 15:44   Re: * How Kick a Player? *
Reply With Quote #5

I have fixed (with access flags), that you mentioned, view first post.
And now, do you can help me?

Last edited by D3v1L; 06-17-2010 at 15:53.
D3v1L is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2010 , 18:08   Re: * How Kick a Player? *
Reply With Quote #6

Ok, you can look here for one method. Or possibly use this if you plan on more commands in chat.
__________________
fysiks is offline
D3v1L
Junior Member
Join Date: Jun 2010
Old 06-18-2010 , 04:35   Re: * How Kick a Player? *
Reply With Quote #7

Thank you, fysiks. I'll try this, although I liked my code. But thanks.
D3v1L is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-18-2010 , 19:33   Re: * How Kick a Player? *
Reply With Quote #8

Quote:
Originally Posted by D3v1L View Post
although I liked my code.
Well, if you get it to work then that's great. I was just offering some ways that I know work .
__________________
fysiks 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:48.


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