Guest User

roban

a guest
Apr 8th, 2009
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. /* /robstore command
  2. thought of and scripted
  3. by Ryan Undering */
  4. //==============================================================================
  5. #include <a_samp>
  6.  
  7. #define Grey 0xAFAFAFAA
  8. #define Red 0xFF6347AA
  9. #define Yellow 0xFFFF00A
  10. #define robumont 20000
  11.  
  12. new StoreRobed[MAX_PLAYERS];
  13. new Robber[MAX_PLAYERS];
  14. new rob;
  15. new rob1;
  16. new rob2;
  17. new robbing;
  18.  
  19. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  20. forward StoreRob1();
  21. forward StoreRob2();
  22. forward StoreRob3();
  23. forward RobAgain();
  24. //=====================================================================================================
  25.  
  26. public OnFilterScriptInit()
  27. {
  28. robbing = 0;
  29. print(" Loading /robstore Command ");
  30. SetTimer("RobAgain2",1800000,1);
  31. return 1;
  32. }
  33.  
  34. public OnFilterScriptExit()
  35. {
  36. print(" Unloading /robstore Command ");
  37. return 1;
  38. }
  39.  
  40. public OnPlayerConnect(playerid)
  41. {
  42. StoreRobed[playerid] = 0;
  43. Robber[playerid] = 0;
  44. return 1;
  45. }
  46.  
  47. public OnPlayerCommandText(playerid, cmdtext[])
  48. {
  49. if (strcmp("/robstore", cmdtext, true, 10) == 0)
  50. {
  51. if (robbing == 1)
  52. {
  53. SendClientMessage(playerid, Red,"Someone are currently robbing the store!");
  54. return 1;
  55. }
  56. if(PlayerToPoint(20, playerid, -28.4819,-89.3805,1003.5469))
  57. {
  58. }
  59. else
  60. {
  61. SendClientMessage(playerid, Red,"you moust be in the store to rob it!");
  62. return 1;
  63. }
  64. if(StoreRobed[playerid] == 0)
  65. {
  66. SendClientMessageToAll(Red,"The 24/7 is being robbed, go check it out!");
  67. SendClientMessage(playerid, Yellow,"You have started to rob the store, Cops have been noted");
  68. SendClientMessage(playerid, Red,"Stay in the store for 1 min so you can claim the cash!");
  69. Robber[playerid] = 1;
  70. robbing = 1;
  71. StoreRobed[playerid] =1;
  72. rob = SetTimer("StoreRob1", 20000, 1);
  73. }
  74. return 1;
  75. }
  76. return 0;
  77. }
  78.  
  79. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  80. {
  81. if(IsPlayerConnected(playerid))
  82. {
  83. new Float:oldposx, Float:oldposy, Float:oldposz;
  84. new Float:tempposx, Float:tempposy, Float:tempposz;
  85. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  86. tempposx = (oldposx -x);
  87. tempposy = (oldposy -y);
  88. tempposz = (oldposz -z);
  89. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  90. {
  91. return 1;
  92. }
  93. }
  94. return 0;
  95. }
  96.  
  97. public StoreRob1()
  98. {
  99. for(new i = 0; i < MAX_PLAYERS; i++)
  100. if(Robber[i] == 1)
  101. {
  102. if(PlayerToPoint(30, i, -28.4819,-89.3805,1003.5469))
  103. {
  104. SendClientMessage(i, Yellow," 20 seconds has gone");
  105. KillTimer(rob);
  106. rob1 = SetTimer("StoreRob2",20000,1);
  107. return 1;
  108. }
  109. else
  110. {
  111. SendClientMessage(i, Grey,"You ran like a little girl");
  112. Robber[i] = 0;
  113. robbing = 0;
  114. return 1;
  115. }
  116. }
  117. return 1;
  118. }
  119.  
  120. public StoreRob2()
  121. {
  122. for(new i = 0; i < MAX_PLAYERS; i++)
  123. if(Robber[i] == 1)
  124. {
  125. if(PlayerToPoint(30, i, -28.4819,-89.3805,1003.5469))
  126. {
  127. SendClientMessage(i, Yellow," 40 sekunds has gone");
  128. KillTimer(rob1);
  129. rob2 = SetTimer("StoreRob3",20000,1);
  130. return 1;
  131. }
  132. else
  133. {
  134. SendClientMessage(i, Grey,"You ran like a little girl");
  135. Robber[i] = 0;
  136. robbing = 0;
  137. return 1;
  138. }
  139. }
  140. return 1;
  141. }
  142.  
  143. public StoreRob3()
  144. {
  145. for(new i = 0; i < MAX_PLAYERS; i++)
  146. if(Robber[i] == 1)
  147. {
  148. if(PlayerToPoint(30, i, -28.4819,-89.3805,1003.5469))
  149. {
  150. new pname[MAX_PLAYER_NAME];
  151. GetPlayerName(i, pname, sizeof(pname));
  152. new pcash = robumont;
  153. new robcash = random(pcash);
  154. new string[256];
  155. GetPlayerName(i, pname, sizeof(pname));
  156. format(string, sizeof(string), "You have Robbed the Store, well done, you get $%d", robcash);
  157. SendClientMessage(i, Yellow, string);
  158. GivePlayerMoney(i,robcash);
  159. Robber[i] = 0;
  160. robbing = 0;
  161. KillTimer(rob2);
  162. return 1;
  163. }
  164. else
  165. {
  166. SendClientMessage(i, Grey,"You ran like a little girl");
  167. Robber[i] = 0;
  168. robbing = 0;
  169. return 1;
  170. }
  171. }
  172. return 1;
  173. }
  174.  
  175. public RobAgain()
  176. {
  177. for(new i = 0; i < MAX_PLAYERS; i++)
  178. StoreRobed[i] =0;
  179. }
Advertisement
Add Comment
Please, Sign In to add comment