toribio

toribio

Apr 24th, 2009
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. forward OnPlayerInArea();
  4.  
  5. new bool:parea[MAX_PLAYERS];
  6.  
  7. public OnFilterScriptInit()
  8. {
  9.     SetTimer("OnPlayerInArea", 300, 1);
  10.     return 1;
  11. }
  12.  
  13. public OnPlayerInArea()
  14. {
  15.     for(new i = 0; i < 100; i++)
  16.     {
  17.         if(PlayerInArea(i, -1416.8, 688.6, -1073.8, 842.3))
  18.         {
  19.             if(!parea[i])
  20.             {
  21.                 //pra aparecer a mensagem somente 1 vez depois que ele entrar na área
  22.                 //se não tivesse isso, a mensagem iria aparecer umas 3,333~ vezes por segundo pra ele
  23.                 SendClientMessage(i, 1010580650, "Oi, parabéns, o FS funcionou! =D");
  24.                 parea[i] = true;
  25.             }
  26.         } else {
  27.             parea[i] = false;
  28.         }
  29.     }
  30.     return 1;
  31. }
  32.  
  33. stock PlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
  34. {
  35.     new Float:X, Float:Y, Float:Z;
  36.     GetPlayerPos(playerid, X, Y, Z);
  37.     return X >= MinX && Y >= MinY && X <= MaxX && Y <= MaxY;
  38. }
Add Comment
Please, Sign In to add comment