Guest User

Untitled

a guest
Aug 29th, 2008
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.38 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #if defined FILTERSCRIPT
  6.  
  7. #define COLOR_GREY 0xAFAFAFAA
  8. #define COLOR_RED 0xAA3333AA
  9. #define COLOR_YELLOW 0xFFFF00AA
  10. #define COLOR_PINK 0xFF66FFAA
  11. #define COLOR_BLUE 0x0000BBAA
  12. #define COLOR_WHITE 0xFFFFFFAA
  13. #define COLOR_LIGHTBLUE 0x33CCFFAA
  14. #define COLOR_DARKRED 0x660000AA
  15. #define COLOR_ORANGE 0xFF9900AA
  16. #define COLOR_BRIGHTRED 0xFF0000AA
  17. #define COLOR_INDIGO 0x4B00B0AA
  18. #define COLOR_VIOLET 0x9955DEEE
  19. #define COLOR_LIGHTRED 0xFF99AADD
  20. #define COLOR_SEAGREEN 0x00EEADDF
  21. #define COLOR_GRAYWHITE 0xEEEEFFC4
  22. #define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
  23. #define COLOR_GREENISHGOLD 0xCCFFDD56
  24. #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
  25. #define COLOR_NEUTRALBLUE 0xABCDEF01
  26. #define COLOR_LIGHTCYAN 0xAAFFCC33
  27. #define COLOR_LEMON 0xDDDD2357
  28. #define COLOR_MEDIUMBLUE 0x63AFF00A
  29. #define COLOR_NEUTRAL 0xABCDEF97
  30. #define COLOR_BLACK 0x00000000
  31. #define COLOR_NEUTRALGREEN 0x81CFAB00
  32. #define COLOR_DARKGREEN 0x12900BBF
  33. #define COLOR_LIGHTGREEN 0x24FF0AB9
  34. #define COLOR_DARKBLUE 0x300FFAAB
  35. #define COLOR_BLUEGREEN 0x46BBAA00
  36. #define COLOR_PINK 0xFF66FFAA
  37. #define COLOR_LIGHTBLUE 0x33CCFFAA
  38. #define COLOR_DARKRED 0x660000AA
  39. #define COLOR_ORANGE 0xFF9900AA
  40. #define COLOR_PURPLE 0x800080AA
  41. #define COLOR_GRAD1 0xB4B5B7FF
  42. #define COLOR_GRAD2 0xBFC0C2FF
  43. #define COLOR_RED1 0xFF0000AA
  44. #define COLOR_GREY 0xAFAFAFAA
  45. #define COLOR_GREEN 0x33AA33AA
  46. #define COLOR_RED 0xAA3333AA
  47. #define COLOR_YELLOW 0xFFFF00AA
  48. #define COLOR_WHITE 0xFFFFFFAA
  49. #define COLOR_BROWN 0x993300AA
  50. #define COLOR_CYAN 0x99FFFFAA
  51. #define COLOR_TAN 0xFFFFCCAA
  52. #define COLOR_PINK 0xFF66FFAA
  53. #define COLOR_KHAKI 0x999900AA
  54. #define COLOR_LIME 0x99FF00AA
  55. #define COLOR_SYSTEM 0xEFEFF7AA
  56. #define COLOR_GRAD2 0xBFC0C2FF
  57. #define COLOR_GRAD4 0xD8D8D8FF
  58. #define COLOR_GRAD6 0xF0F0F0FF
  59. #define COLOR_GRAD2 0xBFC0C2FF
  60. #define COLOR_GRAD3 0xCBCCCEFF
  61. #define COLOR_GRAD5 0xE3E3E3FF
  62. #define COLOR_GRAD1 0xB4B5B7FF
  63.  
  64. new ship1;
  65. new ship2;
  66. new ship3;
  67. new ShipEnt;
  68. new SailCP;
  69. new ShipTaken;
  70. new SailBoat[MAX_PLAYERS];
  71. new bool:Sailing[MAX_PLAYERS];
  72.  
  73. public OnFilterScriptInit()
  74. {
  75.     print("\n--------------------------------------");
  76.     print(" Freight Ship FS loaded!");
  77.     print("--------------------------------------\n");
  78.    
  79.     ShipEnt = CreatePickup(1318, 2, 2694.5012, -2606.9812, 14.8974);
  80.     SailCP = CreatePickup(1239, 2, 3324.2947, -1330.1631, 127.9517);
  81.     ship1 = CreateObject(9585, 2750.436523, -2607.883057, 4.398273, 0.0000, 0.0000, 0.0000);
  82.     ship2 = CreateObject(10793, 2675.130371, -2607.985107, 33.278923, 0.0000, 0.0000, 0.0000);
  83.     ship3 = CreateObject(10795, 2748.083008, -2607.962891, 14.616102, 0.0000, 0.0000, 0.0000);
  84.     CreateObject(4882, 2809.622559, -2577.623535, 17.564299, 0.0000, 0.8594, 90.2408);
  85.     CreateObject(3877, 2801.469971, -2559.517578, 14.292531, 0.0000, 0.0000, 0.0000);
  86.     CreateObject(3877, 2795.270508, -2559.551758, 14.297391, 0.0000, 0.0000, 0.0000);
  87.    
  88.     // Ship Int
  89.     CreateObject(3997, 3248.558594, -1358.906982, 127.851723, 0.0000, 0.0000, 0.0000);
  90.     CreateObject(1562, 3311.579102, -1331.105835, 128.506912, 0.0000, 0.0000, 90.0000);
  91.     CreateObject(1562, 3311.570313, -1331.914673, 128.506912, 0.0000, 0.0000, 90.0000);
  92.     CreateObject(1562, 3311.673584, -1329.189087, 128.506912, 0.0000, 0.0000, 90.0000);
  93.     CreateObject(1562, 3311.694092, -1328.249146, 128.506912, 0.0000, 0.0000, 90.0000);
  94.     CreateObject(1562, 3313.317139, -1328.182983, 128.506912, 0.0000, 0.0000, 90.0000);
  95.     CreateObject(1562, 3313.229248, -1329.292114, 128.506912, 0.0000, 0.0000, 90.0000);
  96.     CreateObject(1562, 3313.287842, -1330.989868, 128.506912, 0.0000, 0.0000, 90.0000);
  97.     CreateObject(1562, 3313.281250, -1331.916992, 128.506912, 0.0000, 0.0000, 90.0000);
  98.     CreateObject(1562, 3314.684814, -1331.980225, 128.506912, 0.0000, 0.0000, 90.0000);
  99.     CreateObject(1562, 3315.972900, -1332.173950, 128.506912, 0.0000, 0.0000, 90.0000);
  100.     CreateObject(1562, 3317.707764, -1332.107422, 128.506912, 0.0000, 0.0000, 90.0000);
  101.     CreateObject(1562, 3319.528320, -1332.057007, 128.506912, 0.0000, 0.0000, 90.0000);
  102.     CreateObject(1562, 3320.955566, -1332.073364, 128.506912, 0.0000, 0.0000, 90.0000);
  103.     CreateObject(1562, 3314.893555, -1331.030518, 128.506912, 0.0000, 0.0000, 90.0000);
  104.     CreateObject(1562, 3316.354004, -1331.088501, 128.506912, 0.0000, 0.0000, 90.0000);
  105.     CreateObject(1562, 3317.725342, -1331.182007, 128.506912, 0.0000, 0.0000, 90.0000);
  106.     CreateObject(1562, 3319.549316, -1331.180420, 128.506912, 0.0000, 0.0000, 90.0000);
  107.     CreateObject(1562, 3321.009033, -1331.177734, 128.506912, 0.0000, 0.0000, 90.0000);
  108.     CreateObject(1562, 3315.000488, -1329.306763, 128.506912, 0.0000, 0.0000, 90.0000);
  109.     CreateObject(1562, 3316.460449, -1329.296021, 128.506912, 0.0000, 0.0000, 90.0000);
  110.     CreateObject(1562, 3317.730469, -1329.383057, 128.506912, 0.0000, 0.0000, 90.0000);
  111.     CreateObject(1562, 3319.649414, -1329.490112, 128.506912, 0.0000, 0.0000, 90.0000);
  112.     CreateObject(1562, 3321.179443, -1329.449341, 128.506912, 0.0000, 0.0000, 90.0000);
  113.     CreateObject(1562, 3314.756104, -1328.300659, 128.506912, 0.0000, 0.0000, 90.0000);
  114.     CreateObject(1562, 3316.447998, -1328.375610, 128.506912, 0.0000, 0.0000, 90.0000);
  115.     CreateObject(1562, 3317.756592, -1328.448242, 128.506912, 0.0000, 0.0000, 90.0000);
  116.     CreateObject(1562, 3319.605225, -1328.488037, 128.506912, 0.0000, 0.0000, 90.0000);
  117.     CreateObject(1562, 3321.148682, -1328.354614, 128.506912, 0.0000, 0.0000, 90.0000);
  118.     CreateObject(2631, 3319.391602, -1330.531982, 127.898048, 0.0000, 0.0000, 0.0000);
  119.     CreateObject(2631, 3315.556885, -1330.391602, 127.873047, 0.0000, 0.0000, 0.0000);
  120.     CreateObject(2631, 3312.094971, -1329.989258, 127.848045, 0.0000, 0.0000, 0.0000);
  121.     CreateObject(2631, 3319.375977, -1331.630249, 127.876808, 0.0000, 0.0000, 0.0000);
  122.     CreateObject(2631, 3315.484863, -1331.641602, 127.848045, 0.0000, 0.0000, 0.0000);
  123.     CreateObject(2631, 3311.672607, -1331.650757, 127.858490, 0.0000, 0.0000, 0.0000);
  124.     CreateObject(2631, 3319.432861, -1328.840210, 127.846703, 0.0000, 0.0000, 0.0000);
  125.     CreateObject(2631, 3316.373779, -1328.868164, 127.855942, 0.0000, 0.0000, 0.0000);
  126.     CreateObject(2631, 3312.442383, -1328.773438, 127.898048, 0.0000, 0.0000, 0.0000);
  127.     CreateObject(2631, 3310.727783, -1329.756836, 127.898041, 0.0000, 0.0000, 90.0000);
  128.     CreateObject(2514, 3307.249756, -1331.757935, 127.850929, 0.0000, 0.0000, 90.0000);
  129.     CreateObject(2514, 3307.219727, -1330.282349, 127.840523, 0.0000, 0.0000, 90.0000);
  130.     CreateObject(2518, 3306.332031, -1328.416382, 127.911568, 0.0000, 0.0000, 0.0000);
  131.     CreateObject(1499, 3309.604980, -1331.111328, 127.845848, 0.0000, 0.0000, 270.0000);
  132.     CreateObject(1499, 3309.603760, -1329.634399, 127.845848, 0.0000, 0.0000, 270.0000);
  133.     CreateObject(1499, 3309.616943, -1328.077515, 127.845833, 0.0000, 0.0000, 270.0000);
  134.     CreateObject(974, 3306.298340, -1331.107056, 127.680077, 0.0000, 0.0000, 0.0000);
  135.     CreateObject(974, 3306.252197, -1332.619263, 127.604645, 0.0000, 0.0000, 0.0000);
  136.     CreateObject(974, 3306.324219, -1331.103638, 127.630074, 0.0000, 0.0000, 90.0000);
  137.     CreateObject(974, 3306.354248, -1329.615112, 127.604515, 0.0000, 0.0000, 0.0000);
  138.     CreateObject(974, 3306.371582, -1327.933716, 127.504456, 0.0000, 0.0000, 0.0000);
  139.     CreateObject(2775, 3321.854736, -1330.234131, 130.103394, 0.0000, 0.0000, 90.0000);
  140.     CreateObject(2796, 3309.695557, -1330.364380, 129.771423, 0.0000, 0.0000, 90.0000);
  141.     CreateObject(16773, 3317.184326, -1332.757080, 128.380035, 0.0000, 0.0000, 0.0000);
  142.     CreateObject(16773, 3316.280273, -1327.666504, 128.076050, 0.0000, 0.0000, 0.0000);
  143.     CreateObject(4604, 3258.958740, -1328.039551, 131.771805, 0.0000, 178.7632, 0.0000);
  144.     CreateObject(984, 3309.449707, -1331.099243, 130.948257, 0.0000, 0.0000, 0.0000);
  145.     CreateObject(16775, 3322.157471, -1322.333252, 128.279404, 0.0000, 0.0000, 90.0000);
  146.     CreateObject(16775, 3322.179443, -1338.077759, 127.911369, 0.0000, 0.0000, 90.0000);
  147.     CreateObject(1523, 3322.179443, -1329.376831, 127.820892, 0.0000, 0.0000, 270.0000);
  148.     CreateObject(16773, 3322.116699, -1330.544067, 134.250519, 0.0000, 0.0000, 270.0000);
  149.     CreateObject(14391, 3327.332520, -1330.362549, 128.811813, 0.0000, 0.0000, 180.0000);
  150.     CreateObject(1649, 3328.270996, -1327.388550, 129.599838, 0.0000, 0.0000, 270.0000);
  151.     CreateObject(16773, 3321.364258, -1327.635742, 131.850937, 0.0000, 0.0000, 0.0000);
  152.     CreateObject(16773, 3321.179199, -1332.698975, 129.410660, 0.0000, 0.0000, 180.0000);
  153.     CreateObject(1649, 3328.295898, -1331.687378, 129.580109, 0.0000, 0.0000, 270.0000);
  154.     CreateObject(1649, 3328.295898, -1327.359497, 132.159622, 0.0000, 0.0000, 270.0000);
  155.     CreateObject(1649, 3328.295898, -1331.757568, 132.904816, 0.0000, 0.0000, 270.0000);
  156.     CreateObject(16775, 3306.316406, -1333.807129, 128.851395, 0.0000, 0.0000, 270.0000);
  157.     CreateObject(16775, 3302.526611, -1332.725464, 128.319290, 0.0000, 0.0000, 0.0000);
  158.     CreateObject(16775, 3301.721924, -1327.546143, 128.054474, 0.0000, 0.0000, 179.1405);
  159.     CreateObject(1663, 3325.533691, -1329.093018, 128.311935, 0.0000, 0.0000, 90.0000);
  160.     CreateObject(1663, 3325.717773, -1330.729126, 128.311935, 0.0000, 0.0000, 90.0000);
  161.     return 1;
  162. }
  163.  
  164. public OnFilterScriptExit()
  165. {
  166.     DestroyObject(ship1);
  167.     DestroyObject(ship3);
  168.     DestroyObject(ship2);
  169.     return 1;
  170. }
  171.  
  172. #else
  173.  
  174. #endif
  175.  
  176. public OnPlayerConnect(playerid)
  177. {
  178.     return 1;
  179. }
  180.  
  181. public OnPlayerDisconnect(playerid, reason)
  182. {
  183.     return 1;
  184. }
  185.  
  186. public OnPlayerCommandText(playerid, cmdtext[])
  187. {
  188.     if(strcmp(cmdtext, "/sail", true) == 0)
  189.     {
  190.         if(Sailing[playerid] == true) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You are already Sailing!");
  191.         if(ShipTaken == 1) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Someone else is already on the ship.");
  192.         if(!PlayerToPoint(3, playerid, 3324.2947, -1330.1631, 127.9517)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You must be in the ship in order to sail it.");
  193.         Sailing[playerid] = true;
  194.         ShipTaken = 1;
  195.         SailBoat[playerid] = CreateVehicle(454, 2613.5906, -2607.2773, 0.2058, 266.4303, 0, 0, 15000);
  196.         LinkVehicleToInterior(SailBoat[playerid], 10);
  197.         PutPlayerInVehicle(playerid, SailBoat[playerid], 0);
  198.         AttachObjectToPlayer(ship1, playerid, 0.0, 150.0, -2.0, 180.0, 180.0, 270.0);
  199.         AttachObjectToPlayer(ship2, playerid, 0.0, 75.0, 27.0, 180.0, 180.0, 270.0);
  200.         AttachObjectToPlayer(ship3, playerid, 0.0, 148.0, 8.0, 180.0, 180.0, 270.0);
  201.         return 1;
  202.     }
  203.     if(strcmp(cmdtext, "/exitship", true) == 0) return SetPlayerPos(playerid, 2694.5012, -2606.9812, 14.8974);
  204.     if(strcmp(cmdtext, "/pier", true) == 0) return SetPlayerPos(playerid, 2789.7537, -2527.5212, 13.6306);
  205.     return 0;
  206. }
  207.  
  208. public OnPlayerStateChange(playerid, newstate, oldstate)
  209. {
  210.     if (newstate == PLAYER_STATE_ONFOOT)
  211.     {
  212.         if(Sailing[playerid] == true) // Sailing
  213.         {
  214.             Sailing[playerid] = false;
  215.             ShipTaken = 0;
  216.             DestroyObject(ship1);
  217.             DestroyObject(ship2);
  218.             DestroyObject(ship3);
  219.             DestroyVehicle(SailBoat[playerid]);
  220.             ship1 = CreateObject(9585, 2750.436523, -2607.883057, 4.398273, 0.0000, 0.0000, 0.0000);
  221.             ship2 = CreateObject(10793, 2675.130371, -2607.985107, 33.278923, 0.0000, 0.0000, 0.0000);
  222.             ship3 = CreateObject(10795, 2748.083008, -2607.962891, 14.616102, 0.0000, 0.0000, 0.0000);
  223.             SetPlayerPos(playerid, 2789.7537, -2527.5212, 13.6306);
  224.             return 1;
  225.         }
  226.     }
  227.     return 1;
  228. }
  229.  
  230. public OnPlayerPickUpPickup(playerid, pickupid)
  231. {
  232.     if(pickupid == SailCP)
  233.     {
  234.         SendClientMessage(playerid, COLOR_WHITE, "--------------------");
  235.         SendClientMessage(playerid, COLOR_YELLOW, "To start sailing type /sail");
  236.         SendClientMessage(playerid, COLOR_YELLOW, "To stop sailing press ENTER or F");
  237.         SendClientMessage(playerid, COLOR_YELLOW, "Type /exitship to leave the ship");
  238.         SendClientMessage(playerid, COLOR_WHITE, "--------------------");
  239.     }
  240.     else if(pickupid == ShipEnt)
  241.     {
  242.         SetPlayerPos(playerid, 3324.2810, -1330.3419, 130.5517);
  243.     }
  244.     return 1;
  245. }
  246.  
  247. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  248. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  249. {
  250.     if(IsPlayerConnected(playerid))
  251.     {
  252.         new Float:oldposx, Float:oldposy, Float:oldposz;
  253.         new Float:tempposx, Float:tempposy, Float:tempposz;
  254.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  255.         tempposx = (oldposx -x);
  256.         tempposy = (oldposy -y);
  257.         tempposz = (oldposz -z);
  258.         //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  259.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  260.         {
  261.             return 1;
  262.         }
  263.     }
  264.     return 0;
  265. }
  266.  
Advertisement
Add Comment
Please, Sign In to add comment