Advertisement
Guest User

System Event Halloween

a guest
Oct 23rd, 2015
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.79 KB | None | 0 0
  1. /*
  2.                                     | - - - - - - - - - - - - - - - |
  3.                                     | Halloween Event Filterscript  |
  4.                                     | Credits: Edison               |
  5.                                     | @ 2015 FilterScript           |
  6.                                     | - - - - - - - - - - - - - - - |
  7.  
  8. * RO: Un subscribe aici (https://www.youtube.com/channel/UCL1mkOOQe15fvwzfaMzfdcw) m-ar ajuta foarte mult. Multumesc!
  9. * EN: An subscribe here (https://www.youtube.com/channel/UCL1mkOOQe15fvwzfaMzfdcw) it would help a lot. Thank you!
  10.  
  11. */
  12.  
  13. #define FILTERSCRIPT
  14.  
  15. #include <a_samp>
  16.  
  17. #define COLOR_DARKMAUVE 0x623778FF
  18. #define COLOR_MAUVE 0x845F96FF
  19.  
  20. new
  21.     Timer,
  22.     Pumpkin,
  23.     Winner,
  24.     Number,
  25.     Minutes;
  26.  
  27.  
  28. new Float: RandomPositions[][3] = {
  29.     {1767.807861, -1932.837402, 13.595355},
  30.     {2132.916259, -1740.313598, 17.289062},
  31.     {1803.886352, -1590.603881, 14.095897},
  32.     {1485.622680, -1665.684692, 14.610832},
  33.     {1018.429138, -1922.505737, 12.592831},
  34.     {582.102233, -1490.797119, 15.376304},
  35.     {154.038253, -1960.985351, 3.830727},
  36.     {1394.659790, -1897.151977, 13.557967},
  37.     {2360.556640, 547.272399, 2.666161},
  38.     {2561.215332, 1175.414062, 18.718933},
  39.     {1496.425415, 1011.755920, 10.904741},
  40.     {2263.547119, 1398.863281, 42.841758},
  41.     {2035.151489, 1874.851074, 12.095868},
  42.     {2013.250122, 2206.021972, 11.507675},
  43.     {1717.909667, 1623.251953, 10.052927},
  44.     {1374.580932, 2188.983642, 11.056703},
  45.     {-1538.844360, -440.330566, 6.032049},
  46.     {-1971.358764, 213.149246, 27.124874},
  47.     {-2473.870605, 399.725463, 27.800573},
  48.     {-2756.504882, 245.252899, 7.227559},
  49.     {-2541.580810, -311.954620, 27.070434},
  50.     {-2707.994873, 377.999938, 11.979453},
  51.     {-2762.185302, 613.078186, 26.277561},
  52.     {-1318.863891, 494.018798, 18.260137}
  53. };
  54.  
  55. static const LocationsName[][256] = {
  56.     {"El Corona (LS)"},
  57.     {"Idlewood (LS)"},
  58.     {"Little Mexico (LS)"},
  59.     {"Pershing Square (LS)"},
  60.     {"Verona Beach (LS)"},
  61.     {"Rodeo (LS)"},
  62.     {"Santa Maria Beach (LS)"},
  63.     {"Verdant Bluffs (LS)"},
  64.     {"Red County (LV)"},
  65.     {"Come-A-Lot (LV)"},
  66.     {"LVA Freight Depot (LV)"},
  67.     {"Royal Casino (LV)"},
  68.     {"The Visage (LV)"},
  69.     {"The Emerald Isle (LV)"},
  70.     {"Las Venturas Airport (LV)"},
  71.     {"Redsands West (LV)"},
  72.     {"Easter Bay Airport (SF)"},
  73.     {"Cranberry Station (SF)"},
  74.     {"Queens (SF)"},
  75.     {"Ocean Flats (SF)"},
  76.     {"Avispa Country Club (SF)"},
  77.     {"City Hall (SF)"},
  78.     {"Palisades (SF)"},
  79.     {"Easter Basin (SF)"}
  80. };
  81.  
  82. #if defined FILTERSCRIPT
  83. public OnFilterScriptInit()
  84. {
  85.     Timer = SetTimer("HalloweenEvent", 600000, true);
  86.  
  87.     print("\nHalloween Event Filterscript loaded. (100%)");
  88.     print("Credits: Edison #NZTeam\n");
  89.     return 1;
  90. }
  91.  
  92. public OnFilterScriptExit()
  93. {
  94.     KillTimer(Timer);
  95.     return 1;
  96. }
  97.  
  98. #else
  99.  
  100. main()
  101. {
  102.     print("\n----------------------------------");
  103.     print(" Blank Gamemode by your name here");
  104.     print("----------------------------------\n");
  105. }
  106.  
  107. #endif
  108.  
  109. public OnGameModeInit()
  110. {
  111.     // Don't use these lines if it's a filterscript
  112.     SetGameModeText("Blank Script");
  113.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  114.     return 1;
  115. }
  116.  
  117. public OnGameModeExit()
  118. {
  119.     return 1;
  120. }
  121.  
  122. public OnPlayerRequestClass(playerid, classid)
  123. {
  124.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  125.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  126.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerConnect(playerid)
  131. {
  132.     return 1;
  133. }
  134.  
  135. public OnPlayerDisconnect(playerid, reason)
  136. {
  137.     return 1;
  138. }
  139.  
  140. public OnPlayerSpawn(playerid)
  141. {
  142.     return 1;
  143. }
  144.  
  145. public OnPlayerDeath(playerid, killerid, reason)
  146. {
  147.     return 1;
  148. }
  149.  
  150. public OnVehicleSpawn(vehicleid)
  151. {
  152.     return 1;
  153. }
  154.  
  155. public OnVehicleDeath(vehicleid, killerid)
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnPlayerText(playerid, text[])
  161. {
  162.     return 1;
  163. }
  164.  
  165. public OnPlayerCommandText(playerid, cmdtext[])
  166. {
  167.     if(strcmp("/gotopumpkin", cmdtext, true, 10) == 0)
  168.     {
  169.         if(!IsPlayerAdmin(playerid)) return 1;
  170.         if(Winner == 1) return SendClientMessage(playerid, -1, "There is no pumpkin spawn.");
  171.         if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid), RandomPositions[Number][0], RandomPositions[Number][1]+5, RandomPositions[Number][2]);
  172.         else SetPlayerPos(playerid, RandomPositions[Number][0], RandomPositions[Number][1]+5, RandomPositions[Number][2]);
  173.         SendClientMessage(playerid, -1, "You've been teleported near the pumpkin.");
  174.         return 1;
  175.     }
  176.  
  177.     if(strcmp("/test", cmdtext, true, 10) == 0)
  178.     {
  179.         HalloweenEvent();
  180.         KillTimer(Timer);
  181.         Timer = SetTimer("HalloweenEvent", 600000, true);
  182.         return 1;
  183.     }  
  184.     return 0;
  185. }
  186.  
  187. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  188. {
  189.     return 1;
  190. }
  191.  
  192. public OnPlayerExitVehicle(playerid, vehicleid)
  193. {
  194.     return 1;
  195. }
  196.  
  197. public OnPlayerStateChange(playerid, newstate, oldstate)
  198. {
  199.     return 1;
  200. }
  201.  
  202. public OnPlayerEnterCheckpoint(playerid)
  203. {
  204.     return 1;
  205. }
  206.  
  207. public OnPlayerLeaveCheckpoint(playerid)
  208. {
  209.     return 1;
  210. }
  211.  
  212. public OnPlayerEnterRaceCheckpoint(playerid)
  213. {
  214.     return 1;
  215. }
  216.  
  217. public OnPlayerLeaveRaceCheckpoint(playerid)
  218. {
  219.     return 1;
  220. }
  221.  
  222. public OnRconCommand(cmd[])
  223. {
  224.     return 1;
  225. }
  226.  
  227. public OnPlayerRequestSpawn(playerid)
  228. {
  229.     return 1;
  230. }
  231.  
  232. public OnObjectMoved(objectid)
  233. {
  234.     return 1;
  235. }
  236.  
  237. public OnPlayerObjectMoved(playerid, objectid)
  238. {
  239.     return 1;
  240. }
  241.  
  242. public OnVehicleMod(playerid, vehicleid, componentid)
  243. {
  244.     return 1;
  245. }
  246.  
  247. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  248. {
  249.     return 1;
  250. }
  251.  
  252. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  253. {
  254.     return 1;
  255. }
  256.  
  257. public OnPlayerSelectedMenuRow(playerid, row)
  258. {
  259.     return 1;
  260. }
  261.  
  262. public OnPlayerExitedMenu(playerid)
  263. {
  264.     return 1;
  265. }
  266.  
  267. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  268. {
  269.     return 1;
  270. }
  271.  
  272. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  273. {
  274.     return 1;
  275. }
  276.  
  277. public OnRconLoginAttempt(ip[], password[], success)
  278. {
  279.     return 1;
  280. }
  281.  
  282. public OnPlayerUpdate(playerid)
  283. {
  284.     return 1;
  285. }
  286.  
  287. public OnPlayerStreamIn(playerid, forplayerid)
  288. {
  289.     return 1;
  290. }
  291.  
  292. public OnPlayerStreamOut(playerid, forplayerid)
  293. {
  294.     return 1;
  295. }
  296.  
  297. public OnVehicleStreamIn(vehicleid, forplayerid)
  298. {
  299.     return 1;
  300. }
  301.  
  302. public OnVehicleStreamOut(vehicleid, forplayerid)
  303. {
  304.     return 1;
  305. }
  306.  
  307. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  308. {
  309.     return 1;
  310. }
  311.  
  312. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  313. {
  314.     return 1;
  315. }
  316.  
  317.  
  318.  
  319. public OnPlayerPickUpPickup(playerid, pickupid)
  320. {
  321.     if(pickupid == Pumpkin)
  322.     {
  323.         DestroyPickup(Pumpkin);
  324.  
  325.         new
  326.             string[256],
  327.             randmoney = 50000 + random(10000),
  328.             name[MAX_PLAYER_NAME],
  329.             Hour, Minute, Second;
  330.  
  331.         Winner = 1;
  332.         GetPlayerName(playerid, name, sizeof(name));
  333.         format(string, sizeof(string), "> Pumpkin was found by %s. His wish him congratulations!", name);
  334.         SendClientMessageToAll(COLOR_MAUVE, string);
  335.         gettime(Hour, Minute, Second);
  336.         format(string, sizeof(string), "> A new pumpkin will be hidden in %d minutes.", Minutes-Minute+10);
  337.         SendClientMessageToAll(COLOR_MAUVE, string);       
  338.         format(string, sizeof(string), "You won the sum of $%d", randmoney);
  339.         SendClientMessage(playerid, 0x2C8522FF, string);
  340.         GivePlayerMoney(playerid, randmoney);
  341.     }
  342.     return 1;
  343. }
  344.  
  345.  
  346. forward HalloweenEvent();
  347. public HalloweenEvent()
  348. {
  349.     new
  350.         string[256],
  351.         rand = random(sizeof(RandomPositions));
  352.  
  353.     if(Winner == 0) {
  354.         DestroyPickup(Pumpkin);
  355.         SendClientMessageToAll(-1, "Nobody has found the pumpkin.");
  356.     }
  357.  
  358.     Winner = 0;
  359.     Number = rand;
  360.     Pumpkin = CreatePickup(19320, 21, RandomPositions[rand][0], RandomPositions[rand][1], RandomPositions[rand][2]);
  361.  
  362.     SendClientMessageToAll(COLOR_DARKMAUVE, "[Halloween Event]:");
  363.     format(string, sizeof(string), "> A new pumpkin was hidding in the area: %s.", LocationsName[rand]);
  364.     SendClientMessageToAll(COLOR_MAUVE, string);
  365.     SendClientMessageToAll(COLOR_MAUVE, "> You have 10 minutes to find this pumpkin.");
  366.  
  367.     new Hour, Minute, Second;
  368.     gettime(Hour, Minute, Second);
  369.     Minutes = Minute;
  370.     return 1;
  371. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement