CMD:admins(playerid, params[])
{
if(PlayerInfo[playerid][LoggedIn]) return SendClientMessage(playerid, COLOR_GREY, "NOTLOGGED");
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " ");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "----------| Online Admins |----------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Level] > 0)
{
}
if(IsPlayerConnected(i))
{
new aname[48], atitle[48];
if(PlayerInfo[i][Level] == 7) { atitle = "Owner"; }
if(PlayerInfo[i][Level] == 6) { atitle = "Moderator"; }
if(PlayerInfo[i][Level] == 5) { atitle = "Lead Administrator"; }
if(PlayerInfo[i][Level] == 4) { atitle = "Senior Administrator"; }
if(PlayerInfo[i][Level] == 3) { atitle = "Administrator"; }
if(PlayerInfo[i][Level] == 2) { atitle = "Junior Administrator"; }
if(PlayerInfo[i][Level] == 1) { atitle = "Trial Administrator"; }
GetPlayerName(i, aname, sizeof(aname));
/* if(!AdminDuty[i])
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: No)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);
}
else
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: Yes)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);*/
}
continue;
}
}
}
E:\Desktop\SA-MP\New folder\gamemodes\SATDMv9.pwn(14674) : warning 209: function "cmd_admins" should return a value Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning. |
CMD:admins(playerid, params[])
{
if(PlayerInfo[playerid][LoggedIn] == 0) //this line is changed
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, " ");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "----------| Online Admins |----------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Level] > 0)
{
}
if(IsPlayerConnected(i))
{
new aname[48], atitle[48];
if(PlayerInfo[i][Level] == 7) { atitle = "Owner"; }
if(PlayerInfo[i][Level] == 6) { atitle = "Moderator"; }
if(PlayerInfo[i][Level] == 5) { atitle = "Lead Administrator"; }
if(PlayerInfo[i][Level] == 4) { atitle = "Senior Administrator"; }
if(PlayerInfo[i][Level] == 3) { atitle = "Administrator"; }
if(PlayerInfo[i][Level] == 2) { atitle = "Junior Administrator"; }
if(PlayerInfo[i][Level] == 1) { atitle = "Trial Administrator"; }
GetPlayerName(i, aname, sizeof(aname));
/* if(!AdminDuty[i])
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: No)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);
}
else
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: Yes)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);*/
}
continue;
}
}
}
"cmd_admins should return a value"
"return a value" "return" Add return 1; to the end. |
E:\Desktop\SA-MP\New folder\gamemodes\SATDMv9.pwn(14675) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. |
CMD:admins(playerid, params[])
{
if(PlayerInfo[playerid][LoggedIn]) return SendClientMessage(playerid, COLOR_GREY, "NOTLOGGED");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "----------| Online Admins |----------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new aname[48], atitle[48];
if(PlayerInfo[i][Level] == 7) { atitle = "Owner"; }
else if(PlayerInfo[i][Level] == 6) { atitle = "Moderator"; }
else if(PlayerInfo[i][Level] == 5) { atitle = "Lead Administrator"; }
else if(PlayerInfo[i][Level] == 4) { atitle = "Senior Administrator"; }
else if(PlayerInfo[i][Level] == 3) { atitle = "Administrator"; }
else if(PlayerInfo[i][Level] == 2) { atitle = "Junior Administrator"; }
else if(PlayerInfo[i][Level] == 1) { atitle = "Trial Administrator"; }
GetPlayerName(i, aname, sizeof(aname));
if(AdminDuty[i] == 1)
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: No)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);
}
else
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: Yes)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);*/
return 1;
}
}
}
return 1;
}
Try this? I didn't test it.
pawn Код:
|
if(AdminDuty[i] == 1)
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: No)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);
}
else
{
format(string, sizeof(string), "[*] [%s] %s (Admin duty: Yes)", atitle, aname);
SendClientMessage(playerid, COLOR_LBLUE, string);*/
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1) // By ******
CMD:admins(playerid, params[])
{
if(!PlayerInfo[playerid][LoggedIn]) return SendClientMessage(playerid, COLOR_GREY, "NOTLOGGED");
// How can the player that entered the command not be connected? (removed if (IsPlayerConnect(playerid)))
SendClientMessage(playerid, COLOR_LIGHTBLUE, " ");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "----------| Online Admins |----------");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][Level] > 0)
{
if(IsPlayerConnected(i))
{
new atitle[48], string[128], pName[24];
GetPlayerName(playerid, pName, sizeof (pName));
switch (PlayerInfo[i][Level])
{
case 1: strcpy(atitle, "Trial Administrator");
case 2: strcpy(atitle, "Junior Administrator");
case 3: strcpy(atitle, "Administrator");
case 4: strcpy(atitle, "Senior Administrator");
case 5: strcpy(atitle, "Lead Administrator");
case 6: strcpy(atitle, "Moderator");
case 7: strcpy(atitle, "Owner");
}
format(string, sizeof (string), "%s [level %i] [%s]", pName, PlayerInfo[playerid][Level], atitle);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
return 1;
}
pawn Код:
|
----------| Online Admins |---------- Pete [Level 7] [Senior Administrator] Pete [Level 7] [Owner] |
format(string, sizeof (string), "%s [level %i] [%s]", pName, PlayerInfo[playerid][Level], atitle);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GetPlayerName(playerid, pName, sizeof (pName));
It's simple really, you're returning the name of the user using the cmd use GetPlayerName(i, pName, sizeof(pName)); and change PlayerInfo[i][pLevel], basically replace the parts with playerid with i within reason. |