AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP]Modified amx_who (https://forums.alliedmods.net/showthread.php?t=140013)

Kakkarot 10-08-2010 06:09

[HELP]Modified amx_who
 
Hello, i would like your help in modifying a plugin similar to the amx_who command. This is the plugin's .sma :


PHP Code:

#include <amxmodx>
#include <amxmisc>

#define ACCESS ADMIN_ADMIN
#define MAX_GROUPS 9
new g_groupNames[MAX_GROUPS][] = {
"-=[Owner]=-",
"-=[Co-Owner]=-",
"-=[God]=-",
"-=[Super Moderator]=-",
"-=[Moderator]=- ",
"-=[Administrator]=- ",
"-=[Semi Administrator]=-",
"-=[Helper]=-",
"-=[Slot]=-"
}
new 
g_groupFlags[MAX_GROUPS][] = {
"abcdefghijklmnopqrstu",
"bcdefghijklmnopqrst",
"bcdefghijlmnopqrst",
"bcdefghijlmnopqrs",
"bcdefgijlmnopqr",
"bcdefgijmnop",
"bcdefgijmn",
"bcefijmn",
"b"
}
new 
g_groupFlagsValue[MAX_GROUPS]
public 
plugin_init() 
{
register_plugin("Admin_Who""1.0""SileNNNT")
register_concmd("admin_who""cmdWho",ACCESS)
for(new 
0MAX_GROUPSi++) 
{
g_groupFlagsValue[i] = read_flags(g_groupFlags[i])
}
}
public 
cmdWho(id
{
new 
players[32], inumplayername[32], ia
get_players
(playersinum)
console_print(id"[ Admini Online ]")
for(
0MAX_GROUPSi++) 
{
console_print(id"-----[%d]%s-----"i+1g_groupNames[i])
for(
0inum; ++a
{
player players[a]
get_user_name(playername31)
if(
get_user_flags(player) == g_groupFlagsValue[i]) 
{
console_print(id"%s"name)
}
}
}
console_print(id"[ Admini Online ]")
return 
PLUGIN_HANDLED


The problem is that the command admin_who is usable to all classes of flags instead of ADMIN_ADMIN. this is what i want : to make the command admin_who only usable by admins. I know that amx_who does that very thing, but it shows the accesses chaotic somehow. this way it would be clear what's the rank of every admin.

I also tried to modify cmdaccess.ini as follows :
Code:

"admin_who"    "y"          ; admin_who.amxx
with no effect whatsoever on the command.

Thank You in advance for your help!

P.S. i have searched prior to my posting for a solution but i haven't found one.

hornet 10-08-2010 06:20

Re: [HELP]Modified amx_who
 
Please indent your code and wrap it in PHP tags so it's readable :)

Kakkarot 10-08-2010 11:27

Re: [HELP]Modified amx_who
 
yeah, sorry for that. my first post here on alliedmods forums.

fysiks 10-08-2010 12:31

Re: [HELP]Modified amx_who
 
If it works in amx_who then you should look at the amx_who command (obviously). Hint: admincmd.sma line 1008.

Kakkarot 10-09-2010 13:50

Re: [HELP]Modified amx_who
 
thanks for your advice. i managed to make it work. and fysiks i was working with both plugins but i couldn't make it work as it should. I managed today.

For who is interested :

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define MAX_GROUPS 9
new g_groupNames[MAX_GROUPS][] = {
"-=[Owner]=-",
"-=[Co-Owner]=-",
"-=[God]=-",
"-=[Super Moderator]=-",
"-=[Moderator]=- ",
"-=[Administrator]=- ",
"-=[Semi Administrator]=-",
"-=[Helper]=-",
"-=[Slot]=-"
}
new 
g_groupFlags[MAX_GROUPS][] = {
"abcdefghijklmnopqrstu",
"abcdefghijklmnopqrst",
"bcdefghijlmnopqrst",
"bcdefghijlmnopqrs",
"bcdefgijlmnopqr",
"bcdefgijmnop",
"bcdefgijmn",
"bcefijmn",
"b"
}
new 
g_groupFlagsValue[MAX_GROUPS]
public 
plugin_init() {
register_plugin("Admin_Who""1.0""SileNNNT")
register_concmd("admin_who""cmdWho"ADMIN_KICK)
for(new 
0MAX_GROUPSi++) {
g_groupFlagsValue[i] = read_flags(g_groupFlags[i])
}
}

public 
cmdWho(idlevelcid
{

if (!
cmd_access(idlevelcid1))
   
   return 
PLUGIN_HANDLED
   
new players[32], inumplayername[32], ia
get_players
(playersinum)
console_print(id"[ Admini Online ]")
for(
0MAX_GROUPSi++) {
console_print(id"-----[%d]%s-----"i+1g_groupNames[i])
for(
0inum; ++a) {
player players[a]
get_user_name(playername31)
if(
get_user_flags(player) == g_groupFlagsValue[i]) {
console_print(id"%s"name)
}
}
}
console_print(id"[ Admini Online ]")
return 
PLUGIN_HANDLED




All times are GMT -4. The time now is 10:16.

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