AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with compiling plugin (https://forums.alliedmods.net/showthread.php?t=343735)

Apocalyman 08-24-2023 12:45

Help with compiling plugin
 
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!

Tote 08-24-2023 12:53

Re: Help with compiling plugin
 
Quote:

Originally Posted by Apocalyman (Post 2809215)
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;



Apocalyman 08-24-2023 13:03

Re: Help with compiling plugin
 
Quote:

Originally Posted by Tote (Post 2809217)
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

Tote 08-24-2023 13:15

Re: Help with compiling plugin
 
Quote:

Originally Posted by Apocalyman (Post 2809219)
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

Apocalyman 08-24-2023 14:28

Re: Help with compiling plugin
 
Quote:

Originally Posted by Tote (Post 2809221)
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

fysiks 08-25-2023 01:44

Re: Help with compiling plugin
 
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.

DruGzOG 08-25-2023 06:57

Re: Help with compiling plugin
 
Pretty sure its
PHP Code:

get_msg_args 



All times are GMT -4. The time now is 09:03.

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