Player Loop
#1

Hi, i'm trying to make a command that loops throught all accounts, and finds admins

So i made like:

pawn Код:
if(strcmp(cmdtext, "/adminsearch", true) == 0)
    {
        new string2[512], string[256];
        GetPlayerName(playerid, giveplayername, sizeof(giveplayername));
        format(string, sizeof(string), "Accounts/%s.ini", giveplayername);
        dini_Get(string, "AdminLevel");
        format(string2, sizeof(string2), "Administrators\nName: %s | AdminLevel: %d", giveplayername, AccInfo[playerid][AdminLevel]);
        SendClientMessage(playerid, 0xFFFFFF, string2);
        string2++;
    }
pawn Код:
C:\Documents and Settings\Administrator\Desktop\Stunt World\gamemodes\SW.pwn(2252) : error 022: must be lvalue (non-constant)
C:\Documents and Settings\Administrator\Desktop\Stunt World\gamemodes\SW.pwn(2252) : warning 215: expression has no effect
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Can you help me?
Reply
#2

Isn't an adminlevel usually in numbers?

pawn Код:
dini_GetInt
Reply
#3

It's impossible to check all accounts using dini (or any ini writer for that matter) without causing severe lag.

You'd need to have a file that contains a list of all registered accounts. Then you'd need to open that file, read one value and store it. Then use the value that was just stored to open a player's file. Retrieve the admin level variable, close the file. Repeat for each registered account (possibly 1000+).
Reply
#4

I have a better solution.

Why not storing admin names after /setadmin or /setlevel inside a separate file and then reading from there?

EDIT:

I mean it's absolute madness to read all player files on a server, where you could have like over 50,000 or 100,000 player files.

So upon /setadmin -> save name inside "/Admins.ini"
And upon /setadmin (id) 0 (DEMOTE) -> remove name inside "/Admins.ini"
Reply
#5

Ok, i'll try, thanks
Reply
#6

I like your idea rooper
Reply
#7

Quote:
Originally Posted by Chris'
Посмотреть сообщение
I like your idea rooper
I'm pleased that you like it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)