Help me with /admins command -
Knowinne - 22.10.2016
Hello !
I was just wondering about my error happening there. So, i decided to show it here.
Код:
CMD:admins(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
new AdmRank[128];
new AdmDuty[128];
new ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, green, "{5EFF00}___________ |- Online Admins -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] >= 1 && PlayerInfo[i][Hide] == 0)
{
if(IsPlayerAdmin(i))
{
AdmRank = "RCON Administrator";
ChangeColor = red;
}
else
{
switch(PlayerInfo[i][Level])
{
case 1: {
AdmRank = "Trial Moderator";
ChangeColor = COLOR_ORANGE;
}
case 2: {
AdmRank = "Junior Moderator";
ChangeColor = COLOR_GREEN1;
}
case 3: {
AdmRank = "Super Moderator";
ChangeColor = COLOR_YELLOW;
}
case 4: {
AdmRank = "Administrator";
ChangeColor = green;
}
case 5: {
AdmRank = "Supreme Administrator";
ChangeColor = COLOR_WHITE;
}
case 6: {
AdmRank = "Expert Administrator";
ChangeColor = COLOR_ROYALBLUE;
}
case 7: {
AdmRank = "Delta Administrator";
ChangeColor = red;
}
case 8: {
AdmRank = "Alfa Administrator";
ChangeColor = red;
}
}
}
switch(PlayerInfo[i][OnDuty])
{
case 0: AdmDuty = "Playing!";
case 1: AdmDuty = "Off Duty!";
case 2: AdmDuty = "AFK!";
}
if(PlayerInfo[i][OnDuty] == 0 || PlayerInfo[i][OnDuty] == 2) {
format(string, 128, "Level: %d - %s (Id:%i) | %s | {FF0000}%s",PlayerInfo[i][Level], GetName(i),i,AdmRank,AdmDuty);
SendClientMessage(playerid, ChangeColor, string);
count++;
}
if(PlayerInfo[i][OnDuty] == 1) {
format(string, 128, "Level: %d - %s (Id:%i) | %s | {5EFF00}%s",PlayerInfo[i][Level], GetName(i),i,AdmRank,AdmDuty);
SendClientMessage(playerid, ChangeColor, string);
count++;
}
}
}
}
if (count == 0)
SendClientMessage(playerid,red,"No admin online in the list");
SendClientMessage(playerid, green, "{5EFF00}________________________________________");
SendClientMessage(playerid, red, " ");
return 1;
}
stock GetName(playerid)
{
new name[24]; GetPlayerName(playerid, name, 24);
return name;
}
The error
Код:
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\samp037_svr_R2-1-1_win32\gamemodes\NFTDM[3z].pwn(2104) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
The 2104 line:
Код:
new name[24]; GetPlayerName(playerid, name, 24);
Hope you help me
Re: Help me with /admins command -
IceBilizard - 22.10.2016
try
PHP код:
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
Re: Help me with /admins command -
Knowinne - 22.10.2016
Same error.
Re: Help me with /admins command -
GoldenLion - 22.10.2016
The other one seems to compile well, too. Also you don't need to use stock keyword there.
By the way I suggest you to use foreach.
Re: Help me with /admins command -
Knowinne - 22.10.2016
So the correct code is... ?
Re: Help me with /admins command -
GoldenLion - 22.10.2016
Quote:
Originally Posted by Knowinne
So the correct code is... ?
|
No idea, there's nothing wrong with the GetName function. Are you sure that you aren't showing us some wrong code?
Re: Help me with /admins command -
Knowinne - 22.10.2016
Please, Look at the first thing, the /admins command. Please check it and tell me what's the wrong thing that i must fix.
Re: Help me with /admins command -
Knowinne - 22.10.2016
Fixed it! Just did this and changed something.
Код:
stock GetName(playerid)
{
new pname[24]; GetPlayerName(playerid, pname, sizeof(pname));
return pname;
}