Advertisement
Johurt

[SCR] jAuto Gates.

Feb 16th, 2013
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.02 KB | None | 0 0
  1. /*
  2.         Author: Johurt(ES.^, Edgar).
  3.         Date: 16-02-2013.
  4. */
  5.  
  6. #include <a_samp>
  7. #define MAX_AGATES  2
  8.  
  9. enum agItem
  10. {
  11.     Model,
  12.     Float:oPosX,
  13.     Float:oPosY,
  14.     Float:oPosZ,
  15.     Float:oPosrX,
  16.     Float:oPosrY,
  17.     Float:oPosrZ,
  18.     Float:cPosX,
  19.     Float:cPosY,
  20.     Float:cPosZ,
  21.     Float:cPosrX,
  22.     Float:cPosrY,
  23.     Float:cPosrZ,
  24.     Float:oSpeed,
  25.     Float:cSpeed,
  26.     Float:DrawDistance,
  27.     Float:pPosX,
  28.     Float:pPosY,
  29.     Float:pPosZ,
  30.     Float:pRange
  31. }
  32. new bool:GatesState[MAX_AGATES], GatesID[MAX_AGATES];
  33. new caGates[MAX_AGATES][agItem] =
  34. {
  35.     {988, -1543.742, -432.703, 6.039, 0.0, 0.0, -45.0, -1540.66, -435.786, 6.039, 0.0, 0.0, -45.0, 3.0, 3.0, 300.0, -1545.9380, -430.9962, 6.0, 20.0},
  36.     {988, -1547.625, -428.82, 6.039, 0.0, 0.0, -45.0, -1550.709, -425.736, 6.039, 0.0, 0.0, -45.0, 3.0, 3.0, 300.0, -1545.9380, -430.9962, 6.0, 20.0}
  37. };
  38.  
  39. public OnFilterScriptInit()
  40. {
  41.     for(new g; g < MAX_AGATES; g++) GatesID[g] = CreateObject(caGates[g][Model], caGates[g][oPosX], caGates[g][oPosY], caGates[g][oPosZ], caGates[g][oPosrX], caGates[g][oPosrY], caGates[g][oPosrZ], caGates[g][DrawDistance]);
  42.     SetTimer("AutoGates", 1000, true);
  43.     return 1;
  44. }
  45.  
  46. forward AutoGates();
  47. public AutoGates()
  48. {
  49.     new bool:cGates[MAX_AGATES];
  50.     for(new p; p < MAX_PLAYERS; p++)
  51.     {
  52.         if(IsPlayerConnected(p) && !IsPlayerNPC(p))
  53.         {
  54.             for(new g; g < MAX_AGATES; g++)
  55.             {
  56.                 if(IsPlayerInRangeOfPoint(p, caGates[g][pRange], caGates[g][pPosX], caGates[g][pPosY], caGates[g][pPosZ]))
  57.                 {
  58.                     cGates[g] = true;
  59.                     if(!GatesState[g])
  60.                     {
  61.                         GatesState[g] = true;
  62.                         MoveObject(GatesID[g], caGates[g][cPosX], caGates[g][cPosY], caGates[g][cPosZ], caGates[g][cSpeed], caGates[g][cPosrX], caGates[g][cPosrY], caGates[g][cPosrZ]);
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.     }
  68.     for(new g; g < MAX_AGATES; g++)
  69.     {
  70.         if(!cGates[g] && GatesState[g])
  71.         {
  72.             cGates[g] = false;
  73.             GatesState[g] = false;
  74.             MoveObject(GatesID[g], caGates[g][oPosX], caGates[g][oPosY], caGates[g][oPosZ], caGates[g][oSpeed], caGates[g][oPosrX], caGates[g][oPosrY], caGates[g][oPosrZ]);
  75.         }
  76.     }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement