Advertisement
Guest User

Capturezone help

a guest
Jun 4th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.70 KB | None | 0 0
  1. #pragma unused ret_memcpy
  2. #include <a_samp>
  3. #include <colors>
  4. #include <Dudb>
  5. #include <Dini>
  6. #include <MidoStream>
  7. #include <a_npc>
  8. #include <foreach>
  9. #include <JunkBuster> // Anti cheat
  10. #include <VehicleHealthBar>
  11. #include <bodyparts>
  12.  
  13. // Define all the callbacks I need
  14. #define TEAM_USA 1
  15. #define TEAM_COLOR_USA COLOR_BLUE
  16. #define TEAM_JAPAN 2
  17. #define TEAM_COLOR_JAPAN COLOR_WHITE
  18. #define TEAM_GERMANY 3
  19. #define TEAM_COLOR_GERMANY COLOR_BROWN
  20. #define TEAM_RUSSIA 4
  21. #define TEAM_COLOR_RUSSIA COLOR_RED
  22. #define TEAM_ENGLAND 5
  23. #define TEAM_COLOR_ENGLAND COLOR_PLUM
  24. #define TEAM_PAKISTAN 6
  25. #define TEAM_COLOR_PAKISTAN COLOR_LIMEGREEN
  26. #define TEAM_INDIA 7
  27. #define TEAM_COLOR_INDIA COLOR_CORAL
  28. #define TEAM_BRAZIL 8
  29. #define TEAM_COLOR_BRAZIL COLOR_AQUA
  30. #define TEAM_FRANCE 9
  31. #define TEAM_COLOR_FRANCE COLOR_INDIGO
  32. #define TEAM_INDONESIA 10
  33. #define TEAM_COLOR_INDONESIA COLOR_BISQUE
  34.  
  35. // ----- Variables
  36.  
  37. #define MAX_GANGZONES   15
  38.  
  39. new Checkpoint[MAX_PLAYERS];
  40. new gangzone;
  41. new timer;
  42. new gTeam[MAX_PLAYERS];
  43. // ----- Callbacks
  44.  
  45. public OnFilterScriptInit()
  46. {
  47.     gangzone = GangZoneCreate(841.9067, 1674.394, 1076.198, 2007.047); // Creating the GangZone
  48.     return 1;
  49. }
  50.  
  51. public OnFilterScriptExit()
  52. {
  53.     GangZoneDestroy(gangzone);
  54.     return 1;
  55. }
  56.  
  57. public OnPlayerSpawn(playerid)
  58. {
  59.     SetPlayerCheckpoint(playerid, 970.7667, 1976.103, 15, 5); //PINK
  60.     return 1;
  61. }
  62.  
  63. public OnPlayerEnterCheckpoint(playerid) // If the player enters a particluar checkpoint
  64. {
  65.     SendClientMessage(playerid, 0x00FF007A, "Wait 30 Seconds - To Caputre this gangzone."); // Telling the player to wait 30 seconds.
  66.     GangZoneFlashForAll(gangzone,  0xFF80FF76); // Makes the turf Flash Pink ( telling everyone its being taken over )
  67.     SendClientMessageToAll(0xFF80FFFF, "The gangzone is being taken over"); // Sending Message to all players.
  68.     timer = SetTimerEx("SetZone", 30000, false, "i", playerid); // Setting the Timer... ( 30 seconds )
  69.     Checkpoint[playerid] = 1; // Telling the variable that the player is in the checkpoint.
  70.     return 1;
  71. }
  72.  
  73. public OnPlayerLeaveCheckpoint(playerid)
  74. {
  75.     if(Checkpoint[playerid] == 1)
  76.     {
  77.         SendClientMessage(playerid, 0x00FF007A, " You have left the checkpoint , You have failed to capture");
  78.         GangZoneStopFlashForAll(gangzone);
  79.         SendClientMessageToAll(0x00FF007A, "gangzone was not taken over");
  80.         KillTimer(timer);
  81.         Checkpoint[playerid] = 0;
  82.     }
  83.     else
  84.     {
  85.         // nothing
  86.     }
  87.     return 1;
  88. }
  89.  
  90. // Custom Callbacks
  91.  
  92. forward SetZone(playerid);
  93. public SetZone(playerid)
  94. {
  95.         gTeam[playerid] = TEAM_USA;
  96.         {
  97.         GangZoneShowForAll(gangzone,TEAM_COLOR_USA);
  98.     }
  99.         if(gTeam[playerid] == TEAM_JAPAN)
  100.     {
  101.         GangZoneShowForAll(gangzone,TEAM_COLOR_JAPAN);
  102.     }
  103.         if(gTeam[playerid] == TEAM_GERMANY)
  104.     {
  105.         GangZoneShowForAll(gangzone,TEAM_COLOR_GERMANY);
  106.     }
  107.         if(gTeam[playerid] == TEAM_RUSSIA)
  108.     {
  109.         GangZoneShowForAll(gangzone,TEAM_COLOR_RUSSIA);
  110.     }
  111.         if(gTeam[playerid] == TEAM_ENGLAND)
  112.     {
  113.         GangZoneShowForAll(gangzone,TEAM_COLOR_ENGLAND);
  114.     }
  115.         if(gTeam[playerid] == TEAM_PAKISTAN)
  116.     {
  117.         GangZoneShowForAll(gangzone,TEAM_COLOR_PAKISTAN);
  118.     }
  119.         if(gTeam[playerid] == TEAM_FRANCE)
  120.     {
  121.         GangZoneShowForAll(gangzone,TEAM_COLOR_FRANCE);
  122.     }
  123.         if(gTeam[playerid] == TEAM_INDIA)
  124.     {
  125.         GangZoneShowForAll(gangzone,TEAM_COLOR_INDIA);
  126.     }
  127.         if(gTeam[playerid] == TEAM_BRAZIL)
  128.     {
  129.         GangZoneShowForAll(gangzone,TEAM_COLOR_BRAZIL);
  130.     }
  131.         if(gTeam[playerid] == TEAM_INDONESIA)
  132.     {
  133.         GangZoneShowForAll(gangzone,TEAM_COLOR_INDONESIA);
  134.         return 1;
  135.     }
  136.         if(Checkpoint[TEAM_USA]  == 1)
  137.     {
  138.         GangZoneShowForAll(gangzone, COLOR_BLUE ); // Showing the GangZone with the new colour
  139.          
  140.         if(Checkpoint[TEAM_JAPAN]  == 1)
  141.     {
  142.         GangZoneShowForAll(gangzone, COLOR_WHITE );  
  143.          
  144.         Checkpoint[playerid] = 0;
  145.          
  146.         if(Checkpoint[TEAM_GERMANY]  == 1)
  147.     {
  148.         GangZoneShowForAll(gangzone, COLOR_BROWN );
  149.  
  150.         Checkpoint[playerid] = 0;
  151.          
  152.         if(Checkpoint[TEAM_RUSSIA]  == 1)
  153.     {
  154.         GangZoneShowForAll(gangzone, COLOR_RED );
  155.  
  156.         if(Checkpoint[TEAM_ENGLAND]  == 1)
  157.     {
  158.         GangZoneShowForAll(gangzone, COLOR_PLUM );
  159.  
  160.         Checkpoint[playerid] = 0;
  161.  
  162.         if(Checkpoint[TEAM_PAKISTAN]  == 1)
  163.     {
  164.         GangZoneShowForAll(gangzone, COLOR_LIMEGREEN );
  165.  
  166.         Checkpoint[playerid] = 0;
  167.  
  168.         if(Checkpoint[TEAM_INDIA]  == 1)
  169.     {
  170.         GangZoneShowForAll(gangzone, COLOR_CORAL );
  171.  
  172.         if(Checkpoint[TEAM_BRAZIL]  == 1)
  173.     {
  174.         GangZoneShowForAll(gangzone, COLOR_AQUA );
  175.  
  176.         Checkpoint[playerid] = 0;
  177.  
  178.         if(Checkpoint[TEAM_FRANCE]  == 1)
  179.     {
  180.         GangZoneShowForAll(gangzone, COLOR_INDIGO );
  181.  
  182.         Checkpoint[playerid] = 0;
  183.          
  184.         if(Checkpoint[TEAM_INDONESIA]  == 1)
  185.     {
  186.         GangZoneShowForAll(gangzone, COLOR_BISQUE );
  187.         Checkpoint[playerid] = 0;
  188.         GangZoneStopFlashForAll(gangzone); // Stopping it Flashing.
  189.         GangZoneHideForAll(gangzone); // Hiding the GangZone
  190.         SendClientMessageToAll(0x00FF007A, "gangzone Has Been Captured By Attacker");
  191.         SetPlayerScore(playerid,GetPlayerScore(playerid)+5 );
  192.         GivePlayerMoney(playerid,6000);
  193.         SendClientMessage(playerid,0xFFFFFFFF,"You've capture the zone and receive 500 $ and 5 score");
  194.         Checkpoint[playerid] = 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement