/admins help
#1

how can i make this to dcmd

Quote:

COMMAND:admins(playerid, params[])
{
new iname[MAX_PLAYER_NAME], string[180], count=0;
SendClientMessage(playerid, AdminColor, "List of online admins:");
for(new i; i < MAX_PLAYERS; i++)
{
if(level[i] >= 1)
{
GetPlayerName(i, iname, sizeof(iname));
format(string, sizeof(string), "%s [Level: %i]",iname,level[i]);
SendClientMessage(playerid, AdminColor, string);
count++;
}
}
if(count==0) SendClientMessage(playerid, AdminColor, "No Online Admins.");
return 1;
}

I just did this but didnt work, gave me alot of errors..

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
dcmd(admins, 6, cmdtext);
return 0;
}

dcmd_admins{playerid, params[]}
{
new iname[MAX_PLAYER_NAME], string[180], count=0;
SendClientMessage(playerid, AdminColor, "List of online admins:");
for(new i; i < MAX_PLAYERS; i++)
{
if(level[i] >= 1)
{
GetPlayerName(i, iname, sizeof(iname));
format(string, sizeof(string), " %s Level: %i",iname,level[i]);
SendClientMessage(playerid, AdminColor, string);
count++;
}
}
if(count==0) SendClientMessage(playerid, AdminColor, "No admins online.");
return 1;
}

Also tell me how you do it so I learn thanks
Reply
#2

What errors? And btw, please use [pawn] tags in stead of [quote]
Reply
#3

[quote=Jochemd;986066]What errors? And btw, please use [pawn] tags in stead of
Quote:

Sorry, i will from now on

pawn Код:
E:\GTA San Andreas\Server\pawno\include\dini.inc(239) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(28) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(132) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(172) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(280) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(318) : warning 219: local variable "count" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(337) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(337) : warning 219: local variable "count" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\dutils.inc(379) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\Double-O-Files.inc(131) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\pawno\include\Double-O-Files.inc(613) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(154) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(181) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(188) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(211) : warning 219: local variable "string" shadows a variable at a preceding level
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(227) : error 017: undefined symbol "dcmd"
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(227) : error 017: undefined symbol "admins"
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(227) : error 010: invalid function or declaration
E:\GTA San Andreas\Server\gamemodes\Kopi (2) af DM.pwn(227) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
why do I get these undefines symbols with dcmd What did I do wrong with dcmd ?
Reply
#4

pawn Код:
dcmd_admins(playerid, params[])
{
    new iname[MAX_PLAYER_NAME], string[180], count=0;
    SendClientMessage(playerid, AdminColor, "List of online admins:");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(level[i] >= 1)
        {
            GetPlayerName(i, iname, sizeof(iname));
            format(string, sizeof(string), " %s Level: %i",iname,level[i]);
            SendClientMessage(playerid, AdminColor, string);
            count++;
        }      
    }
    if(count==0) SendClientMessage(playerid, AdminColor, "No admins online.");
    return 1;
}
You did:
pawn Код:
dcmd_admins{playerid,params[]}
Should be:
pawn Код:
dcmd_admins(playerid,params[])
Reply
#5

Works!!! I know the problem what I did about that now Thanks alot mate, though i had to use #pragma unused params to prevent that warning

once again thank you !
Reply
#6

You're welcome :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)