Advertisement
Red_Jheyson

Sistema de tag's Salvamento em Dini

Oct 11th, 2016
1,452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.30 KB | None | 0 0
  1. /*
  2. Não retire os creditos afinal não foi você que fez!
  3.  
  4. Meu server: 181.41.197.168:7849
  5.  
  6. Comandos
  7. /SetTag (id) (tag) <-- este comando seta a tag no player
  8. /UnSetTag (id) <-- Escomando retira a tag setada no player
  9.  
  10. Bom Como não uso zcmd não testei esse mais deve estar funcionando
  11. */
  12. //Includes
  13. #include <a_samp>
  14. #include <dini>
  15. #include <zcmd>
  16. #include <sscanf2>
  17. //...
  18. #define LOCAL "tags.txt" //Local onde ficara salvo as tags setadas
  19. #define COR_TAG 00FF00 //Coloque aqui a cor da tag em codigo HEX, Vermelho=FF0000 , Azul=0000FF , Amarelo=FFFF00 , Branco=FFFFFF , Preto=000000
  20. #define LETRAS 3 // Tamanho minimo da tag
  21.  
  22. // Variaveis
  23. new tag[MAX_PLAYERS];
  24. static PlayerTag[MAX_PLAYERS][256]; //Se colocar - da erro!
  25.  
  26. //============================================================
  27. public OnFilterScriptInit()
  28. {
  29.     for(new all = 0; all < MAX_PLAYERS; ++all){if(IsPlayerConnected(all)){OnPlayerConnect(all);}}
  30.     print("\n--------------------------------------");
  31.     if (!dini_Exists(LOCAL)){
  32.     dini_Create(LOCAL);
  33.     print("\nscriptfiles/"#LOCAL" | Criado");
  34.     }
  35.     print("    /SetTag By [$]_Red_[MF] iniciado");
  36.     print("--------------------------------------\n");
  37.     return 1;
  38. }
  39. //============================================================
  40. public OnFilterScriptExit()
  41. {
  42.     //nada
  43.     return 1;
  44. }
  45. //============================================================
  46. public OnPlayerConnect(playerid)
  47. {
  48.     SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FF0000} Este Servidor usa sistema de Tag feito por [$]_Red_[MF]");
  49.     new string[50];
  50.     format(string,sizeof(string),"%s_usetag",pName(playerid));
  51.     tag[playerid] = dini_Int(LOCAL, string);
  52.     PlayerTag[playerid] = dini_Get(LOCAL, pName(playerid));
  53.     return 1;
  54. }
  55. //============================================================
  56. public OnPlayerText(playerid, text[])
  57. {
  58.     if(tag[playerid] == 1)
  59.     {
  60.         new string[164];
  61.         format(string,sizeof(string),"%s{FFFFFF}-[{"#COR_TAG"}%s{FFFFFF}]-(%i): %s",pName(playerid),PlayerTag[playerid],playerid,text);
  62.         SendClientMessageToAll(GetPlayerColor(playerid), string);
  63.         return 0;
  64.     }
  65.     return 1;
  66. }
  67. //============================================================
  68. CMD:settag(playerid, params[]) // Comando usado para setar a tag no player /settag (id) (Tag) ex: /settag (0) (DORITOS)
  69. {
  70.     new id,tmp2[50];
  71.     if(sscanf(params, "ds[50]",id,tmp2)) return SendClientMessage(playerid,-1,"Use: /settag [id] [tag]");
  72.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FF0000} Você não tem permisão para usar este comando");
  73.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "{FF0000}Player não conectado!");
  74.     if(strval(tmp2) < LETRAS) return SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FFFFFF} A tag tem que ter pelomenos "#LETRAS" Letras");
  75.     static string[124],str[50];
  76.     format(str,sizeof(str),"%s",tmp2);
  77.     format(string,sizeof(string),"%s_usetag",pName(id));
  78.     dini_Set(LOCAL, pName(id), str);
  79.     dini_IntSet(LOCAL, string, 1);
  80.     tag[id] = 1;
  81.     PlayerTag[id] = str;
  82.     format(string,sizeof(string),"{FFFF00}[TAG]:{FFFFFF} Tag: {"#COR_TAG"}%s {FFFFFF}Setada para o player: {"#COR_TAG"}%s",tmp2,pName(id));
  83.     SendClientMessage(playerid, -1,string);
  84.     return true;
  85. }
  86. //============================================================
  87. CMD:unsettag(playerid, params[]) // Comando usado para retirar a tag do player /unsettag (id)
  88. {
  89.     new tmp1;
  90.     if(sscanf(params, "d",tmp1)) return SendClientMessage(playerid,-1,"Use: /unsettag [id]");
  91.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "{FFFF00}[TAG]:{FF0000} Você não tem permisão para usar este comando");
  92.     new string[124];
  93.     if(!IsPlayerConnected(tmp1)) return SendClientMessage(playerid, -1, "{FF0000}Player não conectado!");
  94.     format(string,sizeof(string),"%s_usetag",pName(tmp1));
  95.     dini_IntSet(LOCAL, string, 0);
  96.     tag[tmp1] = 0;
  97.     format(string,sizeof(string),"{FFFF00}[TAG]:{FFFFFF} A Tag: {"#COR_TAG"}%s {FFFFFF}Foi retirada de {"#COR_TAG"}%s",PlayerTag[playerid],pName(tmp1));
  98.     SendClientMessage(playerid, -1,string);
  99.     PlayerTag[tmp1] = "";
  100.     return true;
  101. }
  102. //============================================================
  103. stock pName(playerid){//pega nome do player
  104. static pname[24];GetPlayerName(playerid, pname, 24);
  105. return pname;}
  106. //============================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement