Raised This Month: $ Target: $400
 0% 

Custom Function not Compiling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mlk27
Veteran Member
Join Date: May 2008
Old 12-30-2008 , 12:32   Custom Function not Compiling
Reply With Quote #1

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?
Mlk27 is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-30-2008 , 12:41   Re: Custom Function not Compiling
Reply With Quote #2

Quote:
Originally Posted by Mlk27 View Post
what did i do wrong?
You didn't tell us what the compile errors were.
__________________
Brad is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-30-2008 , 12:45   Re: Custom Function not Compiling
Reply With Quote #3

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[]) 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 12-30-2008 , 12:51   Re: Custom Function not Compiling
Reply With Quote #4

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"?
Mlk27 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-30-2008 , 12:58   Re: Custom Function not Compiling
Reply With Quote #5

Quote:
Originally Posted by Mlk27 View Post
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.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 12-30-2008 , 12:59   Re: Custom Function not Compiling
Reply With Quote #6

shouldnt createshot be:

PHP Code:
public createshot()
{
blah blah

?????
__________________
Dr.G is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-30-2008 , 13:03   Re: Custom Function not Compiling
Reply With Quote #7

Quote:
Originally Posted by Dr.G View Post
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.
SnoW is offline
Send a message via MSN to SnoW
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 09:06.


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