Raised This Month: $ Target: $400
 0% 

Help with compiling plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Apocalyman
Member
Join Date: Nov 2022
Old 08-24-2023 , 12:45   Help with compiling plugin
Reply With Quote #1

I am trying to compile this !gag plugin which uses the amx_gag plugin which was made by xPaw to be used in the chat as well and I have an error at line 29 when trying to compile it and I dont know what to do
Code:
#include <amxmodx>
#include <colorchat>

new const PLUGIN[] = "Gag Plugin";
new const VERSION[] = "1.0";
new const AUTHOR[] = "Your Name";

new const PLUGIN_TAG[] = "^x04[^x01 Gag-Plugin ^x04]^x01";

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_clcmd("say !gag", "GagCommand");
}

public GagCommand(id, args[]) {
    if (!(get_user_flags(id) & ADMIN_KICK)) {
        return PLUGIN_CONTINUE;
    }

    new target[32], duration[32], reason[128];
    new client_name[32];

    new message[128];
    read_argv(1, message, sizeof(message) - 1);

    new tokens[4];
    

    if (get_args() < 4)
    {
        client_print(id, print_chat, "%s Usage: !gag <target> <duration> <reason>", PLUGIN_TAG);
        return PLUGIN_HANDLED;
    }

    format(target, sizeof(target), "%s", tokens[1]);
    format(duration, sizeof(duration), "%s", tokens[2]);
    format(reason, sizeof(reason), "%s", tokens[3]);

    get_user_name(id, client_name, sizeof(client_name) - 1);

    new target_id = -1;
    
    for (new i = 1; i <= get_maxplayers(); i++) {
        if (is_user_connected(i)) {
            new target_name[32];
            get_user_name(i, target_name, sizeof(target_name) - 1);
            if (equali(target, target_name)) {
                target_id = i;
                break;
            }
        }
    }
    
    if (target_id == -1) {
        return PLUGIN_CONTINUE;
    }

    client_cmd(target_id, "amx_gag %s %s", duration, reason);
    client_cmd(target_id, "amx_say [GAG] ^1You have been gagged for %s minutes. Reason: %s", duration, reason);
    
    ColorChat(0, TEAM_COLOR, "%s %s has been gagged for %s minutes. Reason: %s", PLUGIN_TAG, target, duration, reason);
    
    return PLUGIN_HANDLED;
}
The line is: if (get_args() < 4)
trying to compile it will show you too
Thanks to the helpers!
Apocalyman is offline
 



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 00:45.


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