Advertisement
Kwarde

PlayerName include

Jul 4th, 2011
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.17 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #if defined _playername_included
  4.     #endinput
  5. #endif
  6. #define _playername_included
  7.  
  8. #if MAX_PLAYERS == 500 //If MAX_PLAYER is changed already in a_samp, don't change it back to 500 ;)
  9.     #undef MAX_PLAYERS
  10.     #define MAX_PLAYERS 500 //Optional: Change this to the max players of your server for better perfomance.
  11. #endif
  12.  
  13. new playerName[MAX_PLAYERS][MAX_PLAYER_NAME];
  14. forward _PNAME_PlayerConnect(playerid);
  15.  
  16. public OnPlayerConnect(playerid)
  17. {
  18.     GetPlayerName(playerid, playerName[playerid], MAX_PLAYER_NAME);
  19.     return 1;
  20. }
  21. #if defined _ALS_OnPlayerConnect
  22.     #undef OnPlayerConnect
  23. #else
  24.     #define _ALS_OnPlayerConnect
  25. #endif
  26. #define OnPlayerConnect _PNAME_PlayerConnect
  27.  
  28. stock NewName(playerid, const name[])
  29. {
  30.     new str[MAX_PLAYER_NAME];
  31.     format(str, MAX_PLAYER_NAME, "x_%03d_", playerid);
  32.     SetPlayerName(playerid, str); //Eg. if you have the name 'kwarde' and you want 'Kwarde', normal SetPlayerName won't work. This'll fix it
  33.     SetPlayerName(playerid, name);
  34.     GetPlayerName(playerid, playerName[playerid], MAX_PLAYER_NAME);
  35.     return 1;
  36. }
  37. #define SetPlayerName NewName
  38.  
  39. stock PlayerName(playerid)
  40.     return playerName[playerid];
  41. #define Name PlayerName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement