Advertisement
Chip7

[FS] Filterscript TextDraw Ping System

Oct 25th, 2013
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.01 KB | None | 0 0
  1. /*
  2.   VISITE NOSSO SITE: http://www.sampknd.com/
  3.   VISITE NOSSO FACEBOOK: http://www.facebook.com/SampKnd
  4.   SAMP KND MELHOR BLOG DE SAMP DO BRASIL
  5. */
  6.  
  7. FilterScript criado a pedido do SkYpE...
  8.  
  9. Créditos: Focaximubh(EU '-')
  10.  
  11.           Cantiliano_ = duduzinho (Me ajudou a testar o projeto e me deu idéia pra arruma uns errinhos O.o
  12.           mlk tu é dms e ainda arrumo minha conexão pra usar o sa-mp sem hamachi :D)
  13.  
  14.           Zamaroht's (Pelo editor de TextDraws)
  15.          
  16.           SA-MP WiKi Pela explicação das funções:
  17.          
  18.           http://wiki.sa-mp.com/wiki/GetPlayerTargetPlayer
  19.           http://wiki.sa-mp.com/wiki/GetPlayerPing
  20.           http://wiki.sa-mp.com/wiki/CreatePlayerTextDraw
  21.          
  22.           ZeeX (Pelo ZCMD)
  23.  
  24. Objetivo do FilterScript: Após mirar em algum player, o seu PING será imprimido
  25. na TextDraw aparecendo de forma totalmente dinâmica
  26.  
  27. EX: Ping Alvo: 120
  28.    Ping Alvo: 123
  29.    Ping Alvo: 133
  30.    Ou de acordo com o ping do player(os ping acima foi só exemplo nunca vi ping
  31.    abaixo de 200 mais hje em dia suhausahs)
  32.    
  33.    Obrigado pela atenção de todos, peço desculpas por erros de lógica ou até
  34.    falta de organização do código, estou disposto a receber críticas e dicas
  35.    para a melhoria de projetos, apesar de extremamente simples.
  36. */
  37.  
  38. #include <a_samp>
  39. #include <a_players>
  40. #include <zcmd>
  41. #include <sscanf2>
  42.  
  43. new PlayerText:PlayerPingText[MAX_PLAYERS];
  44.  
  45.  
  46. public OnGameModeInit()
  47. {
  48.     return 1;
  49. }
  50. main()
  51. {
  52.     print("\n----------------------------------");
  53.     print(" PlayerPingTextDraw by: Focaximubh");
  54.     print("----------------------------------\n");
  55. }
  56. public OnGameModeExit()
  57. {
  58.     return 1;
  59. }
  60.  
  61. public OnPlayerConnect(playerid)
  62. {
  63.     PlayerPingText[playerid] = CreatePlayerTextDraw(playerid, 7.000000, 322.000000, "Nenhum Alvo");
  64.     PlayerTextDrawBackgroundColor(playerid, PlayerPingText[playerid], 255);
  65.     PlayerTextDrawFont(playerid, PlayerPingText[playerid], 1);
  66.     PlayerTextDrawLetterSize(playerid, PlayerPingText[playerid], 0.430000, 1.500000);
  67.     PlayerTextDrawColor(playerid, PlayerPingText[playerid], -16776961);
  68.     PlayerTextDrawSetOutline(playerid, PlayerPingText[playerid], 1);
  69.     PlayerTextDrawSetProportional(playerid, PlayerPingText[playerid], 1);
  70.     PlayerTextDrawUseBox(playerid, PlayerPingText[playerid], 1);
  71.     PlayerTextDrawBoxColor(playerid, PlayerPingText[playerid], 0x90948DFF);
  72.     PlayerTextDrawTextSize(playerid, PlayerPingText[playerid], 132.000000, -135.000000);
  73.     return 1;
  74. }
  75.  
  76. public OnPlayerDisconnect(playerid, reason)
  77. {
  78.     PlayerTextDrawDestroy(playerid, PlayerPingText[playerid]);
  79.     return 1;
  80. }
  81.  
  82. public OnPlayerSpawn(playerid)
  83. {
  84.     PlayerTextDrawShow(playerid, PlayerPingText[playerid]);
  85.     return 1;
  86. }
  87.  
  88. public OnPlayerDeath(playerid, killerid, reason)
  89. {
  90.     PlayerTextDrawHide(playerid, PlayerPingText[playerid]);
  91.     return 1;
  92. }
  93. public OnPlayerUpdate(playerid)
  94. {
  95.     new OutroPlayer = GetPlayerTargetPlayer(playerid);
  96.     new OutroPplayer;
  97.     new PlayerPingString[20];
  98.     if(GetPlayerTeam(OutroPlayer) == GetPlayerTeam(playerid) && OutroPlayer != INVALID_PLAYER_ID)//Função retirada do SA-MP Wiki
  99.     {
  100.  
  101.         format(PlayerPingString, sizeof(PlayerPingString), "~r~Ping Alvo: ~w~%i", GetPlayerPing(OutroPplayer));
  102.         PlayerTextDrawSetString(playerid, PlayerPingText[playerid], PlayerPingString);
  103.     }
  104.     else
  105.     {
  106.  
  107.         PlayerTextDrawSetString(playerid, PlayerPingText[playerid], "~r~Nenhum Alvo");
  108.     }
  109.     return 1;
  110. }
  111.  
  112. CMD:meuping(playerid, params[])
  113. {
  114.     new seuping[24];
  115.     format(seuping, sizeof(seuping), "Seu ping agora é: %i", GetPlayerPing(playerid));
  116.     SendClientMessage(playerid, -1, seuping);
  117.     return 1;
  118. }
  119. CMD:pingdele(playerid, params[])
  120. {
  121.     new id;
  122.     if(sscanf(params,"i", id)) return SendClientMessage(playerid , -1, " Uso /pingdele [ID do player] ");
  123.     if(IsPlayerConnected(id))
  124.     {
  125.  
  126.         new PingDele = GetPlayerPing(id);
  127.         new PingdoCara[24];
  128.         format(PingdoCara, sizeof(PingdoCara), "O ping dele agora é: %i", PingDele);
  129.         SendClientMessage(playerid, -1, PingdoCara);
  130.     }
  131.     else
  132.     {
  133.  
  134.         SendClientMessage(playerid, -1, "Este Player Não está online no momento");
  135.     }
  136.     return 1;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement