/admin command
#1

how would i make a /admins command with this script? https://sampforum.blast.hk/showthread.php?tid=223963
Reply
#2

How is it that you've released 7 scripts, but you can't do such a simple thing as listing the administrators online in a server...?
Reply
#3

I'm not good with variables >.<
Reply
#4

Just about all of the scripts you've released use variables... Saying you're "not good with variables" isn't an excuse. You've released 7 scripts for crying out loud! You use a single variable with this script- it really isn't that hard...

pawn Код:
loop all players
if admin level > 0
send client message with admin name and level
It would literally take me 10 seconds to write a working /admins command.
Reply
#5

Код:
if(AdminLevel[playerid] >= 1)
Код:
if(AdminLevel[playerid] >= 2)
Код:
if(AdminLevel[playerid] >= 3)
Код:
if(AdminLevel[playerid] >= 4)
Код:
if(AdminLevel[playerid] >= 5)
Код:
if(AdminLevel[playerid] >= 1337)
I have the variables but I don't know anything about loops.
I just don't know what to do next. :/
Reply
#6

Something like this?

GetName Stock:

pawn Код:
stock GetName(playerid)
{
    new
    name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
pawn Код:
CMD:admins(playerid, params[])
{
    new count = 0, string[250];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
    if(IsPlayerConnected(i))
    {
    if(AdminLevel[i] == 1)
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 1:{32CD32} %s ", string, GetName(i));
    count++;
    }
    if(AdminLevel[i] == 2)
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 2:{32CD32} %s ", string, GetName(i));
    count++;
    }
    if(AdminLevel[i] == 3)
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 3:{32CD32} %s ", string, GetName(i));
    count++;
    }
    if(AdminLevel[i] == 4)
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 4:{32CD32} %s ", string, GetName(i));
    count++;
    }
    if(AdminLevel[i] == 5)
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 5:{32CD32} %s ", string, GetName(i));
    count++;
    }
    if(AdminLevel[i] == 1337)
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 1337:{32CD32} %s {E61A1A}[Server Owner]", string, GetName(i));
    count++;
    }
    }
    if(count == 0)
    {
    SendClientMessage(playerid, -1, "There is no Admins online!");
    }
    else
    {
    SendClientMessage(playerid, -1, "==========Online Admins============");
    SendClientMessage(playerid, -1, string);
    SendClientMessage(playerid, -1, "================================");
    }
    return 1;
}
Reply
#7

delete
Reply
#8

I am admin but it still shows "online admins" and doesn't say names or anything.

Код:
dcmd_admins(playerid, params[])
{
	#pragma unused params

	new count = 0, string[250];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
    if(IsPlayerConnected(i))
    {
    if(AdminLevel[playerid] >= 1)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 1:{32CD32} %s {E61A1A}[Trial Moderator]\n", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] >= 2)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 2:{32CD32} %s {E61A1A}[Moderator]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] >= 3)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 3:{32CD32} %s {E61A1A}[Administrator]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] >= 4)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 4:{32CD32} %s {E61A1A}[Head Administrator]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] >= 5)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 5:{32CD32} %s {E61A1A}[Server Co-Owner]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] >= 1337)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 1337:{32CD32} %s {E61A1A}[Server Owner]", string, GetName(i));
    count++;
    }
	}
    }
    if(count == 0)
    {
    SendClientMessage(playerid, -1, "There are no Admins online!");
    }
    else
    {
    SendClientMessage(playerid, -1, "==========Online Admins=========");
    SendClientMessage(playerid, -1, string);
    SendClientMessage(playerid, -1, "================================");
    }
	return 1;
}
Reply
#9

Check again my comment.
Reply
#10

Try this:

pawn Код:
dcmd_admins(playerid, params[])
{
    #pragma unused params

    new count = 0, string[250];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
    if(IsPlayerConnected(i))
    {
    if(AdminLevel[playerid] == 1)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 1:{32CD32} %s {E61A1A}[Trial Moderator]\n", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] == 2)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 2:{32CD32} %s {E61A1A}[Moderator]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] == 3)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 3:{32CD32} %s {E61A1A}[Administrator]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] == 4)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 4:{32CD32} %s {E61A1A}[Head Administrator]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] == 5)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 5:{32CD32} %s {E61A1A}[Server Co-Owner]", string, GetName(i));
    count++;
    }
    if(AdminLevel[playerid] == 1337)//Change this!
    {
    format(string, sizeof(string),"%s{09F709}Admin Level 1337:{32CD32} %s {E61A1A}[Server Owner]", string, GetName(i));
    count++;
    }
    }
    }
    if(count == 0)
    {
    SendClientMessage(playerid, -1, "There are no Admins online!");
    }
    else
    {
    SendClientMessage(playerid, -1, "==========Online Admins=========");
    SendClientMessage(playerid, -1, string);
    SendClientMessage(playerid, -1, "================================");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)