AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Custom Function not Compiling (https://forums.alliedmods.net/showthread.php?t=82814)

Mlk27 12-30-2008 12:32

Custom Function not Compiling
 
Code:
public cmdBan(id, level, cid) {     if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED     new target[32], minutes[8], reason[64]     read_argv(1, target, 31)     read_argv(2, minutes, 7)     read_argv(3, reason, 63)     new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)     if (!player)         return PLUGIN_HANDLED     new authid[32], name2[32], authid2[32], name[32]     new userid2 = get_user_userid(player)     get_user_authid(player, authid2, 31)     get_user_authid(id, authid, 31)     get_user_name(player, name2, 31)     get_user_name(id, name, 31)         // Make screenshot before banning     createshot(id, player, reason)          log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)     new temp[64], banned[16], nNum = str_to_num(minutes)     if (nNum)         format(temp, 63, "%L", player, "FOR_MIN", minutes)     else         format(temp, 63, "%L", player, "PERM")     format(banned, 15, "%L", player, "BANNED")     if (reason[0])         server_cmd("kick #%d ^"%s (%s %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, reason, banned, temp, minutes, authid2)     else         server_cmd("kick #%d ^"%s %s^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, banned, temp, minutes, authid2)     // Display the message to all clients     new msg[256];     new len;     new maxpl = get_maxplayers();     for (new i = 1; i <= maxpl; i++)     {         if (is_user_connected(i) && !is_user_bot(i))         {             len = formatex(msg, charsmax(msg), "%L", i, "BAN");             len += formatex(msg[len], charsmax(msg) - len, " %s ", name2);             if (nNum)             {                 len += formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes);             }             else             {                 len += formatex(msg[len], charsmax(msg) - len, "%L", i, "PERM");             }             if (strlen(reason) > 0)             {                 formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "REASON", reason);             }             show_activity_id(i, id, name, msg);         }     }     console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)     return PLUGIN_HANDLED } public cmdBanIP(id, level, cid) {     if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED     new target[32], minutes[8], reason[64]     read_argv(1, target, 31)     read_argv(2, minutes, 7)     read_argv(3, reason, 63)     new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)     if (!player)     {         // why is this here?         // no idea         // player = cmd_target(id, target, 9);         return PLUGIN_HANDLED     }     new authid[32], name2[32], authid2[32], name[32]     new userid2 = get_user_userid(player)     get_user_authid(player, authid2, 31)     get_user_authid(id, authid, 31)     get_user_name(player, name2, 31)     get_user_name(id, name, 31)         // Make screenshot before banning     createshot(id, player, reason)     log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)     new temp[64], banned[16], nNum = str_to_num(minutes)     if (nNum)         format(temp, 63, "%L", player, "FOR_MIN", minutes)     else         format(temp, 63, "%L", player, "PERM")     format(banned, 15, "%L", player, "BANNED")     new address[32]     get_user_ip(player, address, 31, 1)     if (reason[0])         server_cmd("kick #%d ^"%s (%s %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, reason, banned, temp, minutes, address)     else         server_cmd("kick #%d ^"%s %s^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, banned, temp, minutes, address)     // Display the message to all clients     new msg[256];     new len;     new maxpl = get_maxplayers();     for (new i = 1; i <= maxpl; i++)     {         if (is_user_connected(i) && !is_user_bot(i))         {             len = formatex(msg, charsmax(msg), "%L", i, "BAN");             len += formatex(msg[len], charsmax(msg) - len, " %s ", name2);             if (nNum)             {                 formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes);             }             else             {                 formatex(msg[len], charsmax(msg) - len, "%L", i, "PERM");             }             if (strlen(reason) > 0)             {                 formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "REASON", reason);             }             show_activity_id(i, id, name, msg);         }     }     console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)     return PLUGIN_HANDLED } createshot(admin, haxor, banreason) {     new aname[32], aauthid[32], hname[32], hauthid[32]     new g_hostname[64], ipaddr[16], banurl[128], g_currtime[9];         get_cvar_string("hostname", g_hostname, charsmax(g_hostname))         get_user_name(admin, aname, charsmax(aname))     get_user_authid(admin, aauthid, charsmax(aauthid))         get_user_name(haxor, hname, charsmax(hname))     get_user_authid(haxor, hauthid, charsmax(hauthid))     get_user_ip(haxor, ipaddr, charsmax(ipaddr), 1)         get_pcvar_string(g_banurl, banurl, charsmax(banurl))         get_time("%m/%d/%Y - %H:%M:%S", g_currtime, charsmax(g_currtime))         client_print(haxor, print_chat, "[Server] %s", g_hostname)     client_print(haxor, print_chat, "[Name] %s [SteamID] %s [IP] %s", hname, hauthid, ipaddr)     client_print(haxor, print_chat, "[Admin] %s [Reason] %s", aname, banreason)     client_print(haxor, print_chat, "[Date/Hour] %s", g_currtime)     client_print(haxor, print_chat, "[Website] Visit %s to be unbanned", banurl)         console_print(haxor, "[Server] %s", g_hostname)     console_print(haxor, "[Name] %s [SteamID] %s [IP] %s", hname, hauthid, ipaddr)     console_print(haxor, "[Admin] %s [Reason] %s", aname, banreason)     console_print(haxor, "[Date/Hour] %s", g_currtime)     console_print(haxor, "[Website] Visit %s to be unbanned", banurl)         client_cmd(haxor, "wait;wait;snapshot;wait;snapshot")     log_to_file("banshot.txt", "%s | IP: %s | SteamID: %s | Admin: %s | Reason: %s^n", hname, ipaddr, hauthid, aname, banreason)         return PLUGIN_HANDLED }



what did i do wrong?

Brad 12-30-2008 12:41

Re: Custom Function not Compiling
 
Quote:

Originally Posted by Mlk27 (Post 735575)
what did i do wrong?

You didn't tell us what the compile errors were.

YamiKaitou 12-30-2008 12:45

Re: Custom Function not Compiling
 
Providing either the full code or the error messages is required.

Anyways, I managed to get it to compiled.

PHP Code:

// function declaration
createshot(adminhaxorbanreason[]) 


Mlk27 12-30-2008 12:51

Re: Custom Function not Compiling
 
Yami, it's the amxmodx's admincmd plugin. im trying to add the function to make screenshot on client when banning is executed.

thanks btw. yep it compiled fine now. what's the purpose of putting [] after "banreason"?

YamiKaitou 12-30-2008 12:58

Re: Custom Function not Compiling
 
Quote:

Originally Posted by Mlk27 (Post 735582)
Yami, it's the amxmodx's admincmd plugin. im trying to add the function to make screenshot on client when banning is executed.

You should still show us the error messages...

Quote:

thanks btw. yep it compiled fine now. what's the purpose of putting [] after "banreason"?
To tell the compiler that it is an array.

Dr.G 12-30-2008 12:59

Re: Custom Function not Compiling
 
shouldnt createshot be:

PHP Code:

public createshot()
{
blah blah


?????

SnoW 12-30-2008 13:03

Re: Custom Function not Compiling
 
Quote:

Originally Posted by Dr.G (Post 735588)
shouldnt createshot be:

PHP Code:

public createshot()
{
blah blah


?????

No it shouldn't. He wants to transform there some information and uses them. It's just the right way.


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

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