Senior Member
|
08-24-2023
, 12:53
Re: Help with compiling plugin
|
#2
|
Quote:
Originally Posted by Apocalyman
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(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 (read_argv() < 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;
}
|
|