Not showing the name
#1

pawn Код:
new playername[MAX_PLAYER_NAME];
    new string[256];
        switch(reason)
      {
        case 0: format(string, sizeof(string), "%s has left the server. (Timeout)", playername);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", playername);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", playername);
      }
        ProxDetector(60.0, playerid, string, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
It just says has left the server.
How could i make it say the name?
Reply
#2

Use https://sampwiki.blast.hk/wiki/GetPlayerName
Reply
#3

Yeah what he said, so it must be this:

pawn Код:
new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof playername);
    new string[256];
        switch(reason)
      {
        case 0: format(string, sizeof(string), "%s has left the server. (Timeout)", playername);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", playername);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", playername);
      }
        ProxDetector(60.0, playerid, string, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY, COLOR_GREY);
Reply
#4

pawn Код:
new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername));
    new string[256];
        switch(reason)
      {
        case 0: format(string, sizeof(string), "%s has left the server. (Timeout)", playername);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", playername);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", playername);
      }
refixed
Reply
#5

Quote:
Originally Posted by KnooL
pawn Код:
new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername));
    new string[256];
        switch(reason)
      {
        case 0: format(string, sizeof(string), "%s has left the server. (Timeout)", playername);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", playername);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", playername);
      }
refixed
you actually don't need ( ) with sizeof since it's some compiler construct
Reply
#6

Thank you for the fast replies It works now, thanks again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)