Advertisement
ZumeZero

[Include] zGangZones v0.1.0

Jan 6th, 2014
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.71 KB | None | 0 0
  1. /*
  2.  
  3. zGangZones.
  4.  
  5.     Include: zGangZones include - 2014
  6.     Versión: v0.1.1
  7.     By: Zume-Zero
  8.  
  9. Functionss.
  10.     - v0.1.0 -
  11.     * PlayerOnGangZone
  12.     * CreateGangZone
  13.     * DestroyGangZone
  14.     - v0.1.1 -
  15.     * ShowGangZoneToPlayer
  16.     * SetGangZoneColorForAll
  17.     * ShowGangZoneForAll
  18. */
  19.  
  20. #include <a_samp>
  21.  
  22. #if defined _zGangZones_included
  23. #endinput
  24. #endif
  25. #define _zGangZones_included
  26.  
  27. enum gZonas
  28. {
  29.     gID,
  30.     bool:gCreated,
  31.     Float:gminx,
  32.     Float:gminy,
  33.     Float:gmaxx,
  34.     Float:gmaxy,
  35.     gColor
  36. };
  37. static
  38.     gInfo[MAX_GANG_ZONES][gZonas];
  39.  
  40. forward zGangZone:CreateGangZone(Float:minx, Float:miny, Float:maxx, Float:maxy, color);
  41. forward DestroyGangZone(gIDe);
  42. forward ShowGangZoneToPlayer(playerid, zGangZone:ID);
  43. forward PlayerOnGangZone(playerid, zGangZone:ID);
  44. forward SetGangZoneColorForAll(zGangZone:ID, color);
  45. forward ShowGangZoneForAll(zGangZone:ID);
  46.  
  47. public zGangZone:CreateGangZone(Float:minx, Float:miny, Float:maxx, Float:maxy, color)
  48. {
  49.     new IDg;
  50.        
  51.     for(IDg = 0; IDg < MAX_GANG_ZONES; ++IDg)
  52.     {
  53.         if(gInfo[IDg][gCreated] == false)
  54.         {
  55.             gInfo[IDg][gID] = IDg;
  56.             break;
  57.         }
  58.     }
  59.  
  60.     new zId = gInfo[IDg][gID];
  61.  
  62.     gInfo[zId][gCreated] = true;
  63.     gInfo[zId][gminx] = minx;
  64.     gInfo[zId][gminy] = miny;
  65.     gInfo[zId][gmaxx] = maxx;
  66.     gInfo[zId][gmaxy] = maxy;
  67.     gInfo[zId][gColor] = color;
  68.     gInfo[zId][gID] = GangZoneCreate(gInfo[zId][gminx], gInfo[zId][gminy], gInfo[zId][gmaxx], gInfo[zId][gmaxy]);
  69.     return zGangZone:IDg;
  70. }
  71.  
  72. public PlayerOnGangZone(playerid, zGangZone:ID)
  73. {
  74.     if(playerid != INVALID_PLAYER_ID)
  75.     {
  76.         new Float:
  77.             POS[3];
  78.                
  79.         if(gInfo[ID][gCreated] == true)
  80.         {
  81.             GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
  82.             return (POS[0] > gInfo[ID][gminx] && POS[0] < gInfo[ID][gmaxx] && POS[1] > gInfo[ID][gminy] && POS[1] < gInfo[ID][gmaxy]);
  83.         }
  84.     }
  85.     return 1;
  86. }
  87.  
  88. public SetGangZoneColorForAll(zGangZone:ID, color)
  89. {
  90.     if(gInfo[ID][gCreated] == true)
  91.     {
  92.         for(new i = 0; i < MAX_PLAYERS; i++)
  93.         {
  94.             gInfo[ID][gColor] = color;
  95.             GangZoneShowForPlayer(i, ID, gInfo[ID][gColor]);
  96.         }
  97.     }
  98.     return 1;
  99. }
  100.  
  101. public DestroyGangZone(gIDe)
  102. {
  103.     if(gInfo[gIDe][gCreated] == false) return 0;
  104.  
  105.     gInfo[gIDe][gCreated] = false;
  106.     GangZoneDestroy(gIDe);
  107.     return 0;
  108. }
  109.  
  110. public ShowGangZoneForAll(zGangZone:ID)
  111. {
  112.     if(gInfo[ID][gCreated] == true)
  113.     {
  114.         return GangZoneShowForAll(ID, gInfo[ID][gColor]);
  115.     }
  116.     return 1;
  117. }
  118.  
  119. public ShowGangZoneToPlayer(playerid, zGangZone:ID)
  120. {
  121.     if(playerid != INVALID_PLAYER_ID)
  122.     {
  123.         if(gInfo[ID][gCreated] == true)
  124.         {
  125.             return GangZoneShowForPlayer(playerid, ID, gInfo[ID][gColor]);
  126.         }
  127.     }
  128.     return 1;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement