Admin Chat
#1

in game when i join it say

Example:

Martex [0][Admin: 10]: test
Martex [0]: test

i want if player admin only use the first one

and normal player the second one

Codes here:

PHP код:
        if(User[playerid][accountAdmin] > 1)
        {
            new 
stringbig[213];
            
format(stringbig,sizeof(stringbig),"%s [Admin: %d][%d]: {FF0000}%s",pName(playerid),User[playerid][accountAdmin],playeridtext);
              
SendClientMessageToAll(playerid,stringbig);
              }
              else
              {
            new 
stringbig[213];
            
format(stringbig,sizeof(stringbig),"[%d]: {FFFFFF}%s",playeridtext);
              
SendPlayerMessageToAll(playerid,stringbig);
        } 
Reply
#2

not confirm but try this

Codes here:

PHP код:
        if(User[playerid][accountAdmin] > 1)
        {
            new 
stringbig[213];
            
format(stringbig,sizeof(stringbig),"%s [Admin: %d][%d]: {FF0000}%s",pName(playerid),User[playerid][accountAdmin],playeridtext);
              
SendClientMessageToAll(playerid,stringbig);
              }
               if(
User[playerid][accountAdmin] > 0)
              else
              {
                new 
stringbig[213];
            
format(stringbig,sizeof(stringbig),"[%d]: {FFFFFF}%s",playeridtext);
              
SendPlayerMessageToAll(playerid,stringbig);
        } 
Reply
#3

Here's what I would do:

pawn Код:
new stringbig[213];
switch(User[playerid][accountAdmin]) // Use a 'switch' statement to get the variable.
{
    case 0: format(stringbig, sizeof(stringbig), "%s [Admin: %d][%d]: {FF0000}%s", pName(playerid), User[playerid][accountAdmin], playerid, text); // If their accountAdmin variable is 0
    default: format(stringbig, sizeof(stringbig), "[%d]: {FFFFFF}%s", playerid, text); // If their accountAdmin variable is anything but 0.
}
SendPlayerMessageToAll(-1, stringbig);
Reply
#4

PHP код:
if(User[playerid][accountAdmin] > 1
        { 
            new 
stringbig[213]; 
            
format(stringbig,sizeof(stringbig),"%s [Admin: %d][%d]: {FF0000}%s",pName(playerid),User[playerid][accountAdmin],playeridtext); 
              
SendClientMessageToAll(-1,stringbig); 
              } 
              else 
              { 
            new 
stringbig[213]; 
            
format(stringbig,sizeof(stringbig),"[%d]: {FFFFFF}%s",playeridtext); 
              
SendPlayerMessageToAll(-1,stringbig); 
        } 
Reply
#5

Код:
stock GetAdminRank(playerid)
{
	new arank[64];
	switch(pInfo[playerid][Admin])
	{
		case 99999: arank = "Community Owner";
        case 99998: arank = "Co-Community Owner";
		case 1337: arank = "Management";
		case 4: arank = "Head Admin";
		case 3: arank = "General Admin";
		case 2: arank = "Junior Admin";
		case 1: arank = "Server Moderator";
		case 0: arank = "Player";
	}
	return arank;
}
add this then in the chat line just do this
Код:
format(stringbig,sizeof(stringbig),"%s %s: {FF0000}%s",pName(playerid), GetAdminRank(playerid),User[playerid],playerid, text); 
SendClientMessageToAll(playerid,stringbig)
put them in your own order though ofcourse which ever way round you want them
Reply
#6

you would only need them to lines you wouldnt need to put them more than once
Reply
#7

Код:
	if(text[0] == '#' && pInfo[playerid][Admin] >= 1)
	{
	    format(strg, sizeof(strg), "(Admin Chat) %s: %s", GetName(playerid), text[1]);
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
		    if(IsPlayerConnected(i))
		    {
		        if(pInfo[i][Admin] >= 1)
		        {
		            SendClientMessage(i, 0xFF00DD, strg);
		        }
		    }
		}
	    return 0;
	}
that's what i used for my admin chat sorry if it didnt help
Reply
#8

PHP код:
if(User[playerid][accountAdmin] > 1
        { 
            new 
stringbig[213]; 
            
format(stringbig,sizeof(stringbig),"%s [Admin: %d][%d]: {FF0000}%s",pName(playerid),User[playerid][accountAdmin],playeridtext); 
              
SendClientMessageToAll(playerid,stringbig); 
              } 
Only this one is required since if the player is a normal player, it'll auto-trigger the second text.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)