Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.68 KB | None | 0 0
  1. // Ко всем Forward:
  2.  
  3. forward ProxDetector(Float:radi,playerid, string[],col1,col2,col3,col4,col5);
  4.  
  5. OnPlayerText заменить на паблик:
  6. public OnPlayerText(playerid, text[])
  7. {
  8.     new pname[24], str[128];
  9.     GetPlayerName(playerid, pname, 24);
  10.     format(str, sizeof(str), "%s говорит: %s", pname, text);
  11.     ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.1, 0, 0, 0, 1, 1, 1);
  12.     ProxDetector(20.0, playerid, str, cWhite, cWhite, cWhite, cWhite, cWhite);
  13.     SetPlayerChatBubble(playerid, text, cWhite, 15.0, 10000);
  14.     return 0;
  15. }
  16.  
  17. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  18. {
  19.     if(IsPlayerConnected(playerid))
  20.     {
  21.         new Float:posx, Float:posy, Float:posz;
  22.         new Float:oldposx, Float:oldposy, Float:oldposz;
  23.         new Float:tempposx, Float:tempposy, Float:tempposz;
  24.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  25.         for(new i = 0; i < MAX_PLAYERS; i++)
  26.         {
  27.             if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  28.             {
  29.                 GetPlayerPos(i, posx, posy, posz);
  30.                 tempposx = (oldposx -posx);
  31.                 tempposy = (oldposy -posy);
  32.                 tempposz = (oldposz -posz);
  33.                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
  34.                 {
  35.                     SCM(i, col1, string);
  36.                 }
  37.                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
  38.                 {
  39.                     SCM(i, col2, string);
  40.                 }
  41.                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
  42.                 {
  43.                     SCM(i, col3, string);
  44.                 }
  45.                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
  46.                 {
  47.                     SCM(i, col4, string);
  48.                 }
  49.                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
  50.                 {
  51.                     SCM(i, col5, string);
  52.                 }
  53.             }
  54.             else
  55.             {
  56.                 SCM(i, col1, string);
  57.             }
  58.         }
  59.     }
  60.     return 1;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement