1 error
#1

Код:
C:\Users\pawno\include\PPC_PlayerCommands.inc(5081) : error 017: undefined symbol "name"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
CMD:admins(playerid, params[])
{
    new Count;
    new str[45], Admin[MAX_PLAYER_NAME];
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if (APlayerData[i][PlayerLevel] >= 1) // replace with ur variable
        {
            Count++;
            GetPlayerName(i, Admin, MAX_PLAYER_NAME);
            SendClientMessage(playerid, -1, "Current Administrators Online");
            if(!IsOnAdminDuty[i]) format(str, sizeof(str), "Level%d-%s", name, i,APlayerData[i][PlayerLevel]);
            else if(IsOnAdminDuty[i]) format(str, sizeof(str), "Level %d - %s (On Duty)", APlayerData[i][PlayerLevel], Admin);
            SendClientMessage(playerid, -1, str);
        }
    }
    if(Count < 1) SendClientMessage(playerid, -1, "No Administrators Online!");
    return 1;
}
Reply
#2

Try this:
pawn Код:
CMD:admins(playerid)
{
    new Count;
    new str[45], Admin[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if (APlayerData[i][PlayerLevel] >= 1) // replace with ur variable
        {
            Count ++;
            GetPlayerName(i, Admin, MAX_PLAYER_NAME);
            SendClientMessage(playerid, -1, "Current Administrators Online");
            if(!IsOnAdminDuty[i]) format(str, sizeof str, "Level %d - %s", i, APlayerData[i][PlayerLevel]);
            else if(IsOnAdminDuty[i]) format(str, sizeof(str), "Level %d - %s (On Duty)", APlayerData[i][PlayerLevel], Admin);
            SendClientMessage(playerid, -1, str);
        }
    }
    if(Count < 1) SendClientMessage(playerid, -1, "No Administrators Online!");
    return 1;
}
Reply
#3

it say Level 0- i dont wanna the level number just the name like dis Owner-Admin
Reply
#4

That's a missing variable..
change "name" variable to "Admin"

read here.. This will help you to fix error yourself https://sampwiki.blast.hk/wiki/Undefined_symbol
Reply
#5

You must create a function like this:
pawn Код:
stock LevelName(playerid)
{
    new StringLevel[128];
    switch(APlayerData[i][PlayerLevel])
    {
        case 1: StringLevel = "WTF 1";
        case 2: StringLevel = "WTF 2";
        case 3: StringLevel = "WTF 3";
        case 4: StringLevel = "WTF 4";
        case 5: StringLevel = "WTF 5";
    }
    return StringLevel;
}
And the command would be:
pawn Код:
CMD:admins(playerid)
{
    new Count;
    new str[45], Admin[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if (APlayerData[i][PlayerLevel] >= 1) // replace with ur variable
        {
            Count ++;
            GetPlayerName(i, Admin, MAX_PLAYER_NAME);
            SendClientMessage(playerid, -1, "Current Administrators Online");
            if(!IsOnAdminDuty[i]) format(str, sizeof str, "Admin  %s - %s", Admin, LevelName(i));
            else if(IsOnAdminDuty[i]) format(str, sizeof(str), "Admin  %s - %s (On Duty)", Admin, LevelName(i));
            SendClientMessage(playerid, -1, str);
        }
    }
    if(Count < 1) SendClientMessage(playerid, -1, "No Administrators Online!");
    return 1;
}
Reply
#6

How to make it say Owner-admin not numbers like 5
Код:
CMD:admins(playerid, params[])
{
    new Count;
    new str[45], Admin[MAX_PLAYER_NAME];
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
        if (APlayerData[i][PlayerLevel] >= 1) // replace with ur variable
        {
            Count++;
            GetPlayerName(i, Admin, MAX_PLAYER_NAME);
            SendClientMessage(playerid, -1, "Current Administrators Online");
            if(!IsOnAdminDuty[i]) format(str, sizeof(str), "Level%d-%s", APlayerData[i][PlayerLevel], Admin);
            else if(IsOnAdminDuty[i]) format(str, sizeof(str), "Level %d - %s (On Duty)", APlayerData[i][PlayerLevel], Admin);
            SendClientMessage(playerid, -1, str);
        }
    }
    if(Count < 1) SendClientMessage(playerid, -1, "No Administrators Online!");
    return 1;
}
Reply
#7

Код:
C:\Users\gamemodes\PPC_Trucking.pwn(1536) : error 017: undefined symbol "i"
C:\Users\gamemodes\PPC_Trucking.pwn(1533) : warning 203: symbol is never used: "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

You change this cases in my function:
pawn Код:
case 1: StringLevel = "WTF 1";
case 2: StringLevel = "WTF 2";
case 3: StringLevel = "WTF 3";
case 4: StringLevel = "WTF 4";
case 5: StringLevel = "WTF 5";
To the admin names/grades and add if you have more...
The case is the level
Reply
#9

To not make it say "WTF5", edit the case.

http://wiki.amxmodx.org/Pawn_Tutorial#Switch_Statements
Reply
#10

Код:
// Holds the admin-levelnames
new AdminLevelName[6][24] =
{
	{"Player"}, // Admin-level 0
	{"Moderator"}, // Admin-level 1
	{"Helper-admin"}, // Admin-level 2
	{"Admin"}, // Admin-level 3
	{"Head-admin"}, // Admin-level 4
        {"Owner-admin"} // Admin-level 5
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)