Advertisement
Guest User

IntrozeN

a guest
Jan 6th, 2010
4,059
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.31 KB | None | 0 0
  1. //-----------------------IntrozeN---------------------
  2. //-----------------------Gangzone---------------------
  3. //-----------------------Creator----------------------
  4. //-----------------------v1.0-------------------------
  5.  
  6. #include <a_samp>
  7.  
  8. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  9. #define COLOR_GREENLIGHT 0x9ACD32AA
  10. #define COLOR_DARKRED 0xC10B07FF
  11.  
  12. forward Createzone(playerid,color);
  13.  
  14. new Makingzone[MAX_PLAYERS];
  15. new Float:ZMinX;
  16. new Float:ZMaxX;
  17. new Float:ZMinY;
  18. new Float:ZMaxY;
  19. new GangZone;
  20. new Create;
  21.  
  22. public OnFilterScriptInit()
  23. {
  24.     print("\n----------------------------------");
  25.     print("Gangzone Creator v1.0 by IntrozeN");
  26.     print("----------------------------------\n");
  27.     if(!fexist("/savedzones.txt")) fopen("/savedzones.txt", io_readwrite);
  28.     return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33.     GangZoneHideForAll(GangZone);
  34.     return 1;
  35. }
  36.  
  37. public OnPlayerCommandText(playerid, cmdtext[])
  38. {
  39.     dcmd(zone,4,cmdtext);
  40.     return 0;
  41. }
  42.  
  43. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  44. {
  45.     if(dialogid == 0)
  46.     {
  47.         if(response)
  48.         {
  49.             if(listitem == 0)
  50.             {
  51.                 if(Makingzone[playerid] == 1) return SendClientMessage(playerid,COLOR_DARKRED,".: Info: You're already making a zone. Cancel or Save the current one first :.");
  52.                 ShowPlayerDialog(playerid,1,2,"Color","Blue\nRed\nGreen\nPurple\nYellow\nGrey\nLightblue\nWhite\nBlack","Select","Cancel");
  53.                 Makingzone[playerid] = 1;
  54.             }
  55.             if(listitem == 1)
  56.             {
  57.                 if(Makingzone[playerid] == 0) return SendClientMessage(playerid,COLOR_DARKRED,".: Info: You're not making a zone. Create one first :.");
  58.                 new string[128];
  59.                 KillTimer(Create);
  60.                 format(string,sizeof(string),"GangZoneCreate(%f,%f,%f,%f);\r\n",ZMinX,ZMinY,ZMaxX,ZMaxY);
  61.                 new File:save = fopen("/savedzones.txt", io_append);
  62.                 fwrite(save, string);
  63.                 fclose(save);
  64.                 SendClientMessage(playerid,COLOR_GREENLIGHT,".: Info: Zone created and saved in savedzones.txt :.");
  65.                 Makingzone[playerid] = 0;
  66.             }
  67.             if(listitem == 2)
  68.             {
  69.                 if(Makingzone[playerid] == 0) return SendClientMessage(playerid,COLOR_DARKRED,".: Info: You're not making a zone. Create one first :.");
  70.                 KillTimer(Create);
  71.                 GangZoneDestroy(GangZone);
  72.                 SendClientMessage(playerid,COLOR_GREENLIGHT,".: Info: Zone creation cancelled :.");
  73.                 Makingzone[playerid] = 0;
  74.             }
  75.         }
  76.     }
  77.     if(dialogid == 1)
  78.     {
  79.         if(response)
  80.         {
  81.             if(listitem == 0)
  82.             {
  83.                 new Float:Z;
  84.                 new color;
  85.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  86.                 color = 0x0000FFAA;
  87.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  88.                 GangZoneShowForPlayer(playerid,GangZone,color);
  89.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  90.             }
  91.             if(listitem == 1)
  92.             {
  93.                 new Float:Z;
  94.                 new color;
  95.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  96.                 color = 0xFF0000AA;
  97.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  98.                 GangZoneShowForPlayer(playerid,GangZone,color);
  99.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  100.             }
  101.             if(listitem == 2)
  102.             {
  103.                 new Float:Z;
  104.                 new color;
  105.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  106.                 color = 0x00FF00AA;
  107.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  108.                 GangZoneShowForPlayer(playerid,GangZone,color);
  109.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  110.             }
  111.             if(listitem == 3)
  112.             {
  113.                 new Float:Z;
  114.                 new color;
  115.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  116.                 color = 0xFF00FFAA;
  117.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  118.                 GangZoneShowForPlayer(playerid,GangZone,color);
  119.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  120.             }
  121.             if(listitem == 4)
  122.             {
  123.                 new Float:Z;
  124.                 new color;
  125.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  126.                 color = 0xFFFF00AA;
  127.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  128.                 GangZoneShowForPlayer(playerid,GangZone,color);
  129.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  130.             }
  131.             if(listitem == 5)
  132.             {
  133.                 new Float:Z;
  134.                 new color;
  135.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  136.                 color = 0x888888AA;
  137.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  138.                 GangZoneShowForPlayer(playerid,GangZone,color);
  139.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  140.             }
  141.             if(listitem == 6)
  142.             {
  143.                 new Float:Z;
  144.                 new color;
  145.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  146.                 color = 0x00FFFFAA;
  147.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  148.                 GangZoneShowForPlayer(playerid,GangZone,color);
  149.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  150.             }
  151.             if(listitem == 7)
  152.             {
  153.                 new Float:Z;
  154.                 new color;
  155.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  156.                 color = 0xFFFFFFAA;
  157.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  158.                 GangZoneShowForPlayer(playerid,GangZone,color);
  159.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  160.             }
  161.             if(listitem == 8)
  162.             {
  163.                 new Float:Z;
  164.                 new color;
  165.                 GetPlayerPos(playerid,ZMinX,ZMinY,Z);
  166.                 color = 0x000000AA;
  167.                 GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  168.                 GangZoneShowForPlayer(playerid,GangZone,color);
  169.                 Create = SetTimerEx("Createzone",100,1,"ud",playerid,color);
  170.             }
  171.             SendClientMessage(playerid,COLOR_GREENLIGHT,".: Info: Zone is being created :.");
  172.             SendClientMessage(playerid,COLOR_GREENLIGHT,".: Info: Check on the minimap while moving to create your zone perfectly then save the zone by typing /zone :.");
  173.         }
  174.         else if(!response)
  175.         {
  176.             Makingzone[playerid] = 0;
  177.         }
  178.     }
  179.     return 1;
  180. }
  181.  
  182. public Createzone(playerid,color)
  183. {
  184.     GangZoneHideForPlayer(playerid,GangZone);
  185.     GangZoneDestroy(GangZone);
  186.     new Float:Z;
  187.     GetPlayerPos(playerid,ZMaxX,ZMaxY,Z);
  188.     GangZone = GangZoneCreate(ZMinX,ZMinY,ZMaxX,ZMaxY);
  189.     GangZoneShowForPlayer(playerid,GangZone,color);
  190.     return 1;
  191. }
  192.  
  193. dcmd_zone(playerid,params[])
  194. {
  195.     #pragma unused params
  196.     ShowPlayerDialog(playerid,0,2,"Gangzone Creator v1.0 by IntrozeN","Createzone\nSavezone\nCancelzone","Select","Cancel");
  197.     return 1;
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement