[HELP] GetPlayerName Problem
#1

I want the
pawn Код:
format(string, sizeof(string), "%s(%d) did set %s(%d)'s armour to %d",name, playerid, name, playerid, inputtext); //i want it like: [Lvrcr]Larsey123(0) did set RandomName(1)'s armour to 10
                SendClientMessageToAll(0xFFFF00AA, string);
only show for admins


pawn Код:
case 2:
            {
                if(strlen(inputtext) > 3)
                    return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: Your message was too long. Max: 3 characters");

                new name[MAX_PLAYER_NAME], string[44];
                GetPlayerName(adminPlayer[playerid], name, sizeof(name));
                format(string, sizeof(string), "%s(%d) did set %s(%d)'s armour to %d",name, playerid, name, playerid, inputtext); //i want it like: [Lvrcr]Larsey123(0) did set RandomName(1)'s armour to 10
                SendClientMessageToAll(0xFFFF00AA, string);

                SetPlayerHealth(adminPlayer[playerid], floatstr(inputtext));
                adminPlayer[playerid] = 0;
            }
Reply
#2

Add on end of your script:

pawn Код:
forward AdminMessage(color, const string[]);
public AdminMessage(color, const string[])
{
   for(new adm; adm < sizeof(MAX_PLAYERS); adm++)
   {
      if(IsPlayerConnected(adm))
      {
         if(PlayerInfo[adm][pAdmin] > 0 || IsPlayerAdmin(playerid)) // Change PlayerInfo[..][..] to your variable for admin levels.
         {
            SendClientMessage(playerid, color, string);
            printf("%s", string);
         }
      }
   }
   return 1;
}


pawn Код:
case 2:
            {
                if(strlen(inputtext) > 3)
                    return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: Your message was too long. Max: 3 characters");

                new name[MAX_PLAYER_NAME], string[44];
                GetPlayerName(adminPlayer[playerid], name, sizeof(name));
                format(string, sizeof(string), "%s(%d) did set %s(%d)'s armour to %d",name, playerid, name, playerid, inputtext); //i want it like: [Lvrcr]Larsey123(0) did set RandomName(1)'s armour to 10
                AdminMessage(0xFFFF00AA, string);

                SetPlayerHealth(adminPlayer[playerid], floatstr(inputtext));
                adminPlayer[playerid] = 0;
            }
Reply
#3

REMOVED(POSTED TO WRONG TOPIC)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)