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

Help with compiling plugin


Post New Thread Reply   
 
Thread Tools Display Modes
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
Tote
Senior Member
Join Date: Jul 2023
Old 08-24-2023 , 12:53   Re: Help with compiling plugin
Reply With Quote #2

Quote:
Originally Posted by Apocalyman View Post
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!
PHP 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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say !gag""GagCommand");
}

public 
GagCommand(idargs[]) {
    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(1messagesizeof(message) - 1);

    new 
tokens[4];
    

    if (
read_argv() < 4)
    {
        
client_print(idprint_chat"%s Usage: !gag <target> <duration> <reason>"PLUGIN_TAG);
        return 
PLUGIN_HANDLED;
    }

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

    
get_user_name(idclient_namesizeof(client_name) - 1);

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

    
client_cmd(target_id"amx_gag %s %s"durationreason);
    
client_cmd(target_id"amx_say [GAG] ^1You have been gagged for %s minutes. Reason: %s"durationreason);
    
    
ColorChat(0TEAM_COLOR"%s %s has been gagged for %s minutes. Reason: %s"PLUGIN_TAGtargetdurationreason);
    
    return 
PLUGIN_HANDLED;

Tote is offline
Apocalyman
Member
Join Date: Nov 2022
Old 08-24-2023 , 13:03   Re: Help with compiling plugin
Reply With Quote #3

Quote:
Originally Posted by Tote View Post
PHP 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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say !gag""GagCommand");
}

public 
GagCommand(idargs[]) {
    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(1messagesizeof(message) - 1);

    new 
tokens[4];
    

    if (
read_argv() < 4)
    {
        
client_print(idprint_chat"%s Usage: !gag <target> <duration> <reason>"PLUGIN_TAG);
        return 
PLUGIN_HANDLED;
    }

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

    
get_user_name(idclient_namesizeof(client_name) - 1);

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

    
client_cmd(target_id"amx_gag %s %s"durationreason);
    
client_cmd(target_id"amx_say [GAG] ^1You have been gagged for %s minutes. Reason: %s"durationreason);
    
    
ColorChat(0TEAM_COLOR"%s %s has been gagged for %s minutes. Reason: %s"PLUGIN_TAGtargetdurationreason);
    
    return 
PLUGIN_HANDLED;

Hello! thanks for helping! I still get the same error sadly
Apocalyman is offline
Tote
Senior Member
Join Date: Jul 2023
Old 08-24-2023 , 13:15   Re: Help with compiling plugin
Reply With Quote #4

Quote:
Originally Posted by Apocalyman View Post
Hello! thanks for helping! I still get the same error sadly
PHP Code:
#include <amxmodx>
#include <cstrike>
#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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say !gag""GagCommand");
}

public 
GagCommand(idargs[]) {
    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(1messagesizeof(message) - 1);

    new 
tokens[4];
    

    if(
read_argc() < 4)
    {
        
client_print(idprint_chat"%s Usage: !gag <target> <duration> <reason>"PLUGIN_TAG);
        return 
PLUGIN_HANDLED;
    }

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

    
get_user_name(idclient_namesizeof(client_name) - 1);

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

    
client_cmd(target_id"amx_gag %s %s"durationreason);
    
client_cmd(target_id"amx_say [GAG] ^1You have been gagged for %s minutes. Reason: %s"durationreason);
    
    
ColorChat(0TEAM_COLOR"%s %s has been gagged for %s minutes. Reason: %s"PLUGIN_TAGtargetdurationreason);
    
    return 
PLUGIN_HANDLED;

AND: It's not even going to work idk who made this, you can use other gag plugins, there are many, its not even made by Xpaw, I guess ur just trying to make its gag command !gag in chat instead of amx_gag in console

Last edited by Tote; 08-24-2023 at 13:20.
Tote is offline
Apocalyman
Member
Join Date: Nov 2022
Old 08-24-2023 , 14:28   Re: Help with compiling plugin
Reply With Quote #5

Quote:
Originally Posted by Tote View Post
PHP Code:
#include <amxmodx>
#include <cstrike>
#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(PLUGINVERSIONAUTHOR);
    
register_clcmd("say !gag""GagCommand");
}

public 
GagCommand(idargs[]) {
    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(1messagesizeof(message) - 1);

    new 
tokens[4];
    

    if(
read_argc() < 4)
    {
        
client_print(idprint_chat"%s Usage: !gag <target> <duration> <reason>"PLUGIN_TAG);
        return 
PLUGIN_HANDLED;
    }

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

    
get_user_name(idclient_namesizeof(client_name) - 1);

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

    
client_cmd(target_id"amx_gag %s %s"durationreason);
    
client_cmd(target_id"amx_say [GAG] ^1You have been gagged for %s minutes. Reason: %s"durationreason);
    
    
ColorChat(0TEAM_COLOR"%s %s has been gagged for %s minutes. Reason: %s"PLUGIN_TAGtargetdurationreason);
    
    return 
PLUGIN_HANDLED;

AND: It's not even going to work idk who made this, you can use other gag plugins, there are many, its not even made by Xpaw, I guess ur just trying to make its gag command !gag in chat instead of amx_gag in console
Thanks for the help. yes thats what im trying to do in chat instead of in console and it didnt work at the end so im leaving it at that
Apocalyman is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-25-2023 , 01:44   Re: Help with compiling plugin
Reply With Quote #6

Tote, this is the Scripting Help forum. Simply explain what to change or show a code snippet. If you do post code, at least explain what you changed.
__________________
fysiks is offline
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 08-25-2023 , 06:57   Re: Help with compiling plugin
Reply With Quote #7

Pretty sure its
PHP Code:
get_msg_args 
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
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 03:00.


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