Is can put all admins in one line? +Rep!! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is can put all admins in one line? +Rep!! (
/showthread.php?tid=365876)
Is can put all admins in one line? +Rep!! -
[M.A]Angel[M.A] - 04.08.2012
hello, i'v admin lux system but when i type /admins , every admin got his line asthis:
Admins: Player1(Manager)
Admins: Player2(Leader)
Admins: Player3(Manager)
..
..
etc
How to put all the admins in one line :
Admins: Player1(Manager),Player2(Leader),Player3(Manager). .etc
I 'v here my code:-
Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
new ChangeColor;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
{
if(AccInfo[i][Level] > 5)
{
AdmRank = "{00C0FF}Manager";
ChangeColor = Color_Professional_Admin;
}
if(IsPlayerAdmin(i))
{
AdmRank = "{6EF83C}Logged with Rcon";
ChangeColor = Color_RCON_Administrator;
}
else
{
switch(AccInfo[i][Level])
{
case 1: {
AdmRank = "{6EF83C}Trail Mod";
ChangeColor = Color_Basic_Moderator;
}
case 2: {
AdmRank = "{C3C3C3}Mod";
ChangeColor = Color_Moderator;
}
case 3: {
AdmRank = "{00C0FF}Admin";
ChangeColor = Color_Master_Moderator;
}
case 4: {
AdmRank = "{F3FF02}Leader";
ChangeColor = Color_Administrator;
}
case 5: {
AdmRank = "{C3C3C3}CO-Manager";
ChangeColor = Color_Master_Administrator;
}
}
}
switch(AccInfo[i][OnDuty])
{
case 0: AdmDuty = "Playing!";
case 1: AdmDuty = "On Duty!";
}
format(string, 128, "Admins: {F81414}%s {F81414}[%s{F81414}]",PlayerName2(i),AdmRank);
SendClientMessage(playerid, ChangeColor, string);
count++;
}
}
}
if (count == 0)
SendClientMessage(playerid,orange,"{C77D87}No {F3FF02}Administrators {C77D87}online {FFFFFF},{C77D87}Try to invite {F3FF02}them!");
return 1;
}
Anyone can help got +rep!
Re: Is can put all admins in one line? +Rep!! -
Ranama - 04.08.2012
You should be able to do it like this:
use strcat to take the admin names together:
pawn Код:
dcmd_admins(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
new ChangeColor;
new wholestring[126];//new string here to have all the admin names in it
format(wholestring, sizeof(wholestring), "Admins: ");//just doing this to set the Admins: in start of the line
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(AccInfo[i][Level] >= 1 && AccInfo[i][Hide] == 0)
{
if(AccInfo[i][Level] > 5)
{
AdmRank = "{00C0FF}Manager";
ChangeColor = Color_Professional_Admin;
}
if(IsPlayerAdmin(i))
{
AdmRank = "{6EF83C}Logged with Rcon";
ChangeColor = Color_RCON_Administrator;
}
else
{
switch(AccInfo[i][Level])
{
case 1: {
AdmRank = "{6EF83C}Trail Mod";
ChangeColor = Color_Basic_Moderator;
}
case 2: {
AdmRank = "{C3C3C3}Mod";
ChangeColor = Color_Moderator;
}
case 3: {
AdmRank = "{00C0FF}Admin";
ChangeColor = Color_Master_Moderator;
}
case 4: {
AdmRank = "{F3FF02}Leader";
ChangeColor = Color_Administrator;
}
case 5: {
AdmRank = "{C3C3C3}CO-Manager";
ChangeColor = Color_Master_Administrator;
}
}
}
switch(AccInfo[i][OnDuty])
{
case 0: AdmDuty = "Playing!";
case 1: AdmDuty = "On Duty!";
}
format(string, 128, "{F81414}%s {F81414}[%s{F81414}]",PlayerName2(i),AdmRank);
strcat(wholestring, string, sizeof(wholestring));//here i add the string from the loop to the wholestring
count++;
}
}
}
if (count == 0)
SendClientMessage(playerid,orange,"{C77D87}No {F3FF02}Administrators {C77D87}online {FFFFFF},{C77D87}Try to invite {F3FF02}them!");
else{
SendClientMessage(playerid, COLOR_YELLOW, wholestring);//and here i send the message wholestring :D
}
return 1;
}
I think that should work, (not tested)
Hope I helped