Advertisement
Flovv

fs_balloon.pwn

Dec 8th, 2011
1,258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.22 KB | None | 0 0
  1. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2.  #                                          #
  3.  #          FS Balloon v1.0 by Flovv        #
  4.  #                                          #
  5.  #      Simple Filterscript for flying      #
  6.  #    the Hot Air Ballon with a jetpack     #
  7.  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
  8.  
  9.  
  10. #include <a_samp>
  11.  
  12. //SETTINGS
  13. new bool:allow_jetpack = false;     //set true if jetpacks are allowed on your server
  14.  
  15. new Float:fs_balloon_kor[][3] =
  16. {
  17.     // Balloon Positions, (X, Y, Z)
  18.     {-2318.278076,-1625.151977,483.406787},     //balloon 1 mt. chilliad
  19.     {-1220.447998,9.320171,13.901531},      //balloon 2 sf airport
  20.     {1920.374145,-2310.464355,13.246875},       //balloon 3 ls airport
  21.     {1339.667236, 1309.602172, 10.520312}       //balloon 4 lv airport
  22. };
  23.  
  24. //VARS
  25. new fs_balloon_set[sizeof(fs_balloon_kor)][4];
  26. //[0]->balloon id; [1]->fire 1 id; [2]->fire 2 id; [3]->pickup id
  27.  
  28. new fs_balloon_pl[MAX_PLAYERS][2];
  29. //[playerid][0]->status (0)is set so player can't pickup the jetpack again, (1)flying a balloon, (2)not flying a balloon
  30. //[playerid][1]->balloon number the player is in
  31.  
  32.  
  33. //functions
  34. forward pinbal(playerid);
  35.  
  36.  
  37. SpawnBalloon(fs_balloonID)
  38. {
  39.     fs_balloon_set[fs_balloonID][0] = CreateObject(((random(7))+19332),fs_balloon_kor[fs_balloonID][0],fs_balloon_kor[fs_balloonID][1],fs_balloon_kor[fs_balloonID][2],0.0,0.0,0.0,300.0)//balloon
  40.     fs_balloon_set[fs_balloonID][1] = CreateObject(18692,0.0,0.0,0.0,0.0,0.0,0.0,300.0);    //fire 1
  41.     fs_balloon_set[fs_balloonID][2] = CreateObject(18692,0.0,0.0,0.0,0.0,0.0,0.0,300.0);    //fire 2
  42.     AttachObjectToObject(fs_balloon_set[fs_balloonID][1], fs_balloon_set[fs_balloonID][0], 0.0, 0.0, 4.0, 0.0, 0.0, 0.0, 1);
  43.     AttachObjectToObject(fs_balloon_set[fs_balloonID][2], fs_balloon_set[fs_balloonID][0], 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 1);
  44.     fs_balloon_set[fs_balloonID][3] = CreatePickup(1559, 1, fs_balloon_kor[fs_balloonID][0], fs_balloon_kor[fs_balloonID][1], fs_balloon_kor[fs_balloonID][2] + 1, 0);
  45.     return 1;
  46. }
  47.  
  48. DestroyBalloon(fs_balloonID)
  49. {
  50.     DestroyObject(fs_balloon_set[fs_balloonID][0]);
  51.     DestroyObject(fs_balloon_set[fs_balloonID][1]);
  52.     DestroyObject(fs_balloon_set[fs_balloonID][2]);
  53.     return 1;
  54. }
  55.  
  56. public pinbal(playerid) //set the player in balloon value via timer, otherwise it's gettin buggy with OnPlayerUpdate
  57. {
  58.     fs_balloon_pl[playerid][0] = 1;
  59.     return 1;
  60. }
  61.  
  62. // Callbacks
  63. public OnFilterScriptInit()
  64. {
  65.     new balcount = 0;
  66.     for(new i = 0; i < sizeof(fs_balloon_kor); i++)
  67.     {
  68.         SpawnBalloon(i);
  69.         balcount++;
  70.     }
  71.     printf("++++++++++++++++++++++++");
  72.     printf("+      fs_balloon      +");
  73.     printf("+ Hot Air Balloon v1.0 +");
  74.     printf("+      by Flovv        +");
  75.     printf("++++++++++++++++++++++++\n");
  76.     printf(" Spawned %d Hot Air Balloons",balcount);
  77.  
  78.     return 1;
  79. }
  80.  
  81. public OnFilterScriptExit()
  82. {
  83.     for(new i = 0; i < sizeof(fs_balloon_kor); i++)
  84.     {
  85.         DestroyBalloon(i);
  86.     }
  87.    
  88.     return 1;
  89. }
  90.  
  91. //player enters balloon
  92. public OnPlayerPickUpPickup(playerid, pickupid)
  93. {
  94.     if(fs_balloon_pl[playerid][0] == 0)
  95.     {
  96.         for(new i = 0; i < sizeof(fs_balloon_kor); i++)
  97.         {
  98.             if(fs_balloon_set[i][3] == pickupid)
  99.             {
  100.                 fs_balloon_pl[playerid][0] = 2;
  101.                 AttachObjectToPlayer(fs_balloon_set[i][0],playerid,0.0,0.0,-1.0,0.0,0.0,0.0);   //attach balloon to player
  102.                 SetPlayerSpecialAction(playerid, 2);
  103.                 DestroyPickup(pickupid);
  104.                 SetTimerEx("pinbal", 200, false, "i", playerid);
  105.                 fs_balloon_pl[playerid][1] = i;
  106.                 i = sizeof(fs_balloon_kor);
  107.             }
  108.         }
  109.     }
  110.     return 1;
  111. }
  112.  
  113. public OnPlayerUpdate(playerid)
  114. {
  115. //player exits balloon
  116.     if(GetPlayerSpecialAction(playerid) != 2 && fs_balloon_pl[playerid][0] == 1)
  117.     {
  118.         DestroyBalloon(fs_balloon_pl[playerid][1]);
  119.         SpawnBalloon(fs_balloon_pl[playerid][1]);
  120.         fs_balloon_pl[playerid][0] = 0;
  121.     }
  122. //player won't be able to pick up the spawned jetpack
  123.     if(GetPlayerSpecialAction(playerid) == 2 && fs_balloon_pl[playerid][0] == 0)
  124.     {
  125.         if(!allow_jetpack && IsPlayerAdmin(playerid) == 0)
  126.         {
  127.             SetPlayerSpecialAction(playerid, 0);
  128.             SendClientMessage(playerid, 0xFF0000FF, "SERVER: Jetpacks aren't allowed!");
  129.         }
  130.     }
  131.    
  132.     return 1;
  133. }
  134.  
  135. //fix the balloon not showing problem?
  136. public OnPlayerStreamIn(playerid, forplayerid)
  137. {
  138.     if(fs_balloon_pl[playerid][0] == 1)
  139.     {
  140.         AttachObjectToPlayer(fs_balloon_set[fs_balloon_pl[playerid][1]][0],playerid,0.0,0.0,-1.0,0.0,0.0,0.0);
  141.     }
  142.     return 1;
  143. }
  144.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement