Advertisement
Guest User

Name Tags By: Dry

a guest
Jan 27th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.40 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <zcmd>
  4. #include <sscanf>
  5.  
  6. #define cPadrao 0xE9433FFF
  7.  
  8. #define MAX_CHAR 5
  9. #define LOCAL_TAGCONF "Tags/config.ini"
  10.  
  11. CheckPrefix(playerid)
  12. {
  13.     new pref[16], Name[MAX_PLAYER_NAME];
  14.     GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  15.     format ( pref, sizeof ( pref ), dini_Get(LOCAL_TAGCONF, Name));
  16.     return pref;
  17. }
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     if ( !fexist(LOCAL_TAGCONF))
  22.     {
  23.         dini_Create(LOCAL_TAGCONF);
  24.         if ( !fexist(LOCAL_TAGCONF))
  25.         {
  26.             print("Config.ini nao pode ser criado. ( Diretorio Inexistente )");
  27.             print("No diretorio scriptfiles crie uma pasta: TAGS");
  28.             return 1;
  29.         }
  30.     }
  31.     return 1;
  32. }
  33.  
  34. CMD:setprefix(playerid, params[])
  35. {
  36.     if ( !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, cPadrao, "Você precisar ser um admin para usar isso.");
  37.     new ide, prefix[16];
  38.     if ( sscanf ( params, "us", ide, prefix)) return SendClientMessage(playerid, cPadrao, "Parametros errados");
  39.     if ( !IsPlayerConnected(ide)) return SendClientMessage(playerid, cPadrao, "ID não encontrado");
  40.     if ( strlen( prefix ) > MAX_CHAR ) return SendClientMessage(playerid, cPadrao, "Você estourou o limite de caracteres.");
  41.     new Str[128], Name[MAX_PLAYER_NAME];
  42.     GetPlayerName(ide, Name, MAX_PLAYER_NAME);
  43.     format ( Str, sizeof ( Str ), "Sua TAG foi alterada para: {E9433F}%s",prefix);
  44.     SendClientMessage(ide, -1, Str);
  45.     format ( Str, sizeof ( Str ), "Você alterou a tag de {E9433F}%s{FFFFFF} para{E9433F} %s", Name, prefix);
  46.     SendClientMessage(playerid, -1, Str);
  47.     dini_Set(LOCAL_TAGCONF, Name, prefix);
  48.     return 1;
  49. }
  50.  
  51. CMD:prefixoff(playerid, params[])
  52. {
  53.     if ( !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, cPadrao, "Você precisar ser um admin para usar isso.");
  54.     new Name[MAX_PLAYER_NAME], prefix[16];
  55.     if ( sscanf ( params, "ss", Name, prefix)) return SendClientMessage(playerid, cPadrao, "Parametros errados");
  56.     dini_Set( LOCAL_TAGCONF, Name, prefix);
  57.     new Str[128];
  58.     format ( Str, 128, "Você setou o a tag de %s para %s", Name, prefix);
  59.     SendClientMessage(playerid, cPadrao, Str);
  60.     return 1;
  61. }
  62.  
  63. public OnPlayerText(playerid, text[])
  64. {
  65.     if ( strcmp(CheckPrefix(playerid), "None", false))
  66.     {
  67.         new Str[128], Name[MAX_PLAYER_NAME];
  68.         GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
  69.         format ( Str, sizeof ( Str ), "%s%s: %s", CheckPrefix(playerid), Name, text);
  70.         SendClientMessageToAll(-1, Str);
  71.         return 0;
  72.     }
  73.     return 1;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement