Advertisement
spenzo

Stocks - Spenzo / Darnell v1.1

Sep 10th, 2011
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.04 KB | None | 0 0
  1. /*
  2.  
  3.                          #####  ####### #######  #####  #    #  #####
  4.                         #     #    #    #     # #     # #   #  #     #
  5.                         #          #    #     # #       #  #   #
  6.                          #####     #    #     # #       ###     #####
  7.                               #    #    #     # #       #  #         #
  8.                         #     #    #    #     # #     # #   #  #     #
  9.                          #####     #    #######  #####  #    #  #####
  10.  
  11.  
  12.                                     Developed by
  13.                                                 Spenzo(Darnell) AKA Daniel Rubin
  14.         THIS CODE IS PROTECTED BY COPYRIGHT LAWS, DISTRIBUTION OR USAGE OF ANY
  15.         OF THE CODE WITHOUT THE WRITTEN PERMISSION OF ITS AUTHOR (Daniel Rubin) IS
  16.         IS AGAINST THE LAW AND A VIOLATION OF COPYRIGHT LAWS.
  17.  
  18.         Information:
  19.     Everything inside this file is owned by Daniel Rubin( darnell@hotmail.co.il )
  20.     it can be used by third parties with the agreement of the author.
  21.     If anything inside this file ain't entitled to the creator ( Daniel Rubin )
  22.     it will be said clearly next to the content.
  23.  
  24.     If you got this script you agree with the following terms of usage:
  25.  
  26.     1. Should the author, (Daniel Rubin) at any time request the file or removal
  27.     of the file you have to do it as soon as possible.
  28.  
  29.     2. Credits must stay, DON'T EVER say you did this work, however you are welcome to add your name to the stuff you've done.
  30.  
  31.     Author: Daniel Rubin(Darnell / Spenzo )
  32.  
  33. ==============================================================================*/
  34.  
  35. #include <a_samp>
  36.  
  37. #define SpawnPosFile "SpawnPositions.txt"
  38. #define MAX_RANDOM_POSITIONS 100
  39.  
  40. //Countdown
  41. new IsCountdownStarted;
  42. new IsPlayerCountdownStarted[MAX_PLAYERS];
  43. new PlayerCountdownCount[MAX_PLAYERS];
  44. new CountdownCount;
  45. new PlayerCountdownTimer[MAX_PLAYERS];
  46. new CountdownTimer;
  47. new bool:HasPlayerSpawned[MAX_PLAYERS];
  48.  
  49. //PocketMoney:
  50. new IsPocketMoneyEnabled;
  51. new IsPocketMoneyMessageEnabled = 1;
  52. new PocketMoneyAmount;
  53. new PocketMoneyTimer;
  54.  
  55. //RandomSpawn
  56. new RPCount;
  57. enum rsinfo
  58. {
  59.     Float:RSX,
  60.     Float:RSY,
  61.     Float:RSZ,
  62.     Float:RSA,
  63.     RSinterior,
  64.     RSvirtualworld,
  65. }
  66. new RandomSpawnInfo[MAX_RANDOM_POSITIONS][rsinfo];
  67.  
  68.  
  69. //Other
  70. enum resprayinfo
  71. {
  72.     Float:ResprayX,
  73.     Float:ResprayY,
  74.     Float:ResprayZ,
  75.     Float:ResprayA
  76. }
  77. new ResprayInfo[MAX_VEHICLES][resprayinfo];
  78. enum splayerinfo
  79. {
  80.     Float:SavedX,
  81.     Float:SavedY,
  82.     Float:SavedZ,
  83.     Float:SavedA,
  84.     SavedInterior
  85. }
  86. new SPlayerInfo[MAX_PLAYERS][splayerinfo];
  87.  
  88.  
  89.  
  90. /*
  91.  
  92.                 // Countdown natives
  93.                 native CreateCountdown(time, sound);
  94.                 native CreatePlayerCountdown(playerid, time, sound);
  95.                 native StopCountdown();
  96.                 native StopPlayerCountdown(playerid);
  97.                 // Pocket money natives
  98.                 native EnablePocketMoney(amount, frequency);
  99.                 native DisablePocketMoney();
  100.                 native SetPocketMoneyAmount(amount);
  101.                 native SetPocketMoneyFrequency(frequency);
  102.                 native TogglePocketMoneyMessage(toggle);
  103.                 // Random spawn natives
  104.                 native AddSpawnPos(Float:X, Float:Y, Float:Z, Float:Angle, Interior, VirtualWorld);
  105.                 native RandomSpawnPlayer(playerid);
  106.                 // Other random natives
  107.                 native SkydivePlayer(playerid, hight);
  108.                 native Cardive(carid, hight);
  109.                 native FlipCar(carid);
  110.                 native ResprayCar(carid);
  111.                 native SavePlayerPos(playerid);
  112.                 native LoadPlayerPos(playerid);
  113.  
  114. */
  115.  
  116.  
  117. stock CreateCountdown(time, sound)
  118. {
  119.     if(IsCountdownStarted == 0)
  120.     {
  121.         for(new i; i<MAX_PLAYERS; i++)
  122.         {
  123.             if(IsPlayerConnected(i))
  124.             {
  125.                 if(IsPlayerCountdownStarted[i] == 1)
  126.                 {
  127.                     KillTimer(PlayerCountdownTimer[i]);
  128.                     PlayerCountdownCount[i] = 0;
  129.                     IsPlayerCountdownStarted[i] = 0;
  130.                 }
  131.             }
  132.         }
  133.         CountdownTimer = SetTimerEx("Countdown", 1000, 1, "d", sound);
  134.         CountdownCount = time;
  135.         IsCountdownStarted = 1;
  136.     }
  137. }
  138. stock CreatePlayerCountdown(playerid, time, sound)
  139. {
  140.     if(IsPlayerCountdownStarted[playerid] == 0 && IsCountdownStarted == 0)
  141.     {
  142.         PlayerCountdownTimer[playerid] = SetTimerEx("PlayerCountdown", 1000, 1, "id", playerid, sound);
  143.         PlayerCountdownCount[playerid] = time;
  144.         IsPlayerCountdownStarted[playerid] = 1;
  145.     }
  146. }
  147. stock StopCountdown()
  148. {
  149.     KillTimer(CountdownTimer);
  150.     GameTextForAll(" ", 10, 3);
  151.     CountdownCount = 0;
  152.     IsCountdownStarted = 0;
  153. }
  154. stock StopPlayerCountdown(playerid)
  155. {
  156.     KillTimer(PlayerCountdownTimer[playerid]);
  157.     GameTextForPlayer(playerid, " ", 10, 3);
  158.     PlayerCountdownCount[playerid] = 0;
  159.     IsPlayerCountdownStarted[playerid] = 0;
  160. }
  161.  
  162. stock EnablePocketMoney(amount, frequency)
  163. {
  164.     if(IsPocketMoneyEnabled==0)
  165.     {
  166.         PocketMoneyTimer = SetTimer("PocketMoney", (frequency*1000), 1);
  167.         IsPocketMoneyEnabled = 1;
  168.         PocketMoneyAmount = amount;
  169.  
  170.     }
  171. }
  172. stock DisablePocketMoney()
  173. {
  174.     if(IsPocketMoneyEnabled==1)
  175.     {
  176.         KillTimer(PocketMoneyTimer);
  177.         IsPocketMoneyEnabled = 0;
  178.     }
  179. }
  180. stock SetPocketMoneyAmount(amount)
  181. {
  182.     PocketMoneyAmount = amount;
  183. }
  184.  
  185. stock SetPocketMoneyFrequency(frequency)
  186. {
  187.     KillTimer(PocketMoneyTimer);
  188.     PocketMoneyTimer = SetTimer("PocketMoney", (frequency*1000), 1);
  189. }
  190.  
  191. stock TogglePocketMoneyMessage(toggle)
  192. {
  193.     IsPocketMoneyMessageEnabled = toggle;
  194. }
  195.  
  196. stock SkydivePlayer(playerid, hight)
  197. {
  198.     new Float:SDX, Float:SDY, Float:SDZ;
  199.     GetPlayerPos(playerid, SDX, SDY, SDZ);
  200.     GivePlayerWeapon(playerid, 46, 1);
  201.     SetPlayerPos(playerid, SDX, SDY, (SDZ+hight));
  202. }
  203. stock Cardive(carid, hight)
  204. {
  205.     new Float:SDX, Float:SDY, Float:SDZ;
  206.     GetVehiclePos(carid, SDX, SDY, SDZ);
  207.     SetVehiclePos(carid, SDX, SDY, (SDZ+hight));
  208. }
  209. stock FlipCar(carid)
  210. {
  211.     new Float:FCX, Float:FCY, Float:FCZ, Float:FCA;
  212.     GetVehiclePos(carid, FCX, FCY, FCZ);
  213.     GetVehicleZAngle(carid, FCA);
  214.     SetVehiclePos(carid, FCX, FCY, (FCZ+1.0));
  215.     SetVehicleZAngle(carid, FCA);
  216. }
  217. stock ResprayCar(carid)
  218. {
  219.     GetVehiclePos(carid, ResprayInfo[carid][ResprayX], ResprayInfo[carid][ResprayY], ResprayInfo[carid][ResprayZ]);
  220.     GetVehicleZAngle(carid, ResprayInfo[carid][ResprayA]);
  221.     SetTimerEx("ResprayDone", 4000, 0, "i", carid);
  222.     SetVehiclePos(carid, 1024.8990,-1024.7573,31.7264);
  223.     SetVehicleZAngle(carid, 0);
  224. }
  225.  
  226. stock SavePlayerPos(playerid)
  227. {
  228.     GetPlayerPos(playerid, SPlayerInfo[playerid][SavedX], SPlayerInfo[playerid][SavedY], SPlayerInfo[playerid][SavedZ]);GetVehiclePos(playerid,SPlayerInfo[playerid][SavedX], SPlayerInfo[playerid][SavedY], SPlayerInfo[playerid][SavedZ]);
  229.     GetPlayerFacingAngle(playerid, SPlayerInfo[playerid][SavedA]);GetVehicleZAngle(playerid, SPlayerInfo[playerid][SavedA]);
  230.     SPlayerInfo[playerid][SavedInterior] = GetPlayerInterior(playerid);
  231. }
  232. stock LoadPlayerPos(playerid)
  233. {
  234.                  SetPlayerInterior(playerid, SPlayerInfo[playerid][SavedInterior]);
  235.                  SetPlayerPos(playerid, SPlayerInfo[playerid][SavedX], SPlayerInfo[playerid][SavedY], SPlayerInfo[playerid][SavedZ]);SetVehiclePos(playerid, SPlayerInfo[playerid][SavedX], SPlayerInfo[playerid][SavedY], SPlayerInfo[playerid][SavedZ]);SetPlayerFacingAngle(playerid, SPlayerInfo[playerid][SavedA]);SetVehicleZAngle(playerid, SPlayerInfo[playerid][SavedA]);
  236.  
  237. }
  238.  
  239. stock AddSpawnPos(Float:X, Float:Y, Float:Z, Float:Angle, Interior, VirtualWorld)
  240. {
  241.     RandomSpawnInfo[RPCount][RSX] = X;
  242.     RandomSpawnInfo[RPCount][RSY] = Y;
  243.     RandomSpawnInfo[RPCount][RSZ] = Z;
  244.     RandomSpawnInfo[RPCount][RSA] = Angle;
  245.     RandomSpawnInfo[RPCount][RSinterior] = Interior;
  246.     RandomSpawnInfo[RPCount][RSvirtualworld] = VirtualWorld;
  247.     RPCount++;
  248. }
  249.  
  250. stock RandomSpawnPlayer(playerid)
  251. {
  252.     new randompos = random(RPCount);
  253.     SetPlayerVirtualWorld(playerid, RandomSpawnInfo[randompos][RSvirtualworld]);
  254.     SetPlayerInterior(playerid, RandomSpawnInfo[randompos][RSinterior]);
  255.     SetPlayerPos(playerid, RandomSpawnInfo[randompos][RSX], RandomSpawnInfo[randompos][RSY], RandomSpawnInfo[randompos][RSZ]);
  256.     SetPlayerFacingAngle(playerid, RandomSpawnInfo[randompos][RSA]);
  257.     SetCameraBehindPlayer(playerid);
  258. }
  259.  
  260. stock GetPlayersInTeamFromMaxPlayers(teamid)
  261. {
  262.     new playercount = 0;
  263.     for(new i = 0; i < MAX_PLAYERS; i++)
  264.     {
  265.         if(HasPlayerSpawned[i] == false) continue;
  266.         if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
  267.         if(gTeam[i] != teamid) continue;
  268.         playercount++;
  269.     }
  270.     return playercount;
  271. }
  272.  
  273. forward Countdown(sound);
  274. public Countdown(sound)
  275. {
  276.     if(CountdownCount == 0)
  277.     {
  278.         if(sound == 1)
  279.         {
  280.             for(new i; i<MAX_PLAYERS; i++)
  281.             {
  282.                 if(IsPlayerConnected(i))
  283.                 {
  284.                     PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  285.                 }
  286.             }
  287.         }
  288.         GameTextForAll("~r~GoGoGo", 2000, 3);
  289.         KillTimer(CountdownTimer);
  290.         IsCountdownStarted = 0;
  291.     }
  292.     else
  293.     {
  294.         if(sound == 1)
  295.         {
  296.             for(new i; i<MAX_PLAYERS; i++)
  297.             {
  298.                 if(IsPlayerConnected(i))
  299.                 {
  300.                     PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  301.                 }
  302.             }
  303.         }
  304.         new cdstring[128];
  305.         format(cdstring, sizeof(cdstring), "~y~%d", CountdownCount);
  306.         GameTextForAll(cdstring, 1500, 3);
  307.         CountdownCount--;
  308.     }
  309. }
  310.  
  311. forward PlayerCountdown(playerid, sound);
  312. public PlayerCountdown(playerid, sound)
  313. {
  314.     if(PlayerCountdownCount[playerid] == 0)
  315.     {
  316.         if(sound == 1) PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
  317.         GameTextForPlayer(playerid,"~n~~n~~r~GoGoGo", 2000, 3);
  318.         KillTimer(PlayerCountdownTimer[playerid]);
  319.         IsPlayerCountdownStarted[playerid] = 0;
  320.     }
  321.     else
  322.     {
  323.         if(sound == 1) PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  324.         new pcdstring[128];
  325.         format(pcdstring, sizeof(pcdstring), "~n~~g~%d", PlayerCountdownCount[playerid]);
  326.         GameTextForPlayer(playerid, pcdstring, 1500, 3);
  327.         PlayerCountdownCount[playerid]--;
  328.     }
  329. }
  330.  
  331. forward PocketMoney(playerid);
  332. public PocketMoney(playerid)
  333. {
  334.     if(IsPocketMoneyMessageEnabled == 1)
  335.     {
  336.     new pmstring[128];
  337.     format(pmstring, sizeof(pmstring), "~r~Pocket ~y~Money ~n~ ~y~%s~g~$",PocketMoneyAmount);
  338.     GameTextForAll(pmstring,2000,5);
  339.     }
  340.     if(IsPlayerConnected(playerid))
  341.     {
  342.     GivePlayerMoney(playerid,  PocketMoneyAmount);
  343.     }
  344.  
  345. }
  346.  
  347. forward ResprayDone(carid);
  348. public ResprayDone(carid)
  349. {
  350.     SetVehiclePos(carid, ResprayInfo[carid][ResprayX], ResprayInfo[carid][ResprayY], ResprayInfo[carid][ResprayZ]);
  351.     SetVehicleZAngle(carid, ResprayInfo[carid][ResprayA]);
  352. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement