Advertisement
Guest User

tag na cabeça.pwn

a guest
Sep 30th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.89 KB | None | 0 0
  1.  
  2.  
  3. public OnGameModeInit()
  4. {
  5.     SetTimer("Timer_UpdateTags", 10000, 1);
  6.     return 1;
  7. }
  8.  
  9.  
  10. public OnPlayerText(playerid, text[])
  11. {
  12.     // Use isso ao inves de SetPlayerChatBubble, dessa
  13.     // forma vai manter o texto e a tag ao mesmo tempo
  14.     SetPlayerHeadChat(playerid, text, 10.0, 5);
  15.     return 1;
  16. }
  17.  
  18. // ----
  19.  
  20. new UsingChat[MAX_PLAYERS];
  21.  
  22. forward void:Timer_UpdateTags();
  23. public void:Timer_UpdateTags()
  24. {
  25.     foreach(pid : Player)
  26.     {
  27.         if(UsingChat[pid] > gettime()) continue
  28.  
  29.         switch(pinfo[pid][admin])
  30.         {
  31.             case 1: SetPlayerChatBubble(playerid, "Helper", 0xFFFF00FF, 10.0, 10000);
  32.             case 2: SetPlayerChatBubble(playerid, "Moder", 0x008000FF, 10.0, 10000);
  33.             case 3: SetPlayerChatBubble(playerid, "Admin", 0x00CAFFFF, 10.0, 10000);
  34.             default: SetPlayerChatBubble(playerid, "Player", 0xFF7F00FF, 10.0, 10000);
  35.         }
  36.     }
  37. }
  38.  
  39. SetPlayerHeadChat(playerid, const text[], Float:range, second)
  40. {
  41.     static mytext[144];
  42.     switch(pinfo[pid][admin])
  43.     {
  44.         case 1: format(mytext, sizeof mytext, "{FFFF00}Helper\n{FFFFFF}");
  45.         case 2: format(mytext, sizeof mytext, "{008000}Moder\n{FFFFFF}");
  46.         case 3: format(mytext, sizeof mytext, "{00CAFF}Admin\n{FFFFFF}");
  47.         default: format(mytext, sizeof mytext, "{FF7F00}Player\n{FFFFFF}");
  48.     }
  49.  
  50.     strcat(mytext, text);
  51.     UsingChat[playerid] = (gettime() + second);
  52.     return SetPlayerChatBubble(playerid, mytext, -1, range, (second * 1000));
  53. }
  54.  
  55. CMD:setadmin(playerid, params[])
  56. {
  57.     new pid, nivel;
  58.     if(sscanf(params, "dd", pid, nivel))
  59.         SendClientMessage(playerid, -1, "Use: /setadmin [playerid] [nivel]");
  60.     else
  61.     {
  62.         if(!IsPlayerConnected(pid))
  63.             SendClientMessage(playerid, -1, "| Admin | Jogador nao encontrado");
  64.         else
  65.         {
  66.             nivel = clamp(nivel, 0, 6);
  67.             pinfo[pid][admin] = nivel;
  68.  
  69.             SendClientMessage(playerid, -1, "| Admin | Jogador setado com sucesso");
  70.             SendClientMessage(pid, -1, "| Info | Voce foi setado por um admin");
  71.         }
  72.     }
  73.     return 1;
  74. }
  75.  
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement