Raised This Month: $32 Target: $400
 8% 

Ultimate_who not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ady20
Member
Join Date: Sep 2012
Old 09-28-2012 , 09:06   Ultimate_who not working
Reply With Quote #1

Me the server owner can use it, normal players can use it. But admins can't use it.
When an admin types /who the following errors appear in the server console:


L 09/28/2012 - 16:00:09: [AMXX] Displaying debug trace (plugin "ultimate_who.amxx")
L 09/28/2012 - 16:00:09: [AMXX] Run time error 4: index out of bounds
L 09/28/2012 - 16:00:09: [AMXX] [0] ultimate_who.sma::who_motd (line 92 )
L 09/28/2012 - 16:00:09: [AMXX] [1] ultimate_who.sma::cmdSay (line 72)

Plugin here:
Quote:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "ULTIMATE WHO"
#define VERSION "1.1"
#define AUTHOR "P.Of.Pw"

#define CharsMax(%1) sizeof %1 - 1
#define time_shower 1.0

#define GROUPS_NAME 8
#define GROUPS_ACCESS 8

#define motd_msg "Admin's Online"

new color[][] =
{
"00FF00",
"FF0000",
"0000FF",
"545454"
}

new GroupNames[GROUPS_NAME][] =
{
"---=== SERVER OWNER ===---",
"---=== Owner ===---",
"---=== God ===---",
"---=== Demi-God ===---",
"---=== Moderator ===---",
"---=== Admin ===---",
"---=== Helper ===---",
"---=== Slot ===---"
}

new GroupFlags[GROUPS_ACCESS][] =
{
"abcdefghijklmnopqrstu",
"abcdefghijklnopqrstu",
"abcdefghiklnopqrstu",
"abcdefghij",
"bcdefghij",
"bcdefij",
"bcefj",
"b"
}

new GroupFlagsValue[GROUPS_NAME]

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

for(new p_of_pw = 0 ; p_of_pw < GROUPS_NAME ; p_of_pw++)
GroupFlagsValue[p_of_pw] = read_flags(GroupFlags[p_of_pw])

register_clcmd("say /who" , "cmdSay")
register_clcmd("say_team /who" , "cmdSay")
}

public cmdSay(id)
{
new say[8]
read_args(say, 7)

if ((containi(say, "who") != -1
|| containi(say, "admin") != -1
|| containi(say, "admins") != -1
|| contain(say, "/who") != -1
|| contain(say, "/admin") != -1
|| contain(say, "/admins") != -1))
who_motd(id)

return PLUGIN_CONTINUE
}

who_motd(id)
{
new sPlayers[32], iNum, iPlayer
new sName[32], sBuffer[1024]
new iLen

iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")

get_players(sPlayers, iNum, "ch")

for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
{
iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h5><font color=^"violet^">%s^n</font></h5></center>", GroupNames[p_of_pw])

for(new a = 0; a < iNum ; a++)
{
iPlayer = sPlayers[a]

if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
{
get_user_name(iPlayer, sName, sizeof sName - 1)
iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><font color=^"%s^">%s^n</center></font>", color[p_of_pw], sName)
}
}
}

show_motd(id, sBuffer, motd_msg)
return PLUGIN_CONTINUE
}

Last edited by Ady20; 09-28-2012 at 10:25.
Ady20 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-28-2012 , 10:07   Re: Ultimate_who not working
Reply With Quote #2

Attach the plugin maybe? We don't read in stars...
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Ady20
Member
Join Date: Sep 2012
Old 09-28-2012 , 10:25   Re: Ultimate_who not working
Reply With Quote #3

Updated sry for that >.<
Ady20 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-28-2012 , 20:05   Re: Ultimate_who not working
Reply With Quote #4

Attach the .sma so that the lines shown in the errors make sense.

Did it work before? If yes, what did you change?

Also, there is no code in there that executes differently for admins so I don't see how it wouldn't work for admins but work for non-admins.
__________________
fysiks is offline
Ady20
Member
Join Date: Sep 2012
Old 09-29-2012 , 06:03   Re: Ultimate_who not working
Reply With Quote #5

I only changed the flags and the grade names.
Me the server owner can use it. A normal player can use it. But when an admin is online nobody can use it. It gives that error in the server console.

Maybe I didn't added the cvars correctly? Can yo give me an amxx.cfg with the cvars made for this plugin?
Attached Files
File Type: sma Get Plugin or Get Source (ultimate_who.sma - 853 views - 2.6 KB)
Ady20 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-29-2012 , 15:23   Re: Ultimate_who not working
Reply With Quote #6

That still doesn't show the correct line (line 92). I can't figure it out without knowing what array is causing the error.

EDIT: I found it. The colors array needs to have the same number of strings as GroupFlags.

Quote:
Originally Posted by Ady20 View Post
But when an admin is online nobody can use it.
Wow, that completely different than what you said in your first post.

Quote:
Originally Posted by Ady20 View Post
Maybe I didn't added the cvars correctly? Can yo give me an amxx.cfg with the cvars made for this plugin?
There are no cvars.
__________________

Last edited by fysiks; 09-29-2012 at 15:31.
fysiks is offline
Reply


Thread Tools
Display Modes

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 01:44.


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