String Colour - 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: String Colour (
/showthread.php?tid=628688)
String Colour -
Speaker - 13.02.2017
Код:
//===================================Admins Colors=========================================//
#define Color_Server_Owner 0xAA3333AA //Level 7
#define Color_Management_Admin 0x800080AA //Level 6
#define Color_Head_Admin 0x33CCFFAA //Level 5
#define Color_Lead_Admin 0x33AA33AA //Level 4
#define Color_Administrator_Admin 0x24FF0AB9 //Level 3
#define Color_Junior_Admin 0x00F6F6FF //Level 2
#define Color_Trial_Admin 0xFFFF00AA //Level 1
//=============================================================================================//
CMD:admins(playerid,params[])
{
new count = 0, string[256], AdmRank[500];
SendClientMessage(playerid,red,"");
new ChangeColor;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] > 0)
{
if(PlayerInfo[i][Level] == 1)
{
AdmRank = "Community Trial Admin";
ChangeColor = Color_Trial_Admin;
}
else if(PlayerInfo[i][Level] == 2)
{
AdmRank = "Community Junior Admin";
ChangeColor = Color_Junior_Admin;
}
else if(PlayerInfo[i][Level] == 3)
{
AdmRank = "Community Administrator";
ChangeColor = Color_Administrator_Admin;
}
else if(PlayerInfo[i][Level] == 4)
{
AdmRank = "Community Lead Admin";
ChangeColor = Color_Lead_Admin;
}
else if(PlayerInfo[i][Level] == 5)
{
AdmRank = "Community Head Admin";
ChangeColor = Color_Head_Admin;
}
else if(PlayerInfo[i][Level] == 6)
{
AdmRank = "Community Management";
ChangeColor = Color_Management_Admin;
}
else if(PlayerInfo[i][Level] >= 7)
{
AdmRank = "Community Owner";
ChangeColor = Color_Server_Owner;
}
new Name[MAX_PLAYER_NAME];
GetPlayerName(i,Name,sizeof(Name));
{
format(string, sizeof(string), "Level: %d | Name: %s (ID:%i) | Rank: %s", PlayerInfo[i][Level], Name, i, AdmRank);
ShowPlayerDialog(playerid, DIALOG_ADMIN, DIALOG_STYLE_MSGBOX, "{FF6600}Online Admins", string, "Close", "");
count++;
}
}
}
}
if(count == 0)
ShowPlayerDialog(playerid, DIALOG_ADMIN, DIALOG_STYLE_MSGBOX, "{FF6600}Online Admins", "No Administrator Online", "Close", "");
return 1;
}
I Want to make the message in the dialog with the ChangeColour
Like If I Am Level 7 Admin Then It Should Show All The Text In The Colour Of Admin Level 7
Respuesta: String Colour -
Eloy - 13.02.2017
Example:
PHP код:
new AdminsRangos[9][30] = {
{"{23FF00}Owned Level (1)"},
{"{23C100}Owned Level (2)"},
{"{238900}Owned Level (3)"},
{"{FFDD00}Owned Level (4)"},
{"{FF9600}Owned Level (5)"},
{"{0019FF}Owned Global (6)"},
{"{FF3C00}Owned Co-Admin (7)"},
{"{FF1E00}Owned Admin (8)"},
{"{000000}Owned Leader "}
};
YCMD:staff(playerid, params[], help)
{
new MsgAdminsOn[100], FoundAdmin;
foreach(new i : Player)
{
if (PlayerDataOnline[i][IsLoggedIn] == true && PlayerInfo[i][Admin])
{
if ( !FoundAdmin )
{
SendClientMessage(playerid, 0x505050FF, "{505050}»»»»»»»»»»»»»»»»»» {008228}S{00B428}taff {008228}O{00B428}nline {505050}««««««««««««««««««");
FoundAdmin++;
}
format(MsgAdminsOn, sizeof(MsgAdminsOn), "{0037FF}* %s %s[%i]", AdminsRangos[PlayerInfo[i][Admin] - 1], GetName(i), i);
SendClientMessage(playerid, 0x505050FF, MsgAdminsOn);
}
}
if ( !FoundAdmin )
{
SendClientMessage(playerid, 0x505050FF, "{910000}»»»»»»»»»»»»» {E10000}No Member Staff Online {910000}«««««««««««««");
}
return 1;
}
Edit:
Function GetName(playerid)
PHP код:
GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name
}