why it shows only 1 admin ;( -
KillerStrike23 - 17.04.2014
pawn Код:
CMD:ksadmins(playerid,params[]){
#pragma unused params
new Count = 0;
new n[MAX_PLAYER_NAME];
new string[1000];
new AdmRank[40];
new ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, blue, "___________ |- Online KS Members -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
switch(PlayerInfo[i][KsLevel])
{
case 1:
{
AdmRank = "Newest Member";
ChangeColor = blue;
}
case 2:
{
AdmRank = "Junior Member";
ChangeColor = blue;
}
case 3:
{
AdmRank = "Executive Member";
ChangeColor = blue;
}
case 4:
{
AdmRank = "Senior Member";
ChangeColor = blue;
}
case 5:
{
AdmRank = "Head Member";
ChangeColor = blue;
}
case 6:
{
AdmRank = "Lieutenant";
ChangeColor = blue;
}
case 7:
{
AdmRank = "General";
ChangeColor = blue;
}
case 8:
{
AdmRank = "Leader";
ChangeColor = red;
}
}
if(!IsPlayerConnected(i)) continue;
if(PlayerInfo[i][KsLevel] < 1) continue;
GetPlayerName(i,n,sizeof(n));
format(string, 128, "Rank: %d - %s (Id:%i) | %s |", PlayerInfo[i][KsLevel], n, i, AdmRank);
Count++;}
if(Count == 0)
{
SendClientMessage(playerid, red, "no online KS members");
SendClientMessage(playerid, blue, " _______________________________________");
return 1;
}
SendClientMessage(playerid, ChangeColor, string);
SendClientMessage(playerid, blue, " _______________________________________");
return 1;}
Re: why it shows only 1 admin ;( -
PrivatioBoni - 17.04.2014
Could you indent properly and put it in [pawn] tags? Would be much easier to read.
Re: why it shows only 1 admin ;( -
KillerStrike23 - 17.04.2014
okey now can you help me ?
Re: why it shows only 1 admin ;( -
awsomedude - 17.04.2014
Try this:
pawn Код:
CMD:ksadmins(playerid,params[])
{
new Count=0,Name[MAX_PLAYER_NAME],string[128],AdmRank,ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, blue, "___________ |- Online KS Members -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][KsLevel] > 0 && IsPlayerConnected(i))
{
switch(PlayerInfo[i][KsLevel])
{
case 1:
{
AdmRank = "Newest Member";
ChangeColor = blue;
}
case 2:
{
AdmRank = "Junior Member";
ChangeColor = blue;
}
case 3:
{
AdmRank = "Executive Member";
ChangeColor = blue;
}
case 4:
{
AdmRank = "Senior Member";
ChangeColor = blue;
}
case 5:
{
AdmRank = "Head Member";
ChangeColor = blue;
}
case 6:
{
AdmRank = "Lieutenant";
ChangeColor = blue;
}
case 7:
{
AdmRank = "General";
ChangeColor = blue;
}
case 8:
{
AdmRank = "Leader";
ChangeColor = red;
}
}
GetPlayerName(i,Name,sizeof(Name));
format(string, 128, "Rank: %d - %s (Id:%i) | %s |", PlayerInfo[i][KsLevel], Name, i, AdmRank);
SendClientMessage(playerid, ChangeColor, string);
Count++;
}
}
if(Count == 0)
{
SendClientMessage(playerid, red, "No online KS members");
return 1;
}
SendClientMessage(playerid, blue, " _______________________________________");
return 1;
}
Re: why it shows only 1 admin ;( -
gtakillerIV - 17.04.2014
Because you're formatting the string over and over again instead of adding more lines to it. Use
Strcat instead.
Re: why it shows only 1 admin ;( -
KillerStrike23 - 17.04.2014
can you show da code please ?
Re: why it shows only 1 admin ;( -
awsomedude - 17.04.2014
Have you tested my code?
Re: why it shows only 1 admin ;( -
KillerStrike23 - 17.04.2014
sorry dude but I got those errors ;(
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(1616
: warning 219: local variable "Name" shadows a variable at a preceding level
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16180) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16185) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16190) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16195) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16200) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16205) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16210) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16215) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16219) : error 035: argument type mismatch (argument 2)
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16219) : error 035: argument type mismatch (argument 2)
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16220) : warning 213: tag mismatch
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(1616
: warning 204: symbol is assigned a value that is never used: "Name"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: why it shows only 1 admin ;( -
awsomedude - 17.04.2014
Try now
pawn Код:
CMD:ksadmins(playerid,params[])
{
new Count=0,n[MAX_PLAYER_NAME],string[128],AdmRank,ChangeColor;
SendClientMessage(playerid, green, " ");
SendClientMessage(playerid, blue, "___________ |- Online KS Members -| ___________");
SendClientMessage(playerid, green, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][KsLevel] > 0 && IsPlayerConnected(i))
{
switch(PlayerInfo[i][KsLevel])
{
case 1:
{
AdmRank = "Newest Member";
ChangeColor = blue;
}
case 2:
{
AdmRank = "Junior Member";
ChangeColor = blue;
}
case 3:
{
AdmRank = "Executive Member";
ChangeColor = blue;
}
case 4:
{
AdmRank = "Senior Member";
ChangeColor = blue;
}
case 5:
{
AdmRank = "Head Member";
ChangeColor = blue;
}
case 6:
{
AdmRank = "Lieutenant";
ChangeColor = blue;
}
case 7:
{
AdmRank = "General";
ChangeColor = blue;
}
case 8:
{
AdmRank = "Leader";
ChangeColor = red;
}
}
GetPlayerName(i,n,sizeof(n));
format(string, 128, "Rank: %d - %s (Id:%i) | %s |", PlayerInfo[i][KsLevel], n, i, AdmRank);
SendClientMessage(playerid, ChangeColor, string);
Count++;
}
}
if(Count == 0)
{
SendClientMessage(playerid, red, "No online KS members");
}
SendClientMessage(playerid, blue, " _______________________________________");
return 1;
}
Re: why it shows only 1 admin ;( -
KillerStrike23 - 18.04.2014
;( :
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16179) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16184) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16189) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16194) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16199) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16204) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16209) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16214) : error 006: must be assigned to an array
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(16224) : warning 217: loose indentation
C:\Users\kamal\Desktop\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(1622
: warning 217: loose indentation