Guest User

Danny

a guest
Feb 18th, 2009
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 228.40 KB | None | 0 0
  1. //******************************************************************************
  2. // Gamemode: Las Venturas Arena (LVA)
  3. //
  4. // 20/08/2007, 8:24 p.m
  5. // lva.pwn, littlewhitey Scripting Team.
  6. //******************************************************************************
  7.  
  8. #include <a_samp>
  9.  
  10. #include "lva_inc\lva_h.pwn"
  11.  
  12. #include <MidoStream>
  13.  
  14. //******************************************************************************
  15. // Callbacks: SA:MP
  16. //******************************************************************************
  17.  
  18. main( )
  19. {
  20. print( "\n==============================================================================");
  21. print( "| " SZ_GAMEMODE_S_NAME " v" #VERSION_MAJOR "." #VERSION_MINOR "." #VERSION_BUILD );
  22. print( "| Credits:" );
  23. print( "| \tadamcs, Brandon, jacob, jax, LnX," );
  24. print( "| \tlittlewhitey, Mike, Peter, Sintax, Simon" );
  25. print( "| Options:" );
  26. print( "| \tMAX_RANDOM_PICKUPS = " #MAX_RANDOM_PICKUPS ", MAX_SCRIPT_ZONES = " #MAX_SCRIPT_ZONES "" );
  27. print( "| \tMAX_GANG_NAME = " #MAX_GANG_NAME ", MAX_GANGS = " #MAX_GANGS ", MAX_ZONE_TICKS = " #MAX_ZONE_TICKS "" );
  28. print( "| \tMAX_GANG_MEMBERS = " #MAX_GANG_MEMBERS ", WEP_LIMIT = " #WEP_LIMIT"" );
  29. print( "| \tPOCKET_MONEY = " #POCKET_MONEY ", TEAM_INTERIOR = " #TEAM_INTERIOR "" );
  30. print( "==============================================================================\n");
  31. #if VERSION_LITE == true
  32. print( "==============================================================================" );
  33. print( "| \tLite Version" );
  34. print( "==============================================================================" );
  35. #endif
  36. }
  37.  
  38. //******************************************************************************
  39. // Callbacks: SA:MP
  40. //******************************************************************************
  41.  
  42. public OnGameModeInit( )
  43.  
  44. {
  45. #if VERSION_LITE == false
  46. SetGameModeText ( "" SZ_GAMEMODE_S_NAME " v" #VERSION_MAJOR "." #VERSION_MINOR "." #VERSION_BUILD "" );
  47. #else
  48. SetGameModeText ( "Lite: " SZ_GAMEMODE_S_NAME " v" #VERSION_MAJOR "." #VERSION_MINOR "." #VERSION_BUILD "" );
  49. #endif
  50.  
  51. // Options
  52. UsePlayerPedAnims ( );
  53. AllowInteriorWeapons( 1 );
  54. SetWorldTime ( sHour );
  55. EnableZoneNames ( 1 );
  56. EnableTirePopping ( 1 );
  57. SetDisabledWeapons (
  58. 1, 4, 6, 7, 8, 9,
  59. 14, 15, 35, 36, 37,
  60. 38, 39, 41, 43, 44, 45
  61. );
  62.  
  63. // Menus
  64. GenerateMenus( );
  65.  
  66. sMaxPlayers = GetMaxPlayers( );
  67.  
  68. if ( sMaxPlayers > MAX_PLAYERS )
  69. {
  70. SendClientMessageToAll ( COLOR_RED, "RUNTIME ERROR: The script's MAX_PLAYERS is less than the servers set maximum players." );
  71. SendClientMessageToAll ( COLOR_RED, "Kicking all players on connect ..." );
  72. printf ( "RUNTIME ERROR: The script's MAX_PLAYERS (%d) is less than the servers set maximum players (%d).\r\nKicking all players on connect ...", MAX_PLAYERS, sMaxPlayers );
  73.  
  74. sGameModeExit = 1;
  75. }
  76.  
  77. // Spawns
  78. for ( new i = 280; i < 300; i++ )
  79. if ( IsValidSkin( i ) ) AddPlayerClass( i, 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );
  80.  
  81. for ( new i = 0; i < 280; i++ )
  82. {
  83. // 217 - Male Staff
  84. // 211 - Female Staff
  85.  
  86. if ( IsValidSkin( i ) && i != 217 && i != 211 ) AddPlayerClass( i,1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );
  87. }
  88.  
  89. new gate;
  90.  
  91. AddStaticVehicle(538,1466.7051,2634.2603,10.5424,269.5424,1,1); // Brown Streak!
  92.  
  93. gate = CreateObject(980, 528.965149, 2975.480713, 5.272058, 0.0001, 0.0000, 0.0000, 500);
  94.  
  95. loadV_Admin ( );
  96.  
  97. new
  98. vSet = random( 2 );
  99.  
  100.  
  101.  
  102. switch ( vSet )
  103. {
  104. case 0:
  105. {
  106. print ( "Simon's Vehicle set loaded ..." );
  107. SendClientMessageToAdmins( COLOR_RED, "Simon's Vehicle set loaded ..." );
  108.  
  109. loadV_Simon( );
  110. }
  111.  
  112. case 1:
  113. {
  114. print ( "adamcs's Vehicle set loaded ..." );
  115. SendClientMessageToAdmins( COLOR_RED, "adamcs's Vehicle set loaded ..." );
  116.  
  117. loadV_adamcs( );
  118. }
  119.  
  120. }
  121.  
  122. // Pickups
  123. AddStaticPickup( 371, 15, 1710.3359, 1614.3585, 10.1191 ); // Parachute
  124. AddStaticPickup( 371, 15, 1964.4523, 1917.0341, 130.9375 ); // Parachute
  125. AddStaticPickup( 371, 15, 2055.7258, 2395.8589, 150.4766 ); // Parachute
  126. AddStaticPickup( 371, 15, 2265.0120, 1672.3837, 94.9219 ); // Parachute
  127. AddStaticPickup( 371, 15, 2265.9739, 1623.4060, 94.9219 ); // Parachute
  128. AddStaticPickup( 366, 15, 381.978, -56.9461, 1001.49 ); // Fire Extinguisher
  129. AddStaticPickup( 366, 15, 379.485, -116.57, 1001.33 ); // Fire Extinguisher
  130. AddStaticPickup( 366, 15, 381.444, -188.315, 1000.56 ); // Fire Extinguisher
  131.  
  132. sStrip[ 0 ] = CreatePickup( 1239, DEFAULT_PICKUP_TYPE, 1214.0721, -27.1754, 1000.953 ); // Strip Info Icon
  133. sStrip[ 1 ] = CreatePickup( 1239, DEFAULT_PICKUP_TYPE, 1220.6227, -6.2027, 1001.3281 ); // Strip Info Icon
  134. sBeer = CreatePickup( 1484, DEFAULT_PICKUP_TYPE, 508.2607, -70.2400, 998.7578 ); // Beer
  135. sPirate = CreatePickup( 1239, DEFAULT_PICKUP_TYPE, 1999.5806, 1540.4535, 13.5859 ); // Pirate Info Icon
  136.  
  137. #if NEW_PIRATE_MODE == true
  138. sPirateBriefcase = CreatePickup( 1210, DEFAULT_PICKUP_TYPE, 2002.7188,1548.1165,13.5859 ); // Pirate Briefcase
  139. sPirateBriefcaseObj = CreateObject( 1318,2002.7188, 1548.1165, 0.0, 0.0, 0.0, 0.0 ); // Pirate Arrow
  140. #endif
  141.  
  142. // Pirate Ship
  143. CreateObject( 8493,1957.396,1510.484,24.975,0.0,0.0,-159.141 ); // Pirateship
  144. CreateObject( 9159,1957.351,1510.507,24.959,0.0,0.0,200.781 ); // Pirateship_Sales&Fence
  145. CreateObject( 3886,1991.424,1540.095,11.605,0.0,0.0,293.841 ); // Boardwalk1
  146. CreateObject( 3886,1984.211,1536.949,11.580,0.0,0.0,112.577 ); // Boardwalk2
  147. CreateObject( 3886,1962.288,1527.296,11.705,0.0,0.0,113.463 ); // Boardwalk3
  148. CreateObject( 3886,1969.436,1530.477,11.680,0.0,0.0,293.841 ); // Boardwalk4
  149. CreateStreamObject(18450, 529.580444, 2940.707031, 2.154917, 0.0000, 0.0000, 91.1002, 500);
  150. CreateStreamObject(972, 539.932739, 2961.642090, 3.167329, 0.0000, 0.0000, 181.3414, 500);
  151. CreateStreamObject(972, 518.276550, 2957.253418, 2.495549, 0.0000, 0.0000, 0.9635, 500);
  152. CreateStreamObject(3471, 535.665405, 2971.247314, 3.975207, 0.0000, 0.0000, 272.4414, 500);
  153. CreateStreamObject(3471, 522.337830, 2971.232910, 3.965939, 0.0000, 0.0000, 272.4414, 500);
  154. CreateStreamObject(3265, 332.347565, 2902.356689, 47.250912, 0.0000, 0.0000, 304.9961, 500);
  155. CreateStreamObject(3264, 331.120239, 2888.810059, 47.256485, 0.0000, 0.0000, 277.4941, 500);
  156. CreateStreamObject(3263, 331.732941, 2900.640381, 47.142097, 0.0000, 0.0000, 293.8234, 500);
  157. CreateStreamObject(3262, 331.672150, 2889.899658, 47.904926, 0.0000, 0.0000, 290.3857, 500);
  158. CreateStreamObject(3263, 332.284271, 2887.884521, 48.179077, 0.0000, 0.0000, 293.8234, 500);
  159. CreateStreamObject(3262, 332.526978, 2901.622803, 47.363609, 0.0000, 0.0000, 325.6225, 500);
  160. CreateStreamObject(3264, 331.298828, 2899.759277, 46.770351, 351.4056, 0.0000, 300.6989, 500);
  161. CreateStreamObject(3749, 528.955322, 2974.518799, 8.357082, 0.0000, 0.0000, 0.0000, 500);
  162. CreateStreamObject(8355, 528.762268, 3040.267090, 2.404432, 0.0000, 0.0000, 0.0000, 500);
  163. CreateStreamObject(8355, 488.834351, 3040.274658, 2.377510, 0.0000, 0.0000, 0.0000, 500);
  164. CreateStreamObject(8355, 568.526123, 3040.206543, 2.402510, 0.0000, 0.0000, 0.0000, 500);
  165. CreateStreamObject(7033, 528.720703, 3000.073486, 6.914360, 0.0000, 0.0000, 0.0000, 500);
  166. CreateStreamObject(7657, 539.634094, 2984.264160, 4.117431, 0.0000, 0.0000, 80.7870, 500);
  167. CreateStreamObject(7657, 518.288391, 2984.304688, 4.117431, 0.0000, 0.0000, 101.4135, 500);
  168. CreateStreamObject(4832, 477.976929, 2996.459961, 42.771812, 0.0000, 0.0000, 89.2770, 500);
  169. CreateStreamObject(16112, 451.812836, 3209.425293, -0.704814, 0.0000, 0.0000, 328.2008, 500);
  170. CreateStreamObject(6295, 454.864594, 3210.661621, 33.731281, 0.0000, 356.5623, 205.4059, 500);
  171. CreateStreamObject(11495, 473.008118, 3176.424561, 0.334400, 0.0000, 0.0000, 0.0000, 500);
  172. CreateStreamObject(11490, 487.905151, 3093.020996, 2.398193, 0.0000, 0.0000, 0.0000, 500);
  173. CreateStreamObject(11491, 487.898163, 3081.995850, 3.876512, 0.0000, 0.0000, 0.0000, 500);
  174. CreateStreamObject(3279, 543.029175, 2975.677002, 2.476206, 0.0000, 0.0000, 0.0000, 500);
  175. CreateStreamObject(3279, 514.478271, 2975.659424, 2.476206, 0.0000, 0.0000, 180.4820, 500);
  176. CreateStreamObject(16092, 528.858154, 2978.418213, 3.129929, 0.0000, 0.0000, 90.2408, 500);
  177. CreateStreamObject(1608, 529.092773, 2970.250977, 10.534138, 350.5462, 0.0000, 180.4820, 500);
  178. CreateStreamObject(13295, 483.710999, 3043.672119, 8.877621, 0.0000, 0.0000, 89.3814, 500);
  179. CreateStreamObject(976, 497.357117, 3035.636719, 2.564420, 0.0000, 0.0000, 89.3814, 500);
  180. CreateStreamObject(976, 497.447998, 3044.470947, 2.564420, 0.0000, 0.0000, 89.3814, 500);
  181. CreateStreamObject(971, 497.548920, 3052.138672, 2.147419, 0.0000, 0.0000, 89.3814, 500);
  182. CreateStreamObject(971, 492.896942, 3021.823486, 2.447420, 0.0000, 0.0000, 203.6866, 500);
  183. CreateStreamObject(3388, 491.909027, 3096.586426, 3.906005, 0.0000, 0.0000, 0.0000, 500);
  184. CreateStreamObject(3389, 491.858643, 3095.530762, 3.781005, 0.0000, 0.0000, 0.0000, 500);
  185. CreateStreamObject(3387, 491.855408, 3094.388428, 3.831005, 0.0000, 0.0000, 0.0000, 500);
  186. CreateStreamObject(3386, 491.921143, 3093.325439, 3.906005, 0.0000, 0.0000, 0.0000, 500);
  187. CreateStreamObject(3390, 483.928650, 3095.602539, 3.903787, 0.0000, 0.0000, 177.0441, 500);
  188. CreateStreamObject(3393, 483.992828, 3091.918213, 3.903787, 0.0000, 0.0000, 181.3413, 500);
  189. CreateStreamObject(3395, 491.883331, 3090.844238, 3.903787, 0.0000, 0.0000, 0.0000, 500);
  190. CreateStreamObject(16782, 492.244263, 3087.387939, 5.700567, 0.0000, 0.0000, 179.6224, 500);
  191. CreateStreamObject(16368, 497.313141, 3021.691895, 9.538343, 0.0000, 0.0000, 0.0000, 500);
  192. CreateStreamObject(16135, 420.564911, 3100.171631, 3.397173, 0.8594, 359.1406, 181.3414, 500);
  193. CreateStreamObject(7392, 528.087463, 3106.363770, 11.095679, 353.1245, 1.7189, 96.2569, 500);
  194. CreateStreamObject(1645, 510.924377, 3107.895264, 2.732737, 0.0000, 0.0000, 178.7627, 500);
  195. CreateStreamObject(1646, 512.583496, 3107.770508, 2.738019, 0.0000, 0.0000, 176.1846, 500);
  196. CreateStreamObject(1815, 511.006989, 3105.591553, 2.399767, 0.0000, 0.0000, 0.0000, 500);
  197. CreateStreamObject(2606, 487.710022, 3097.263184, 6.475637, 0.0000, 0.0000, 0.0000, 500);
  198. CreateStreamObject(2737, 483.384827, 3088.643799, 5.479940, 0.0000, 0.0000, 90.2409, 500);
  199. CreateStreamObject(1461, 502.789490, 3097.917480, 3.203723, 0.0000, 0.0000, 173.6065, 500);
  200. CreateStreamObject(9237, 543.863281, 3104.790283, 10.386020, 0.0000, 0.0000, 0.0000, 500);
  201. CreateStreamObject(16502, 484.450562, 3116.932129, -1.085353, 0.0000, 0.0000, 274.0564, 500);
  202. CreateStreamObject(17068, 484.063660, 3123.674316, 0.273655, 0.0000, 0.0000, 180.4819, 500);
  203. CreateStreamObject(17066, 521.425903, 3083.911377, 2.395308, 0.0000, 0.0000, 269.8632, 500);
  204. CreateStreamObject(9361, 507.833588, 3079.738525, 4.975886, 0.0000, 0.0000, 0.0000, 500);
  205. CreateStreamObject(5710, 529.040100, 3053.850098, 7.949216, 0.0000, 0.0000, 268.8998, 500);
  206. CreateStreamObject(5712, 531.415833, 3059.797119, 6.100138, 0.0000, 0.0000, 268.8998, 500);
  207. CreateStreamObject(5837, 528.665955, 2989.494629, 4.121926, 0.0000, 0.0000, 88.5219, 500);
  208. CreateStreamObject(6296, 529.353333, 3027.958496, 4.618508, 0.0000, 0.0000, 267.1808, 500);
  209. CreateStreamObject(8550, 541.197754, 3085.190430, 6.652513, 0.0000, 0.0000, 0.0000, 500);
  210. CreateStreamObject(8253, 567.863159, 2984.475098, 6.330297, 0.0000, 0.0000, 90.2409, 500);
  211. CreateStreamObject(17958, 529.162842, 3024.070068, 3.531190, 0.0000, 0.0000, 0.0000, 500);
  212. CreateStreamObject(705, 478.364807, 3075.749023, 2.677351, 0.0000, 0.0000, 0.0000, 500);
  213. CreateStreamObject(711, 553.117188, 3000.611816, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  214. CreateStreamObject(711, 553.141846, 3008.622803, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  215. CreateStreamObject(711, 553.247681, 3019.492188, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  216. CreateStreamObject(711, 553.180847, 3029.080322, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  217. CreateStreamObject(711, 553.129333, 3037.048584, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  218. CreateStreamObject(711, 553.178345, 3044.525146, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  219. CreateStreamObject(711, 553.048401, 3052.441162, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  220. CreateStreamObject(711, 553.090454, 3062.432129, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  221. CreateStreamObject(711, 553.116272, 3073.837891, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  222. CreateStreamObject(711, 553.161072, 3084.958984, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  223. CreateStreamObject(711, 553.141663, 3095.798340, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  224. CreateStreamObject(711, 553.157349, 3104.055908, 8.379801, 0.0000, 0.0000, 0.0000, 500);
  225. CreateStreamObject(750, 513.943481, 2983.665527, 3.040160, 0.0000, 0.0000, 0.0000, 500);
  226. CreateStreamObject(867, 509.969543, 3045.965576, 3.161491, 0.0000, 0.0000, 0.0000, 500);
  227. CreateStreamObject(615, 472.783020, 3034.096436, 2.371343, 0.0000, 0.0000, 0.0000, 500);
  228. CreateStreamObject(619, 528.958496, 3011.813965, 2.553825, 0.0000, 0.0000, 230.2252, 500);
  229. CreateStreamObject(621, 528.648926, 3038.774658, 2.307847, 0.0000, 0.0000, 0.0000, 500);
  230. CreateStreamObject(629, 518.956360, 3105.338135, 2.413404, 0.0000, 0.0000, 0.0000, 500);
  231. CreateStreamObject(641, 522.762451, 3098.909668, 0.232055, 0.0000, 0.0000, 0.0000, 500);
  232. CreateStreamObject(641, 495.581024, 3006.803223, 0.205133, 0.0000, 0.0000, 0.0000, 500);
  233. CreateStreamObject(645, 502.804230, 2975.263672, 2.469055, 0.0000, 0.0000, 0.0000, 500);
  234. CreateStreamObject(7979, 568.530151, 3097.458252, 5.489440, 0.0000, 0.0000, 0.0000, 500);
  235. CreateStreamObject(1655, 544.365417, 3126.673340, 1.313035, 0.0000, 0.0000, 271.5818, 500);
  236. CreateStreamObject(1631, 528.562561, 3205.930664, 0.832632, 0.0000, 0.0000, 0.0000, 500);
  237. CreateStreamObject(1632, 580.542358, 3181.447754, 1.597529, 0.0000, 0.0000, 282.7546, 500);
  238. CreateStreamObject(1632, 431.064789, 3148.614502, 1.748756, 0.0000, 0.0000, 77.4531, 500);
  239. CreateStreamObject(1655, 441.476166, 3090.270752, 1.031166, 0.0000, 0.0000, 355.8062, 500);
  240. CreateStreamObject(8040, 593.865234, 2920.156494, 1.417267, 0.0000, 0.0000, 216.5783, 500);
  241. CreateStreamObject(10789, 616.479370, 2932.531494, 3.276644, 0.0000, 0.0000, 216.4741, 500);
  242. CreateStreamObject(1676, 610.788330, 2931.070557, 2.443449, 0.0000, 0.0000, 37.8152, 500);
  243. CreateStreamObject(1676, 612.856812, 2932.874023, 2.443449, 0.0000, 0.0000, 37.8152, 500);
  244. CreateStreamObject(1676, 616.571533, 2935.385986, 2.232508, 0.0000, 0.0000, 37.8152, 500);
  245. CreateStreamObject(1676, 619.165710, 2937.365234, 2.232509, 0.0000, 0.0000, 37.8152, 500);
  246. CreateStreamObject(1686, 605.095093, 2938.571533, 0.875885, 0.0000, 0.0000, 307.5744, 500);
  247. CreateStreamObject(1686, 608.089478, 2940.904297, 0.875885, 0.0000, 0.0000, 307.5744, 500);
  248. CreateStreamObject(1686, 610.912170, 2943.035400, 0.875885, 0.0000, 0.0000, 307.5744, 500);
  249. CreateStreamObject(1686, 613.777954, 2945.265381, 0.875885, 0.0000, 0.0000, 307.5744, 500);
  250. CreateStreamObject(918, 623.868103, 2929.910156, 1.023171, 0.0000, 0.0000, 0.0000, 500);
  251. CreateStreamObject(918, 624.394043, 2930.387939, 1.023171, 0.0000, 0.0000, 0.0000, 500);
  252. CreateStreamObject(918, 625.043152, 2931.006836, 1.023171, 0.0000, 0.0000, 0.0000, 500);
  253. CreateStreamObject(918, 625.856689, 2931.677490, 0.997642, 0.0000, 0.0000, 0.0000, 500);
  254. CreateStreamObject(853, 610.501892, 2912.398682, 1.052316, 0.0000, 0.0000, 0.0000, 500);
  255. CreateStreamObject(852, 609.382202, 2914.760010, 0.662177, 0.0000, 0.0000, 0.0000, 500);
  256. CreateStreamObject(851, 608.089783, 2912.866211, 0.964513, 0.0000, 0.0000, 0.0000, 500);
  257. CreateStreamObject(849, 607.904480, 2910.732422, 0.788325, 0.0000, 0.0000, 0.0000, 500);
  258. CreateStreamObject(980, 528.965149, 2975.480713, 5.272058, 0.0000, 0.0000, 0.0000, 500);
  259.  
  260. #if RANDOM_PICKUPS == true
  261. for ( new i = 0; i < MAX_RANDOM_PICKUPS; i++ )
  262. GenerateRandomPickup( i );
  263. #endif
  264.  
  265. for ( new tmpSave = 0; tmpSave < MAX_SAVES; tmpSave++ )
  266. {
  267.  
  268. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  269. {
  270. tData[ tmpSave ][ T_SPAWN_WEAPONS ][ i ] = 0;
  271. tData[ tmpSave ][ T_SPAWN_AMMO ][ i ] = 0;
  272. tData[ tmpSave ][ T_TEMP_WEAPONS ][ i ] = 0;
  273. tData[ tmpSave ][ T_TEMP_AMMO ][ i ] = 0;
  274. }
  275.  
  276. tData[ tmpSave ][ T_NAME ] = '\0';
  277. tData[ tmpSave ][ T_MONEY ] = tData[ tmpSave ][ T_MUTE ] = tData[ tmpSave ][ T_BANK ] = tData[ tmpSave ][ T_BOUNTY ] = 0;
  278. tData[ tmpSave ][ T_SKIN ] = -1;
  279. tData[ tmpSave ][ T_ARMOR ] = 0.0;
  280. tData[ tmpSave ][ T_HEALTH ] = 100.0;
  281. tData[ tmpSave ][ T_TICKS ] = 4;
  282. }
  283.  
  284. for ( new playerid = 0; playerid < MAX_PLAYERS; playerid++ )
  285. {
  286. pData[ playerid ][ P_LIST_PREVIOUS_ID ] = INVALID_PLAYER_ID;
  287. pData[ playerid ][ P_LIST_NEXT_ID ] = INVALID_PLAYER_ID;
  288. pData[ playerid ][ P_RETURNING_SPAWN ] = 0;
  289. pData[ playerid ][ P_MONEY ] = 0;
  290. pData[ playerid ][ P_HEALTH ] = 100.0;
  291. pData[ playerid ][ P_ARMOR ] = 0.0;
  292. pData[ playerid ][ P_KILLS ] = 0;
  293. pData[ playerid ][ P_DEATHS ] = 0;
  294. pData[ playerid ][ P_BANK ] = 0;
  295. pData[ playerid ][ P_BOUNTY ] = 0;
  296. pData[ playerid ][ P_SHIP_CASH ] = SHIP_CASH_DEFAULT;
  297. pData[ playerid ][ P_SKIN ] = -1;
  298. pData[ playerid ][ P_GANG_ID ] = INVALID_GANG_ID;
  299. pData[ playerid ][ P_GANG_POS ] = 0;
  300. pData[ playerid ][ P_GANG_INVITE ] = INVALID_GANG_ID;
  301. pData[ playerid ][ P_MUTE ] = 0;
  302. pData[ playerid ][ P_GANG_ZONE ] = INVALID_GANG_ZONE;
  303. pData[ playerid ][ P_IN_ZONE ] = 0;
  304. pData[ playerid ][ P_LAST_PM_ID ] = INVALID_PLAYER_ID;
  305. pData[ playerid ][ P_NO_WEAPON_AREA ] = 0;
  306. pData[ playerid ][ P_CHECKPOINT_AREA ] = 255;
  307. pData[ playerid ][ P_IN_CHECKPOINT ] = 0;
  308. pData[ playerid ][ P_ARMOR ] = 0.0;
  309. pData[ playerid ][ P_HEALTH ] = 100.0;
  310. pData[ playerid ][ P_BANK_TEXT ] = INVALID_TEXT_DRAW;
  311.  
  312. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  313. {
  314. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = 0;
  315. pData[ playerid ][ P_TEMP_AMMO ][ i ] = 0;
  316. pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] = 0;
  317. pData[ playerid ][ P_SPAWN_AMMO ][ i ] = 0;
  318. }
  319.  
  320. pData[ playerid ][ P_TEMP_WEAPONS ][ 2 ] = START_WEAPON;
  321. pData[ playerid ][ P_TEMP_AMMO ][ 2 ] = START_AMMO;
  322.  
  323. if( IsPlayerConnected( playerid ) )
  324. AC_ResetPlayerMoney( playerid );
  325. }
  326.  
  327. for ( new i = 0, j = 0; i < sizeof( sWeapons ); i++ )
  328. {
  329. if ( sWeapons[ i ][ WEAPON_SPAWN_WEAPON ] )
  330. sWeapon[ j++ ] = i;
  331. }
  332.  
  333. #if VERSION_LITE == false
  334. TEXT_NoZoneOwner = TextDrawCreate( 615.0, 400.0, "~y~Unoccupied~s~ Territory" );
  335.  
  336. TextDrawFont ( TEXT_NoZoneOwner, 1 );
  337. TextDrawSetOutline ( TEXT_NoZoneOwner, 1 );
  338. TextDrawSetProportional ( TEXT_NoZoneOwner, 1 );
  339. TextDrawAlignment ( TEXT_NoZoneOwner, 3 );
  340. #endif
  341.  
  342. new
  343. sString[ 128 ];
  344.  
  345. format( sString, sizeof( sString ), "~y~%s", sDays[ sDay ] );
  346.  
  347. TEXT_Day = TextDrawCreate( 623.25, 8.75, sString );
  348. TextDrawFont( TEXT_Day, 3 );
  349. TextDrawSetOutline( TEXT_Day, 2 );
  350. TextDrawSetProportional( TEXT_Day, 1 );
  351. TextDrawAlignment( TEXT_Day, 3 );
  352. TextDrawLetterSize( TEXT_Day, 0.6667, 1.6667 );
  353.  
  354. GetServerVarAsString( "hostname", sString, sizeof( sString ) );
  355. format( sString, sizeof( sString ), "~r~%s ~w~: ~y~" SZ_GAMEMODE_S_NAME " v" #VERSION_MAJOR "." #VERSION_MINOR "." #VERSION_BUILD "", sString );
  356.  
  357. TEXT_SpawnScreenInfo = TextDrawCreate( 615.0, 425.0, sString );
  358. TextDrawFont( TEXT_SpawnScreenInfo, 1 );
  359. TextDrawSetOutline( TEXT_SpawnScreenInfo, 1 );
  360. TextDrawSetProportional( TEXT_SpawnScreenInfo, 1 );
  361. TextDrawAlignment( TEXT_SpawnScreenInfo, 3 );
  362.  
  363. #if VERSION_LITE == false
  364. TEXT_WarProvokedAttack = TextDrawCreate( 615.0, 375.0, "Your gang has provoked a ~r~Gang War." );
  365. TextDrawFont( TEXT_WarProvokedAttack, 1 );
  366. TextDrawSetOutline( TEXT_WarProvokedAttack, 1 );
  367. TextDrawSetProportional( TEXT_WarProvokedAttack, 1 );
  368. TextDrawAlignment( TEXT_WarProvokedAttack, 3 );
  369.  
  370. TEXT_WarProvokedDefense = TextDrawCreate( 615.0, 375.0, "A gang has provoked a ~r~Gang War~w~ on your gang's turf." );
  371. TextDrawFont( TEXT_WarProvokedDefense, 1 );
  372. TextDrawSetOutline( TEXT_WarProvokedDefense, 1 );
  373. TextDrawSetProportional( TEXT_WarProvokedDefense, 1 );
  374. TextDrawAlignment( TEXT_WarProvokedDefense, 3 );
  375.  
  376. TEXT_TurfIsYours = TextDrawCreate( 615.0, 375.0, "Your gang has taken a turf." );
  377. TextDrawFont( TEXT_TurfIsYours, 1 );
  378. TextDrawSetOutline( TEXT_TurfIsYours, 1 );
  379. TextDrawSetProportional( TEXT_TurfIsYours, 1 );
  380. TextDrawAlignment( TEXT_TurfIsYours, 3 );
  381.  
  382. TEXT_TurfLost = TextDrawCreate( 615.0, 375.0, "Your gang has lost a turf." );
  383. TextDrawFont( TEXT_TurfLost, 1 );
  384. TextDrawSetOutline( TEXT_TurfLost, 1 );
  385. TextDrawSetProportional( TEXT_TurfLost, 1 );
  386. TextDrawAlignment( TEXT_TurfLost, 3 );
  387.  
  388. TEXT_TurfDefended = TextDrawCreate( 615.0, 375.0, "Your gang has sucessfully defended your turf." );
  389. TextDrawFont( TEXT_TurfDefended, 1 );
  390. TextDrawSetOutline( TEXT_TurfDefended, 1 );
  391. TextDrawSetProportional( TEXT_TurfDefended, 1 );
  392. TextDrawAlignment( TEXT_TurfDefended, 3 );
  393. #endif
  394.  
  395. for ( new gangid = 0; gangid < MAX_GANGS; gangid++ )
  396. {
  397. #if VERSION_LITE == false
  398. gData[ gangid ][ G_ZONE_TEXT ] = INVALID_TEXT_DRAW;
  399. #endif
  400.  
  401. gData[ gangid ][ G_BANK_TEXT ] = INVALID_TEXT_DRAW;
  402. }
  403.  
  404. #if VERSION_LITE == false
  405. for ( new zoneid = 0; zoneid < MAX_SCRIPT_ZONES; zoneid++ )
  406. {
  407. gZones[ zoneid ][ G_ZONE_TEXT ] = TEXT_NoZoneOwner;
  408. gZones[ zoneid ][ G_ZONE_ID ] = GangZoneCreate( gZones[ zoneid ][ G_ZONE_MINX ], gZones[ zoneid ][ G_ZONE_MINY ], gZones[ zoneid ][ G_ZONE_MAXX ], gZones[ zoneid ][ G_ZONE_MAXY ] );
  409. }
  410. #endif
  411.  
  412. DestroyGangs( );
  413.  
  414. // Timers
  415. sTimerIDs[ 0 ] = SetTimer( "ScriptSync", 999, 1 );
  416. sTimerIDs[ 1 ] = SetTimer( "PropertySync", 5007, 1 );
  417. sTimerIDs[ 2 ] = SetTimer( "WeatherSync", 22003, 1 );
  418. sTimerIDs[ 3 ] = SetTimer( "SaveSync", 75015, 1 );
  419. sTimerIDs[ 4 ] = SetTimer( "BanSync", 300321, 1 );
  420.  
  421. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  422. //LnX Make initialise the textdraws
  423. lredrawall();
  424. for (new i = 0; i < MAX_PLAYERS; i++)
  425. {
  426. lclear(i);
  427. }
  428. #endif
  429. return 1;
  430. }
  431.  
  432. public OnGameModeExit( )
  433. {
  434. sGameModeExit = 1;
  435.  
  436. for ( new iTmr = 0; iTmr < sizeof( sTimerIDs ); iTmr++ )
  437. {
  438. if ( sTimerIDs[ iTmr ] != -1 )
  439. KillTimer( sTimerIDs[ iTmr ] );
  440. }
  441.  
  442. for ( new SaveID = 0; SaveID < MAX_SAVES; SaveID++ )
  443. {
  444. tData[ SaveID ][ T_BOUNTY ] = tData[ SaveID ][ T_MONEY ] = tData[ SaveID ][ T_NAME ] = 0;
  445. tData[ SaveID ][ T_ARMOR ] = 0.0;
  446. tData[ SaveID ][ T_HEALTH ] = 100.0;
  447.  
  448. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  449. {
  450. tData[ SaveID ][ T_SPAWN_WEAPONS ][ i ] = 0;
  451. tData[ SaveID ][ T_SPAWN_AMMO ][ i ] = 0;
  452. tData[ SaveID ][ T_TEMP_WEAPONS ][ i ] = 0;
  453. tData[ SaveID ][ T_TEMP_AMMO ][ i ] = 0;
  454. }
  455. }
  456.  
  457. for ( new playerid = 0; playerid < MAX_PLAYERS; playerid++ )
  458. if( IsPlayerConnected( playerid ) )
  459. AC_ResetPlayerMoney( playerid );
  460.  
  461. return 1;
  462. }
  463.  
  464. public OnPlayerConnect( playerid )
  465. {
  466. // If the gamemode is exiting we won't accept anymore new connections.
  467. if ( sGameModeExit )
  468. return Kick( playerid );
  469.  
  470. // This will prevent the code from being executed until
  471. // the player really connects (when they view OnPlayerRequestClass).
  472. if ( !pData[ playerid ][ P_FULLY_CONNECTED ] )
  473. return 1;
  474.  
  475. new
  476. szLastIP [ 16 ],
  477. szCurrentIP [ 16 ],
  478. szPlayerName[ MAX_PLAYER_NAME ];
  479.  
  480. GetPlayerName ( playerid, szPlayerName, MAX_PLAYER_NAME );
  481. GetPlayerIp ( playerid, szCurrentIP, sizeof( szCurrentIP ) );
  482.  
  483. if ( isdigit( szPlayerName[ 0 ] ) )
  484. {
  485. SendClientMessage ( playerid, COLOR_GREY, "Invalid nickname. Your nickname must not start with a number." );
  486. Kick ( playerid );
  487. return 1;
  488. }
  489.  
  490. g_iTotalPlayerCnt ++;
  491. g_iCurrentPlayerCnt ++;
  492.  
  493. #if LOOP_TYPE != 0
  494. // Code to make loopPlayers work correctly, this will
  495. // update the variables so you don't have to loop through
  496. // all playerid's to check if they're connected.
  497.  
  498. pData[ playerid ][ P_LIST_PREVIOUS_ID ] = g_iLastJoinedPlayerID;
  499. pData[ playerid ][ P_LIST_NEXT_ID ] = INVALID_PLAYER_ID;
  500.  
  501. if ( g_iLastJoinedPlayerID != INVALID_PLAYER_ID )
  502. pData[ g_iLastJoinedPlayerID ][ P_LIST_NEXT_ID ] = playerid;
  503.  
  504. g_iLastJoinedPlayerID = playerid;
  505. // loopPlayers code end
  506. #endif
  507.  
  508. // Send welcome message to the newly connected player.
  509. SendClientMessage ( playerid, COLOR_RED, gWelcomeMSG1 );
  510. SendClientMessage ( playerid, COLOR_YELLOW, gWelcomeMSG2 );
  511.  
  512. // Reset the players money so that they don't join with a large
  513. // amount (might bug) and also so that their AC money level starts
  514. // off clean.
  515. AC_ResetPlayerMoney ( playerid );
  516.  
  517. pData[ playerid ][ P_ACCOUNT_BAN ] = 0;
  518. pData[ playerid ][ P_REGISTERED ] = 0;
  519. pData[ playerid ][ P_LOGGED_IN ] = 1;
  520. pData[ playerid ][ P_LEVEL ] = 0;
  521. pData[ playerid ][ P_GANG_ID ] = INVALID_GANG_ID;
  522. pData[ playerid ][ P_GANG_POS ] = 0;
  523. pData[ playerid ][ P_GANG_INVITE ] = INVALID_GANG_ID;
  524. pData[ playerid ][ P_MUTE ] = 0;
  525. pData[ playerid ][ P_GANG_ZONE ] = INVALID_GANG_ZONE;
  526. pData[ playerid ][ P_IN_ZONE ] = 0;
  527. pData[ playerid ][ P_LAST_PM_ID ] = INVALID_PLAYER_ID;
  528. pData[ playerid ][ P_NO_WEAPON_AREA ] = 0;
  529. pData[ playerid ][ P_CHECKPOINT_AREA ] = 255;
  530. pData[ playerid ][ P_IN_CHECKPOINT ] = 0;
  531. pData[ playerid ][ P_ACTIVITY ] = _:P_ACTIVITY_NONE;
  532. pData[ playerid ][ P_ONLINE_TICKS ] = 0;
  533. pData[ playerid ][ P_INVINCIBLE_TICKS ] = 0;
  534.  
  535. new
  536. DB:Database = db_open( SZ_SQLITE_DB );
  537.  
  538. if ( Database )
  539. {
  540. for ( new SaveID = 0; SaveID < MAX_SAVES; SaveID++ )
  541. {
  542. if ( IsStringSame( tData[ SaveID ][ T_NAME ], szPlayerName, MAX_PLAYER_NAME ) )
  543. // if ( !strcmp( szPlayerName, tData[ SaveID ][ T_NAME ], true ) )
  544. {
  545. pData[ playerid ][ P_RETURNING_SPAWN ] = 1;
  546. pData[ playerid ][ P_MONEY ] = tData[ SaveID ][ T_MONEY ];
  547. pData[ playerid ][ P_BANK ] = tData[ SaveID ][ T_BANK ];
  548. pData[ playerid ][ P_BOUNTY ] = tData[ SaveID ][ T_BOUNTY ];
  549. pData[ playerid ][ P_ARMOR ] = tData[ SaveID ][ T_ARMOR ];
  550. pData[ playerid ][ P_HEALTH ] = tData[ SaveID ][ T_HEALTH ];
  551. pData[ playerid ][ P_MUTE ] = tData[ SaveID ][ T_MUTE ];
  552. pData[ playerid ][ P_KILLS ] = tData[ SaveID ][ T_KILLS ];
  553. pData[ playerid ][ P_DEATHS ] = tData[ SaveID ][ T_DEATHS ];
  554.  
  555. tData[ SaveID ][ T_MUTE ] = tData[ SaveID ][ T_BOUNTY ] = tData[ SaveID ][ T_MONEY ] = tData[ SaveID ][ T_NAME ] = 0;
  556. tData[ SaveID ][ T_ARMOR ] = 0.0;
  557. tData[ SaveID ][ T_HEALTH ] = 100.0;
  558. tData[ SaveID ][ T_TICKS ] = 0;
  559.  
  560. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  561. {
  562. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = tData[ SaveID ][ T_TEMP_WEAPONS ][ i ];
  563. pData[ playerid ][ P_TEMP_AMMO ][ i ] = tData[ SaveID ][ T_TEMP_AMMO ][ i ];
  564. pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] = tData[ SaveID ][ T_SPAWN_WEAPONS ][ i ];
  565. pData[ playerid ][ P_SPAWN_AMMO ][ i ] = tData[ SaveID ][ T_SPAWN_AMMO ][ i ];
  566.  
  567. tData[ SaveID ][ T_TEMP_WEAPONS ][ i ] = 0;
  568. tData[ SaveID ][ T_TEMP_AMMO ][ i ] = 0;
  569. tData[ SaveID ][ T_SPAWN_WEAPONS ][ i ] = 0;
  570. tData[ SaveID ][ T_SPAWN_AMMO ][ i ] = 0;
  571. }
  572.  
  573. if ( tData[ SaveID ][ T_SKIN ] != -1 )
  574. {
  575. pData[ playerid ][ P_SKIN ] = tData[ SaveID ][ T_SKIN ];
  576. tData[ playerid ][ T_SKIN ] = -1;
  577. }
  578.  
  579. SendClientMessage( playerid, COLOR_GREEN, "Your money and weapons have been restored." );
  580.  
  581. break;
  582. }
  583. }
  584.  
  585. if ( pData[ playerid ][ P_TEMP_AMMO ][ 2 ] < 300 )
  586. pData[ playerid ][ P_TEMP_AMMO ][ 2 ] = START_AMMO;
  587.  
  588. if ( !pData[ playerid ][ P_TEMP_WEAPONS ][ 2 ] )
  589. pData[ playerid ][ P_TEMP_WEAPONS ][ 2 ]= START_WEAPON;
  590.  
  591. if ( !pData[ playerid ][ P_RETURNING_SPAWN ] )
  592. {
  593. pData[ playerid ][ P_SKIN ] = -1;
  594. pData[ playerid ][ P_MONEY ] = POCKET_MONEY;
  595. pData[ playerid ][ P_BANK ] = 0;
  596. pData[ playerid ][ P_BOUNTY ] = 0;
  597. pData[ playerid ][ P_ARMOR ] = 0.0;
  598. pData[ playerid ][ P_HEALTH ] = 100.0;
  599. pData[ playerid ][ P_KILLS ] = 0;
  600. pData[ playerid ][ P_DEATHS ] = 0;
  601.  
  602. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  603. {
  604. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = 0;
  605. pData[ playerid ][ P_TEMP_AMMO ][ i ] = 0;
  606. pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] = 0;
  607. pData[ playerid ][ P_SPAWN_AMMO ][ i ] = 0;
  608. }
  609.  
  610. pData[ playerid ][ P_TEMP_WEAPONS ][ 2 ] = START_WEAPON;
  611. pData[ playerid ][ P_TEMP_AMMO ][ 2 ] = START_AMMO;
  612. }
  613.  
  614. if ( IsUserRegisteredEx( Database, szPlayerName, szLastIP ) )
  615. {
  616. pData[ playerid ][ P_REGISTERED ] = 1;
  617. pData[ playerid ][ P_LOGGED_IN ] = 0;
  618. pData[ playerid ][ P_ACCOUNT_BAN ] = IsUserBanned( Database, szPlayerName );
  619.  
  620. if ( pData[ playerid ][ P_ACCOUNT_BAN ] )
  621. KickPlayer( Database, playerid, 1000, "Attempted login on banned account." );
  622.  
  623. else if ( !strcmp( szLastIP, szCurrentIP ) )
  624. {
  625. new
  626. szString[ MAX_CLIENT_MSG ];
  627.  
  628. LoginUser( Database, playerid, szPlayerName, szLastIP, 1 );
  629.  
  630. format( szString, sizeof( szString ), "You have automatically been logged into your account (Level: %d, UserID: %d).", pData[ playerid ][ P_LEVEL ], pData[ playerid ][ P_USERID ] );
  631. SendClientMessage( playerid, COLOR_GREEN, szString );
  632.  
  633. format( szString, sizeof( szString ), "Player %s (ID:%d) has logged in (Level: %d, UserID: %d) with autologin.", szPlayerName, playerid, pData[ playerid ][ P_LEVEL ], pData[ playerid ][ P_USERID ] );
  634. SendClientMessageToAdmins( COLOR_ORANGE, szString );
  635.  
  636. format ( szString, sizeof( szString ), "[login] %s %d %d %d", szPlayerName, playerid, pData[ playerid ][ P_USERID ], pData[ playerid ][ P_LEVEL ] );
  637. add_log ( szString );
  638. }
  639.  
  640. else
  641. {
  642. SendClientMessage( playerid, COLOR_ORANGE, "This username is registered, please login using the /login command." );
  643. SendClientMessage( playerid, COLOR_RED, "If you are not the owner of this account, please quit the game and rejoin with another nickname." );
  644. }
  645. }
  646.  
  647. else
  648. {
  649. pData[ playerid ][ P_REGISTERED ] = 0;
  650. pData[ playerid ][ P_LOGGED_IN ] = 1;
  651.  
  652. SendClientMessage( playerid, COLOR_GREEN, "You can register your username using the /register command." );
  653.  
  654. }
  655. db_close( Database );
  656.  
  657. }
  658. else
  659. print( "[ERROR] No database!" );
  660.  
  661. loopPlayers( i )
  662. {
  663. if ( pData[ i ][ P_NO_WEAPON_AREA ] )
  664. SetPlayerTeam( i, TEAM_INTERIOR );
  665. }
  666.  
  667. SetPlayerColor ( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  668. TogglePlayerClock ( playerid, 1 );
  669. SetPlayerTime ( playerid, sHour, sMinute );
  670.  
  671. SendDeathMessage ( INVALID_PLAYER_ID, playerid, 200 );
  672.  
  673. return 1;
  674. }
  675.  
  676. public OnPlayerDisconnect( playerid, reason )
  677. {
  678. new
  679. pName[ MAX_PLAYER_NAME ];
  680.  
  681. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  682.  
  683. if ( pData[ playerid ][ P_REGISTERED ] && pData[ playerid ][ P_LOGGED_IN ] )
  684. {
  685. new DB:Database = db_open( SZ_SQLITE_DB );
  686.  
  687. if ( Database )
  688. {
  689. SaveUser( Database, playerid, pName );
  690. db_close( Database );
  691. }
  692. else
  693. print ( "[ERROR] NO DATABASE!" );
  694. }
  695.  
  696. if ( sGameModeExit )
  697. return 1;
  698.  
  699. g_iCurrentPlayerCnt--;
  700.  
  701. #if LOOP_TYPE != 0
  702. // loopPlayers macro code start
  703. if ( g_iLastJoinedPlayerID == playerid )
  704. g_iLastJoinedPlayerID = pData[ playerid ][ P_LIST_PREVIOUS_ID ];
  705.  
  706. else
  707. {
  708. if ( pData[ playerid ][ P_LIST_NEXT_ID ] != INVALID_PLAYER_ID )
  709. pData[ pData[ playerid ][ P_LIST_NEXT_ID ] ][ P_LIST_PREVIOUS_ID ] = pData[ playerid ][ P_LIST_PREVIOUS_ID ];
  710.  
  711. if ( pData[ playerid ][ P_LIST_PREVIOUS_ID ] != INVALID_PLAYER_ID )
  712. pData[ pData[ playerid ][ P_LIST_PREVIOUS_ID ] ][ P_LIST_NEXT_ID ] = pData[ playerid ][ P_LIST_NEXT_ID ];
  713. }
  714. // loopPlayers macro code end
  715. #endif
  716.  
  717. pData[ playerid ][ P_FULLY_CONNECTED ] = 0;
  718. pData[ playerid ][ P_DROP_WARNED ] = 0;
  719. pData[ playerid ][ P_SHIP_CASH ] = SHIP_CASH_DEFAULT;
  720. pData[ playerid ][ P_RETURNING_SPAWN ] = 0;
  721. pData[ playerid ][ P_LEVEL ] = _:P_LEVEL_NONE;
  722.  
  723. SendDeathMessage( INVALID_PLAYER_ID, playerid, 201 );
  724.  
  725. if ( pData[ playerid ][ P_BANK_TEXT ] != INVALID_TEXT_DRAW )
  726. {
  727. TextDrawDestroy( pData[ playerid ][ P_BANK_TEXT ] );
  728. pData[ playerid ][ P_BANK_TEXT ] = INVALID_TEXT_DRAW;
  729. }
  730.  
  731. pData[ playerid ][ P_BOUNTY ] = 0;
  732.  
  733. if ( sHighBountyPlayer == playerid )
  734. {
  735. sHighBountyPlayer = 0;
  736.  
  737. loopPlayers( i )
  738. {
  739. if ( pData[ i ][ P_BOUNTY ] > pData[ sHighBountyPlayer ][ P_BOUNTY ] && pData[ i ][ P_BOUNTY ] > 0 )
  740. sHighBountyPlayer = i;
  741. }
  742.  
  743. if ( pData[ sHighBountyPlayer ][ P_BOUNTY ] < 1 )
  744. sHighBountyPlayer = INVALID_PLAYER_ID;
  745.  
  746. if ( sHighBountyPlayer != INVALID_PLAYER_ID && sHighBountyPlayer != playerid )
  747. {
  748. new
  749. szString[ 128 ];
  750.  
  751. GetPlayerName( sHighBountyPlayer, szString, MAX_PLAYER_NAME );
  752.  
  753. format( szString, sizeof( szString ), "* %s (%d) has the highest bounty ($%d). Look for the ORANGE blip.", szString, sHighBountyPlayer, pData[ sHighBountyPlayer ][ P_BOUNTY ] );
  754. SendClientMessageToAll( COLOR_ORANGE, szString );
  755.  
  756. SetPlayerColor( sHighBountyPlayer, COLOR_ORANGE );
  757. }
  758. }
  759.  
  760. if ( sRhinoOwner == playerid )
  761. sRhinoOwner = INVALID_PLAYER_ID;
  762.  
  763. #if NEW_PIRATE_MODE == true
  764. if ( sPirateOwner == playerid )
  765. {
  766. DestroyObject ( sPirateBriefcaseObj );
  767. sPirateBriefcaseObj = CreateObject( 1318,2002.7188, 1548.1165, 0.0, 0.0, 0.0, 0.0 );
  768.  
  769. sPirateOwner = INVALID_PLAYER_ID;
  770. sPirateBriefcase= CreatePickup( 1210,DEFAULT_PICKUP_TYPE, 2002.7188, 1548.1165, 13.5859 );
  771. }
  772. #endif
  773.  
  774. for ( new property = 0, j = sizeof ( gPropertyData ); property < j; property++ )
  775. {
  776. if ( gPropertyData[ property ][ PROPERTY_OWNER ] == playerid )
  777. {
  778. AC_GivePlayerMoney( playerid, gPropertyData[ property ][ PROPERTY_PRICE ] );
  779.  
  780. gPropertyData[ property ][ PROPERTY_OWNER ] = INVALID_PLAYER_ID;
  781. gPropertyData[ property ][ PROPERTY_CAN_BE_BOUGHT ] = 1;
  782. }
  783. }
  784.  
  785. if ( pData[ playerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  786. {
  787. pData[ playerid ][ P_GANG_ZONE ] = INVALID_GANG_ZONE;
  788. pData[ playerid ][ P_IN_ZONE ] = 0;
  789. }
  790.  
  791. tData[ sSave ][ T_NAME ] = pName;
  792. tData[ sSave ][ T_KILLS ] = pData[ playerid ][ P_KILLS ];
  793. tData[ sSave ][ T_DEATHS ] = pData[ playerid ][ P_DEATHS ];
  794. tData[ sSave ][ T_MUTE ] = pData[ playerid ][ P_MUTE ];
  795. tData[ sSave ][ T_BANK ] = pData[ playerid ][ P_BANK ];
  796. tData[ sSave ][ T_BOUNTY ] = pData[ playerid ][ P_BOUNTY ];
  797. tData[ sSave ][ T_SKIN ] = GetPlayerSkin( playerid );
  798. tData[ sSave ][ T_TICKS ] = 4; // Seconds and is 5 minutes until data is cleared.
  799.  
  800. pData[ playerid ][ P_BOUNTY ] = pData[ playerid ][ P_BANK ] = pData[ playerid ][ P_MUTE ] = 0;
  801.  
  802. if ( GetPlayerState( playerid ) )
  803. {
  804. GetPlayerArmour( playerid, tData[ sSave ][ T_ARMOR ] );
  805.  
  806. if ( pData[ playerid ][ P_INVINCIBLE_TICKS ] )
  807. tData[ sSave ][ T_HEALTH ] = pData[ playerid ][ P_HEALTH ];
  808.  
  809. else
  810. GetPlayerHealth( playerid, tData[ sSave ][ T_HEALTH ] );
  811.  
  812. tData[ sSave ][ T_MONEY ] = GetPlayerMoney( playerid );
  813.  
  814. #if MODE_PROTECTED_WEAPONS == 0
  815.  
  816. if ( pData[ playerid ][ P_NO_WEAPON_AREA ] )
  817. {
  818. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  819. {
  820. tData[ sSave ][ T_SPAWN_WEAPONS ][ i ] = pData[ playerid ][ P_SPAWN_WEAPONS ][ i ];
  821. tData[ sSave ][ T_SPAWN_AMMO ][ i ] = pData[ playerid ][ P_SPAWN_AMMO ][ i ];
  822. tData[ sSave ][ T_TEMP_WEAPONS ][ i ] = pData[ playerid ][ P_TEMP_WEAPONS ][ i ];
  823. tData[ sSave ][ T_TEMP_AMMO ][ i ] = pData[ playerid ][ P_TEMP_AMMO ][ i ];
  824.  
  825. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = pData[ playerid ][ P_TEMP_AMMO ][ i ] = 0;
  826. pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] = pData[ playerid ][ P_SPAWN_AMMO ][ i ] = 0;
  827. }
  828. }
  829. else
  830. {
  831.  
  832. #endif
  833.  
  834. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  835. {
  836. GetPlayerWeaponData( playerid, i, tData[ sSave ][ T_TEMP_WEAPONS ], tData[ sSave ][ T_TEMP_AMMO ] );
  837.  
  838. tData[ sSave ][ T_SPAWN_WEAPONS ][ i ] = pData[ playerid ][ P_SPAWN_WEAPONS ][ i ];
  839. tData[ sSave ][ T_SPAWN_AMMO ][ i ] = pData[ playerid ][ P_SPAWN_AMMO ][ i ];
  840.  
  841. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = pData[ playerid ][ P_TEMP_AMMO ][ i ] = 0;
  842. pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] = pData[ playerid ][ P_SPAWN_AMMO ][ i ]= 0;
  843. }
  844.  
  845. #if MODE_PROTECTED_WEAPONS == 0
  846.  
  847. }
  848.  
  849. #endif
  850. }
  851. else
  852. {
  853. tData[ sSave ][ T_ARMOR ] = pData[ playerid ][ P_ARMOR ];
  854. tData[ sSave ][ T_HEALTH ] = pData[ playerid ][ P_HEALTH ];
  855. tData[ sSave ][ T_MONEY ] = pData[ playerid ][ P_MONEY ];
  856.  
  857. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  858. {
  859. tData[ sSave ][ T_TEMP_WEAPONS ][ i ] = pData[ playerid ][ P_TEMP_WEAPONS ][ i ];
  860. tData[ sSave ][ T_TEMP_AMMO ][ i ] = pData[ playerid ][ P_TEMP_AMMO ][ i ];
  861. tData[ sSave ][ T_SPAWN_WEAPONS ][ i ] = pData[ playerid ][ P_SPAWN_WEAPONS ][ i ];
  862. tData[ sSave ][ T_SPAWN_AMMO ][ i ] = pData[ playerid ][ P_SPAWN_AMMO ][ i ];
  863.  
  864. pData[ playerid ][ P_TEMP_WEAPONS ] = pData[ playerid ][ P_TEMP_AMMO ][ i ] = 0;
  865. pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] = pData[ playerid ][ P_SPAWN_AMMO ][ i ] = 0;
  866. }
  867. }
  868.  
  869. if ( IsPlayerInAnyGang( playerid ) )
  870. RemovePlayerFromGang( playerid, GANG_LEAVE_QUIT );
  871.  
  872. sSave++;
  873.  
  874. if ( sSave >= MAX_SAVES ) sSave = 0;
  875.  
  876. pData[ playerid ][ P_SEEN_CLASS_SELECT ] = 0;
  877. pData[ playerid ][ P_ADMIN_SPAWN ] = 0;
  878.  
  879. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  880. //LnX
  881. lredrawall();
  882. lclear(playerid);
  883. #endif
  884.  
  885. pData[ playerid ][ P_REGISTERED ] = 0;
  886. pData[ playerid ][ P_LOGGED_IN ] = 0;
  887. pData[ playerid ][ P_LOGIN_ATTEMPTS ] = 0;
  888.  
  889. return 1;
  890. }
  891.  
  892. public OnPlayerSpawn( playerid )
  893. {
  894. // Callback: LVA - OnPlayerSpawn
  895.  
  896. // If the player is a returning spawn, we'll welcome them
  897. // back to the server with GameText.
  898. // if ( pData[ playerid ][ P_RETURNING_SPAWN ] )
  899. // GameTextForPlayer( playerid, "~y~Welcome Back", 7500, 0 );
  900.  
  901. if ( pData[ playerid ][ P_SEND_TO_CLASS_SELECT ] )
  902. {
  903. ForceClassSelection ( playerid );
  904. SetPlayerHealth ( playerid, 0.0 );
  905.  
  906. SetPlayerInterior ( playerid, 12 );
  907. SetPlayerCameraPos ( playerid, 2322.507812, -1146.331054, 1050.710083 );
  908. SetPlayerCameraLookAt( playerid, 2324.0,-1143.0,1050.5 );
  909.  
  910. return 0;
  911. }
  912.  
  913. if ( pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_MOD || IsPlayerAdmin( playerid ) )
  914. {
  915. // If the player's level is greater than or equal to
  916. // moderator level then we'll unlock the admin vehicles
  917. // for them.
  918.  
  919. if ( pData[ playerid ][ P_ADMIN_SPAWN ] )
  920. {
  921. // If the player has admin spawn then we'll
  922. // set additional adminny stuff for them.
  923.  
  924. SetPlayerVirtualWorld ( playerid, 0 );
  925. SetPlayerInterior ( playerid, 0 );
  926. GivePlayerWeapon ( playerid, WEAPON_SAWEDOFF, 999999 );
  927. SetPlayerHealth ( playerid, 100.0 );
  928. SetPlayerArmour ( playerid, 100.0 );
  929. }
  930.  
  931. // Vehicle unlockage!
  932. for ( new i = 0; i < MAX_ADMIN_VEHICLES; i++ )
  933. SetVehicleParamsForPlayer( aVehicle[ i ], playerid, 0, 0 );
  934. }
  935. else
  936. {
  937. for ( new i = 0; i < MAX_ADMIN_VEHICLES; i++ )
  938. SetVehicleParamsForPlayer( aVehicle[ i ], playerid, 0, 1 );
  939. }
  940.  
  941. if ( !pData[ playerid ][ P_ADMIN_SPAWN ] )
  942. {
  943. // If the player is not on admin spawn.
  944. SetPlayerRandomSpawn( playerid );
  945. SetPlayerArmour ( playerid, pData[ playerid ][ P_ARMOR ] );
  946. SetPlayerHealth ( playerid, pData[ playerid ][ P_HEALTH ] );
  947.  
  948. if ( pData[ playerid ][ P_BOUNTY ] > 0 && ( sHighBountyPlayer == INVALID_PLAYER_ID || pData[ playerid ][ P_BOUNTY ] > pData[ sHighBountyPlayer ][ P_BOUNTY ] ) )
  949. {
  950. // If the players bounty is greater than 0 AND the highest bounty is an INVALID_PLAYER_ID or
  951. // the players bounty is greater than the highest bounty.
  952. new
  953. szString[ 128 ];
  954.  
  955. sHighBountyPlayer = playerid;
  956.  
  957. GetPlayerName ( playerid, szString, MAX_PLAYER_NAME );
  958. format ( szString, sizeof( szString ), "* %s (%d) has the highest bounty ($%d). Look for the ORANGE blip.", szString, sHighBountyPlayer, pData[ sHighBountyPlayer ][ P_BOUNTY ] );
  959. SendClientMessageToAll ( COLOR_ORANGE, szString );
  960. }
  961.  
  962. if ( sHighBountyPlayer == playerid )
  963. {
  964. SetPlayerColor( sHighBountyPlayer, COLOR_ORANGE );
  965.  
  966. if ( IsPlayerInAnyGang( playerid ) )
  967. {
  968. for ( new memberid = 0; memberid < gData[ pData[ playerid ][ P_GANG_ID ] ][ G_TOTALS ]; memberid++ )
  969. {
  970. if ( IsPlayerConnected( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] ) )
  971. SetPlayerMarkerForPlayer( playerid, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  972. }
  973. }
  974. }
  975.  
  976. else if ( !IsPlayerInAnyGang( playerid ) )
  977. SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  978.  
  979. else
  980. {
  981. // If the spawning player is in a gang and is not the highest bounty player.
  982. // BUG: New spawning player is transparent to his gang members,
  983.  
  984. // Set the new spawning players colour to his gang colour with alpha of 0x40.
  985.  
  986. SetPlayerColor ( playerid, setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0x40 ) );
  987. SetTimerEx ( "SpawnFinish", 1337, 0, "i", playerid );
  988. }
  989.  
  990. pData[ playerid ][ P_SKIN ] = GetPlayerSkin( playerid );
  991.  
  992. AC_GivePlayerMoney( playerid, pData[ playerid ][ P_MONEY ] );
  993. }
  994.  
  995. SetPlayerTime( playerid, sHour, sMinute );
  996.  
  997. // Bank Blips
  998. SetPlayerMapIcon( playerid, 1, 2193.2351, 1990.9645, 12.2969, 52, 0 );
  999. SetPlayerMapIcon( playerid, 2, 2097.6602, 2223.3584, 11.0234, 52, 0 );
  1000. SetPlayerMapIcon( playerid, 3, 1936.5438, 2307.1543, 10.8203, 52, 0 );
  1001. SetPlayerMapIcon( playerid, 4, 2546.6885, 1971.7012, 10.8203, 52, 0 );
  1002. SetPlayerMapIcon( playerid, 5, 2452.4104, 2064.3025, 10.8203, 52, 0 );
  1003. SetPlayerMapIcon( playerid, 6, 2247.6313, 2397.0142, 10.8203, 52, 0 );
  1004. SetPlayerMapIcon( playerid, 7, 2886.1011, 2452.4561, 11.0690, 52, 0 );
  1005. SetPlayerMapIcon( playerid, 8, 2001.3333, 1544.2572, 13.5859, 37, 0 );
  1006.  
  1007. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  1008. {
  1009. if ( pData[ playerid ][ P_TEMP_WEAPONS ][ i ] > 0 && pData[ playerid ][ P_TEMP_AMMO ][ i ] > 0 )
  1010. GivePlayerWeapon( playerid, pData[ playerid ][ P_TEMP_WEAPONS ][ i ], pData[ playerid ][ P_TEMP_AMMO ][ i ] );
  1011.  
  1012. else if ( pData[ playerid ][ P_SPAWN_WEAPONS ][ i ] > 0 && pData[ playerid ][ P_SPAWN_AMMO ][ i ] > 0 )
  1013. GivePlayerWeapon( playerid, pData[ playerid ][ P_SPAWN_WEAPONS ][ i ], pData[ playerid ][ P_SPAWN_AMMO ][ i ] );
  1014. }
  1015.  
  1016.  
  1017. #if VERSION_LITE == false
  1018. for ( new i = 0; i < sizeof( gZones ); i++ )
  1019. {
  1020. GangZoneShowForPlayer( playerid, gZones[ i ][ G_ZONE_ID ], gZones[ i ][ G_ZONE_COLOR ] );
  1021.  
  1022. if ( gZones[ i ][ G_ZONE_WAR ] )
  1023. GangZoneFlashForPlayer( playerid, gZones[ i ][ G_ZONE_ID ], 0xFF000080 );
  1024. }
  1025.  
  1026. #endif
  1027.  
  1028. pData[ playerid ][ P_SEEN_CLASS_SELECT ] = 0;
  1029. pData[ playerid ][ P_RETURNING_SPAWN ] = 0;
  1030. pData[ playerid ][ P_KILL_SPREE ] = 0;
  1031. pData[ playerid ][ P_INVINCIBLE_TICKS ] = 4;
  1032.  
  1033. SetPlayerHealth( playerid, 3.40282346638528860e38 );
  1034. SetPlayerWantedLevel( playerid, 0 );
  1035. TextDrawHideForPlayer( playerid, TEXT_SpawnScreenInfo );
  1036.  
  1037. return 1;
  1038. }
  1039.  
  1040. public OnPlayerRequestClass( playerid, classid )
  1041. {
  1042. if ( !pData[ playerid ][ P_FULLY_CONNECTED ] )
  1043. {
  1044. TextDrawShowForPlayer( playerid, TEXT_Day );
  1045.  
  1046. #if NEW_PIRATE_MODE
  1047. if ( sPirateOwner != INVALID_PLAYER_ID )
  1048. {
  1049. DestroyObject ( sPirateBriefcaseObj );
  1050. sPirateBriefcaseObj = CreateObject( 1318,2002.7188, 1548.1165, 0.0, 0.0, 0.0, 0.0 );
  1051. AttachObjectToPlayer( sPirateBriefcaseObj, sPirateOwner, 0.0, 0.0, 2.25, 0.0, 0.0, 90.0 );
  1052. }
  1053. #endif
  1054.  
  1055. pData[ playerid ][ P_FULLY_CONNECTED ] = 1;
  1056. pData[ playerid ][ P_RESAVE_TICKS ] = 0;
  1057.  
  1058. OnPlayerConnect( playerid );
  1059. }
  1060.  
  1061. if ( !pData[ playerid ][ P_LOGGED_IN ] )
  1062. {
  1063. SetPlayerPos ( playerid, 2109.0, 1456.75, 30.0 );
  1064. SetPlayerCameraPos ( playerid, 2109.0, 1456.75, 55.0 );
  1065. SetPlayerCameraLookAt ( playerid, 1969.0, 1555.00, 8.50 );
  1066.  
  1067. return 1;
  1068. }
  1069.  
  1070. else if ( pData[ playerid ][ P_SKIN ] != -1 )
  1071. {
  1072. SetSpawnInfo ( playerid, playerid, pData[ playerid ][ P_SKIN ], 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );
  1073. SpawnPlayer ( playerid );
  1074.  
  1075. return 1;
  1076. }
  1077.  
  1078. else if ( !pData[ playerid ][ P_SEEN_CLASS_SELECT ] )
  1079. {
  1080. TextDrawShowForPlayer( playerid, TEXT_SpawnScreenInfo );
  1081.  
  1082. SetPlayerInterior ( playerid, 12 );
  1083. SetPlayerPos ( playerid, 2324.0,-1143.0,1050.4922 );
  1084. SetPlayerFacingAngle ( playerid, 148.7130 );
  1085. SetPlayerCameraPos ( playerid, 2322.507812, -1146.331054, 1050.710083 );
  1086. SetPlayerCameraLookAt ( playerid, 2324.0,-1143.0,1050.5 );
  1087. }
  1088.  
  1089. new
  1090. r = random( 2 );
  1091.  
  1092. switch ( r )
  1093. {
  1094. case 0:
  1095. {
  1096. static
  1097. RAPPING[ ][ ] =
  1098. {
  1099. "RAP_A_Loop", "RAP_B_Loop", "RAP_C_Loop"
  1100. };
  1101.  
  1102. r = random( sizeof( RAPPING ) );
  1103.  
  1104. ApplyAnimation( playerid, "RAPPING", RAPPING[ r ], 4.0, 1, 0, 0, 1, 1 );
  1105. }
  1106. case 1:
  1107. {
  1108. static
  1109. ON_LOOKERS[ ][ ] =
  1110. {
  1111. "lkaround_loop","lkup_loop", "panic_loop",
  1112. "point_loop", "shout_loop","wave_loop"
  1113. };
  1114.  
  1115. r = random( sizeof( ON_LOOKERS ) );
  1116.  
  1117. ApplyAnimation( playerid, "ON_LOOKERS", ON_LOOKERS[ r ], 4.0, 1, 0, 0, 1, 1 );
  1118. }
  1119. }
  1120.  
  1121. pData[ playerid ][ P_SEND_TO_CLASS_SELECT ] = 0;
  1122. pData[ playerid ][ P_SEEN_CLASS_SELECT ] = 1;
  1123. pData[ playerid ][ P_ADMIN_SPAWN ] = 0;
  1124.  
  1125. return 1;
  1126. }
  1127.  
  1128. public OnPlayerDeath( playerid, killerid, reason )
  1129. {
  1130. if ( pData[ playerid ][ P_SEND_TO_CLASS_SELECT ] )
  1131. {
  1132. SetPlayerInterior ( playerid, 12 );
  1133. SetPlayerCameraPos ( playerid, 2322.507812, -1146.331054, 1050.710083 );
  1134. SetPlayerCameraLookAt ( playerid, 2324.0,-1143.0,1050.5 );
  1135.  
  1136. return 0;
  1137. }
  1138.  
  1139. new
  1140. _: pMoney = GetPlayerMoney( playerid ),
  1141. Menu: pMenu = GetPlayerMenu( playerid ),
  1142. Float: pX,
  1143. Float: pY,
  1144. Float: pZ;
  1145.  
  1146. GetPlayerPos( playerid, pX, pY, pZ );
  1147.  
  1148. pData[ playerid ][ P_SHIP_CASH ] = SHIP_CASH_DEFAULT;
  1149. pData[ playerid ][ P_KILL_SPREE ] = 0;
  1150.  
  1151. if ( IsPlayerInAnyGang( playerid ) )
  1152. {
  1153. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_DEATHS ]++;
  1154.  
  1155. #if VERSION_LITE == false
  1156. // If the players current gang zone does not equal an invalid gang zone, then
  1157. // increase the deaths for the gang in that zone.
  1158. if ( pData[ playerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  1159. zDeaths[ pData[ playerid ][ P_GANG_ID ] ][ pData[ playerid ][ P_GANG_ZONE ] ][ 1 ]++;
  1160. #endif
  1161. }
  1162.  
  1163. if ( pData[ playerid ][ P_ACTIVITY ] >= _:P_ACTIVITY_BANK && pData[ playerid ][ P_ACTIVITY ] <= _:G_BANK_WITHDRAW )
  1164. {
  1165. // Hide the bank text for the player.
  1166. TextDrawHideForPlayer( playerid, pData[ playerid ][ P_BANK_TEXT ] );
  1167.  
  1168. // If IsPlayerInAnyGang then hide the gang bank text.
  1169. if ( IsPlayerInAnyGang( playerid ) )
  1170. TextDrawHideForPlayer( playerid, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK_TEXT ] );
  1171. }
  1172.  
  1173. // Menu's are an activity so we'll set the player to _P_ACTIVITY_NONE since the script
  1174. // currently only allows ONE activity.
  1175. pData[ playerid ][ P_ACTIVITY ] = _:P_ACTIVITY_NONE;
  1176.  
  1177. if ( pMenu != INVALID_MENU )
  1178. HideMenuForPlayer( pMenu, playerid );
  1179.  
  1180. if ( killerid != INVALID_PLAYER_ID )
  1181. {
  1182. pData[ killerid ][ P_KILL_SPREE ] ++;
  1183.  
  1184. if ( !( pData[ killerid ][ P_KILL_SPREE ] % 5 ) )
  1185. {
  1186. new
  1187. iKillerWantedLevel
  1188. = GetPlayerWantedLevel( killerid );
  1189.  
  1190. if ( iKillerWantedLevel < 6 )
  1191. SetPlayerWantedLevel( killerid, iKillerWantedLevel + 1 );
  1192. }
  1193.  
  1194. new
  1195. Float:kX, Float:kY, Float:kZ;
  1196.  
  1197. GetPlayerPos( killerid, kX, kY, kZ );
  1198.  
  1199. #if NEW_PIRATE_MODE == true
  1200. if ( playerid == sPirateOwner )
  1201. {
  1202. if ( IsPlayerInAnyGang( playerid ) && !IsPlayerInGang( killerid, pData[ playerid ][ P_GANG_ID ] ) )
  1203. {
  1204. // If the killer is not in the players gang then ...
  1205.  
  1206. AC_GivePlayerMoney ( killerid, 1000 );
  1207. SendClientMessage ( killerid, COLOR_GREEN, "You killed the Pirate Ship owner and gained a $1000 bonus." );
  1208. }
  1209.  
  1210. // Restore the Pickup.
  1211. DestroyObject ( sPirateBriefcaseObj );
  1212. sPirateBriefcaseObj = CreateObject( 1318,2002.7188, 1548.1165, 0.0, 0.0, 0.0, 0.0 );
  1213.  
  1214. sPirateOwner = INVALID_PLAYER_ID;
  1215. sPirateBriefcase= CreatePickup( 1210,DEFAULT_PICKUP_TYPE, pX, pY, pZ );
  1216. }
  1217. #endif
  1218.  
  1219. if ( pMoney > 0 )
  1220. {
  1221. new
  1222. iTmpMoney;
  1223.  
  1224. if ( reason == 34 )
  1225. iTmpMoney = ( pMoney / 100 ) * 50;
  1226.  
  1227. else
  1228. iTmpMoney = ( pMoney / 100 ) * 10;
  1229.  
  1230. AC_GivePlayerMoney( killerid, iTmpMoney );
  1231. AC_GivePlayerMoney( playerid, -iTmpMoney );
  1232. }
  1233.  
  1234. // If the dead person is not in the same
  1235. // gang as the killer.
  1236.  
  1237. if ( !IsPlayerInGang( killerid, pData[ playerid ][ P_GANG_ID ] ) )
  1238. {
  1239. if ( pData[ playerid ][ P_BOUNTY ] > 0 )
  1240. {
  1241.  
  1242. new
  1243. kString[ MAX_CLIENT_MSG ];
  1244.  
  1245. GetPlayerName ( playerid, kString, MAX_PLAYER_NAME );
  1246. format ( kString, sizeof( kString ), "* You got $%d for killing %s.", pData[ playerid ][ P_BOUNTY ], kString );
  1247. SendClientMessage ( killerid, COLOR_GREEN, kString );
  1248. AC_GivePlayerMoney ( killerid, pData[ playerid ][ P_BOUNTY ] );
  1249.  
  1250. pData[ playerid ][ P_BOUNTY ] = 0;
  1251.  
  1252. if ( sHighBountyPlayer == playerid )
  1253. {
  1254. sHighBountyPlayer = 0;
  1255.  
  1256. loopPlayers( i )
  1257. {
  1258. if ( pData[ i ][ P_BOUNTY ] > pData[ sHighBountyPlayer ][ P_BOUNTY ] && pData[ playerid ][ P_BOUNTY ] > 0 )
  1259. sHighBountyPlayer = i;
  1260. }
  1261.  
  1262. if ( pData[ sHighBountyPlayer ][ P_BOUNTY ] < 1 || sHighBountyPlayer == playerid )
  1263. sHighBountyPlayer = INVALID_PLAYER_ID;
  1264.  
  1265. if ( sHighBountyPlayer != INVALID_PLAYER_ID )
  1266. {
  1267. new
  1268. szString[ 128 ];
  1269.  
  1270. GetPlayerName ( playerid, szString, MAX_PLAYER_NAME );
  1271. format ( szString, sizeof( szString ), "* %s (%d) has the highest bounty ($%d). Look for the ORANGE blip.", szString, sHighBountyPlayer, pData[ sHighBountyPlayer ][ P_BOUNTY ] );
  1272. SendClientMessageToAll ( COLOR_ORANGE, szString );
  1273.  
  1274. SetPlayerColor( sHighBountyPlayer, COLOR_ORANGE );
  1275. }
  1276. }
  1277. }
  1278. }
  1279.  
  1280. if ( IsPlayerInAnyGang( killerid ) )
  1281. {
  1282. gData[ pData[ killerid ][ P_GANG_ID ] ][ G_KILLS ]++;
  1283.  
  1284. #if VERSION_LITE == false
  1285. if ( pData[ killerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  1286. zDeaths[ pData[ killerid ][ P_GANG_ID ] ][ pData[ killerid ][ P_GANG_ZONE ] ][ 0 ] ++;
  1287. #endif
  1288. }
  1289.  
  1290. pData[ killerid ][ P_KILLS ]++;
  1291. }
  1292. #if NEW_PIRATE_MODE == true
  1293. else if ( sPirateOwner == playerid )
  1294. {
  1295. // Restore the Pickup.
  1296.  
  1297. DestroyObject ( sPirateBriefcaseObj );
  1298. sPirateBriefcaseObj = CreateObject( 1318,2002.7188, 1548.1165, 0.0, 0.0, 0.0, 0.0 );
  1299.  
  1300. sPirateOwner = INVALID_PLAYER_ID;
  1301. sPirateBriefcase= CreatePickup( 1210,DEFAULT_PICKUP_TYPE, pX, pY, pZ );
  1302. }
  1303. #endif
  1304.  
  1305. CreateDeathPickups( playerid );
  1306.  
  1307. pMoney = GetPlayerMoney( playerid );
  1308.  
  1309. if ( pMoney > 0 )
  1310. {
  1311. AC_ResetPlayerMoney( playerid );
  1312.  
  1313. pData[ playerid ][ P_MONEY ] = POCKET_MONEY;
  1314. }
  1315.  
  1316. ResetPlayerWeapons( playerid );
  1317. SendDeathMessage( killerid, playerid, reason );
  1318.  
  1319. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  1320. {
  1321. pData[ playerid ][ P_TEMP_WEAPONS ][ i ]= 0;
  1322. pData[ playerid ][ P_TEMP_AMMO ][ i ] = 0;
  1323. }
  1324.  
  1325. if (
  1326. ( pData[ playerid ][ P_SPAWN_WEAPONS ][ 2 ] == START_WEAPON || !pData[ playerid ][ P_SPAWN_WEAPONS ][ 2 ] )
  1327. &&
  1328. ( pData[ playerid ][ P_SPAWN_AMMO ][ 2 ] < START_AMMO )
  1329. )
  1330. {
  1331. pData[ playerid ][ P_TEMP_WEAPONS ][ 2 ]= START_WEAPON;
  1332. pData[ playerid ][ P_TEMP_AMMO ][ 2 ] = START_AMMO;
  1333. }
  1334.  
  1335. pData[ playerid ][ P_SKIN ] = -1;
  1336. pData[ playerid ][ P_ARMOR ] = 0.0;
  1337. pData[ playerid ][ P_HEALTH ] = 100.0;
  1338. pData[ playerid ][ P_DEATHS ] ++;
  1339.  
  1340. return 1;
  1341. }
  1342.  
  1343. public OnVehicleSpawn( vehicleid )
  1344. {
  1345. // Callback: LVA - OnVehicleSpawn
  1346.  
  1347. // Link the newly spawned vehicle to interior 0,
  1348. // since all vehicle spawns are outside by default.
  1349. LinkVehicleToInterior( vehicleid, 0 );
  1350.  
  1351. if ( sRhino == vehicleid )
  1352. {
  1353. // If the new vehicle is the Rhino found
  1354. // at Area 69 then destroy it.
  1355. DestroyVehicle( vehicleid );
  1356.  
  1357. // Set the variable containing the Rhino
  1358. // vehicleid to 0 so it doesn't get reused.
  1359. sRhino = 0;
  1360. }
  1361.  
  1362. return 1;
  1363. }
  1364.  
  1365. public OnPlayerCommandText( playerid, cmdtext[ ] )
  1366. {
  1367. // Callback: LVA - OnPlayerCommandText
  1368.  
  1369. // All commands in this callback are using DracoBlue's
  1370. // dcmd macro, the format is:
  1371. // dcmd(name,name_len,source);
  1372. // The source being cmdtext obviously
  1373.  
  1374. // If the player is not connected properly then return 0
  1375. // so they cannot use commands.
  1376. if ( !IsPlayerConnected( playerid ) )
  1377. return 0;
  1378.  
  1379. // Put these commands before the print statement
  1380. // so that it doesn't print private data (such as
  1381. // passwords, email, etc) directly to console.
  1382. dcmd(nick,4,cmdtext);
  1383. dcmd(login,5,cmdtext);
  1384. dcmd(email,5,cmdtext);
  1385. dcmd(register,8,cmdtext);
  1386. dcmd(password,8,cmdtext);
  1387.  
  1388. // Command logger, will print the command directly to console
  1389. // and log it to server_log.txt
  1390. printf( "Command (ID:%d): %s", playerid, cmdtext );
  1391.  
  1392. if ( !IsPlayerAdmin( playerid ) )
  1393. {
  1394. // If the player is RCON administrator then they
  1395. // can override the not logged in blocks and mutes.
  1396.  
  1397. // If the player is not logged in then RETURN an error. Returning the error will return
  1398. // the return value of SendClientMessage (which is 1 at the time of writing this script).
  1399. // It will refuse standard output by returning 1.
  1400.  
  1401. if ( !pData[ playerid ][ P_LOGGED_IN ] )
  1402. return SendError( playerid, "This username is registered. You must login before using commands!" );
  1403.  
  1404. if ( pData[ playerid ][ P_LEVEL ] < _:P_LEVEL_MOD )
  1405. {
  1406. // Players greater than or equal to the moderator level can avoid
  1407. // personal mutes and server mutes.
  1408.  
  1409. // If the server is muted then RETURN an error and refuse standard output.
  1410. if ( sMute )
  1411. return SendError( playerid, "The server is muted." );
  1412.  
  1413. // If the player is muted then RETURN an error and refuse standard output.
  1414. if ( pData[ playerid ][ P_MUTE ] )
  1415. return SendError( playerid, "You are muted." );
  1416. }
  1417. }
  1418.  
  1419. if ( IsPlayerAdmin( playerid ) || pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_MOD )
  1420. {
  1421. // Moderator level commands block.
  1422. // If the player is RCON admin or the players level is greater than or equal to
  1423. // moderator then they can use the commands in this block.
  1424.  
  1425. dcmd(mods,4,cmdtext);
  1426. dcmd(kick,4,cmdtext);
  1427. dcmd(mute,4,cmdtext);
  1428. dcmd(admins,6,cmdtext);
  1429. dcmd(unmute,6,cmdtext);
  1430. dcmd(mutelist,8,cmdtext);
  1431. // dcmd(resetbounty,11,cmdtext);
  1432. // dcmd(resetbank,9,cmdtext);
  1433. // dcmd(resetgbank,10,cmdtext);
  1434. }
  1435.  
  1436. if ( IsPlayerAdmin( playerid ) || pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_ADMIN )
  1437. {
  1438. // Administrator level commands block.
  1439. // If the player is RCON admin or the players level is greater than or equal to
  1440. // administrator then they can use the commands in this block.
  1441.  
  1442. #if ADMIN_SPAWN_COMMAND == true
  1443. dcmd(as,2,cmdtext);
  1444. #endif
  1445. dcmd(ban,3,cmdtext);
  1446. dcmd(unban,5,cmdtext);
  1447. dcmd(muteall,7,cmdtext);
  1448. dcmd(unmuteall,9,cmdtext);
  1449. }
  1450.  
  1451. if ( IsPlayerAdmin( playerid ) || pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_SERVER )
  1452. {
  1453. // Server level commands block.
  1454. // If the player is RCON admin or the players level is greater than or equal to
  1455. // server level then they can use the commands in this block.
  1456.  
  1457. dcmd(drop,4,cmdtext);
  1458. dcmd(setname,7,cmdtext);
  1459. dcmd(wenable,7,cmdtext);
  1460. dcmd(setlevel,8,cmdtext);
  1461. dcmd(wdisable,8,cmdtext);
  1462. }
  1463.  
  1464. // Anybody that's not muted, logged in and is connected
  1465. // properly can use the commands below.
  1466.  
  1467. dcmd(me,2,cmdtext);
  1468. dcmd(buy,3,cmdtext);
  1469. dcmd(tips,4,cmdtext);
  1470. dcmd(sell,4,cmdtext);
  1471. dcmd(help,4,cmdtext);
  1472. dcmd(gang,4,cmdtext);
  1473. dcmd(bank,4,cmdtext);
  1474. dcmd(strip,5,cmdtext);
  1475. dcmd(stats,5,cmdtext);
  1476. dcmd(gbank,5,cmdtext);
  1477. dcmd(gangs,5,cmdtext);
  1478. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  1479. dcmd(clear,5,cmdtext);
  1480. #endif
  1481. dcmd(hitman,6,cmdtext);
  1482. dcmd(bounty,6,cmdtext);
  1483. dcmd(player,6,cmdtext);
  1484. dcmd(report,6,cmdtext);
  1485. dcmd(balance,7,cmdtext);
  1486. dcmd(credits,7,cmdtext);
  1487. dcmd(gbalance,8,cmdtext);
  1488. dcmd(bounties,8,cmdtext);
  1489. dcmd(givecash,8,cmdtext);
  1490. dcmd(withdraw,8,cmdtext);
  1491. dcmd(objective,9,cmdtext);
  1492. dcmd(gwithdraw,9,cmdtext);
  1493. dcmd(buyweapon,9,cmdtext);
  1494.  
  1495. #if VERSION_LITE == false
  1496. dcmd(territory,9,cmdtext);
  1497. #endif
  1498.  
  1499. dcmd(weaponlist,10,cmdtext);
  1500. dcmd(properties,10,cmdtext);
  1501.  
  1502. // Return standard output "SERVER: Unknown command"
  1503. // with return 0.
  1504.  
  1505. return 0;
  1506. }
  1507.  
  1508. {
  1509. if(strcmp(cmd, "/gup", true) == 0) { // Edit the /eup to your elevator command.
  1510. MoveObject(gate, 528.965149, 2975.480713, 5.272058, 0.0000, 0.0001, 0.0000, 500) // Put your cords in here
  1511. SendClientMessage(playerid, COLOR_RED, "Gate Closing."); // You dont alwas have to put this in, delete if wanted.
  1512. return 1;
  1513. }
  1514. if(strcmp(cmd, "/gdown", true) == 0) { // Same deal as before
  1515. MoveObject(gate, 528.965149, 2975.480713, 3.005670, 0.0001, 0.0000, 0.0000, 500) // Same deal as before
  1516. SendClientMessage(playerid, COLOR_RED, "Gate Opening."); // Same deal as before
  1517. return 1;
  1518. }
  1519.  
  1520. public OnPlayerText( playerid, text[ ] )
  1521. {
  1522. // Callback: LVA - OnPlayerText
  1523.  
  1524. // If the player is not connected properly then return 0
  1525. // so they cannot talk.
  1526. if ( !IsPlayerConnected( playerid ) )
  1527. return 0;
  1528.  
  1529. if ( !IsPlayerAdmin( playerid ) )
  1530. {
  1531. // RCON administrators are able to override chat block
  1532. // on not logged in accounts, server mutes and player
  1533. // mutes.
  1534.  
  1535. if ( !pData[ playerid ][ P_LOGGED_IN ] )
  1536. {
  1537. // If the player is not administrator and is not logged in then refuse
  1538. // text with an error and return 0;
  1539.  
  1540. SendError( playerid, "This username is registered. You must login before talking!" );
  1541.  
  1542. return 0;
  1543. }
  1544.  
  1545. if ( pData[ playerid ][ P_LEVEL ] < _:P_LEVEL_MOD )
  1546. {
  1547. // Players greater than or equal to moderator
  1548. // status are able to override server mutes and
  1549. // mutes on themselves.
  1550.  
  1551. if ( sMute )
  1552. {
  1553. // If server is muted then send an error and refuse
  1554. // normal output with return 0.
  1555.  
  1556. SendError( playerid, "The server is muted." );
  1557.  
  1558. return 0;
  1559. }
  1560.  
  1561. if ( pData[ playerid ][ P_MUTE ] )
  1562. {
  1563. // If the player is muted then send an
  1564. // error and refuse normal output with return 0
  1565.  
  1566. SendError( playerid, "You are muted." );
  1567.  
  1568. return 0;
  1569. }
  1570. }
  1571. }
  1572.  
  1573. if ( text[ 0 ] == '!' )
  1574. {
  1575. // ! is the prefix for Gang Chat.
  1576. // For example !message will send the message "message" to
  1577. // the players current gang if they're in one.
  1578.  
  1579. if ( IsPlayerInAnyGang( playerid ) )
  1580. {
  1581. // If the player is not in a gang then we can send
  1582. // gang chat using SendClientMessageToGang and
  1583. // refusing normal output with return 0
  1584.  
  1585. new
  1586. szString[ MAX_CLIENT_MSG ];
  1587.  
  1588. GetPlayerName ( playerid, szString, MAX_PLAYER_NAME );
  1589. format ( szString, sizeof ( szString ), "(Gang) %s: %s", szString, text[ 1 ] );
  1590. SendClientMessageToGang ( pData[ playerid ][ P_GANG_ID ], COLOR_CYAN, szString );
  1591.  
  1592. return 0;
  1593. }
  1594. }
  1595.  
  1596. else if ( text[ 0 ] == '@' )
  1597. {
  1598. // @ is the prefix for Admin Chat.
  1599. // For example @message will send the message "message" to
  1600. // the administrators logged in via RCON or people whose
  1601. // level is higher than 2 (admin+)
  1602.  
  1603. if ( text[ 1 ] == '@' )
  1604. {
  1605. // @@ is the prefix for moderator+ chat.
  1606. // For example @@message will send the message "message" to
  1607. // administrators logged in via RCON or people whose level is
  1608. // higher than 1 (moderator+).
  1609. if ( pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_MOD || IsPlayerAdmin( playerid ) )
  1610. {
  1611. // Moderator chat which sends to moderators using the function
  1612. // SendMessageToLevelAndHigher.
  1613. // It refuses standard output with return 0.
  1614.  
  1615. new
  1616. szString[ MAX_CLIENT_MSG ];
  1617.  
  1618. GetPlayerName ( playerid, szString, MAX_PLAYER_NAME );
  1619. format ( szString, sizeof( szString ), "(Mod) %s: %s", szString, text[ 2 ] );
  1620. SendMessageToLevelAndHigher ( _:P_LEVEL_MOD, COLOR_YELLOW, szString );
  1621.  
  1622. return 0;
  1623. }
  1624. }
  1625.  
  1626. else if ( pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_ADMIN || IsPlayerAdmin( playerid ) )
  1627. {
  1628. // If the second letter wasn't @ (moderator chat) then we
  1629. // can continue with normal admin chat using the function
  1630. // SendClientMessageToAdmins.
  1631. // It refuses standard output with return 0.
  1632.  
  1633. new
  1634. szString[ MAX_CLIENT_MSG ];
  1635.  
  1636. GetPlayerName ( playerid, szString, MAX_PLAYER_NAME );
  1637. format ( szString, sizeof ( szString ), "(Admin) %s: %s", szString, text[ 1 ] );
  1638. SendClientMessageToAdmins ( COLOR_RED, szString );
  1639.  
  1640. return 0;
  1641. }
  1642. }
  1643.  
  1644. else if ( text[ 0 ] == '#' )
  1645. {
  1646. // # is the prefix for Last PM Chat.
  1647. // For example #message will send the message "message" to
  1648. // the last person the player has personal messaged (if any).
  1649.  
  1650. // If last personal message is INVALID_PLAYER_ID then send an error.
  1651. if ( pData[ playerid ][ P_LAST_PM_ID ] == INVALID_PLAYER_ID )
  1652. SendError( playerid, "You must have PM'ed someone to use this feature." );
  1653.  
  1654. // If the last personal messaged playerid is not connected then
  1655. // send an error.
  1656. else if ( !IsPlayerConnected( pData[ playerid ][ P_LAST_PM_ID ] ) )
  1657. SendError( playerid, "Your last PM'ed playerid is not connected." );
  1658.  
  1659. // Else call the function / callback OnPlayerPrivmsg, which is used for normal
  1660. // PM's.
  1661.  
  1662. else
  1663. OnPlayerPrivmsg( playerid, pData[ playerid ][ P_LAST_PM_ID ], text[ 1 ] );
  1664.  
  1665. // Refuse standard output.
  1666.  
  1667. return 0;
  1668. }
  1669.  
  1670. // Refuse standard output and send the player messages to all using
  1671. // the native function SendPlayerMessageToAll.
  1672.  
  1673. SendPlayerMessageToAll( playerid, text );
  1674.  
  1675. return 0;
  1676. }
  1677.  
  1678.  
  1679. public OnPlayerInteriorChange( playerid, newinteriorid, oldinteriorid )
  1680. {
  1681. // Callback: LVA - OnPlayerInteriorChange
  1682.  
  1683. /*
  1684. // If newinteriorid is equal to 0 (outside) then set them to a
  1685. // unique team.
  1686. if ( !newinteriorid )
  1687. SetPlayerTeam( playerid, playerid );
  1688.  
  1689. // Otherwise if they're in an interior then set them to TEAM_INTERIOR
  1690. // so they cannot attack other people in interiors.
  1691. else
  1692. SetPlayerTeam( playerid, TEAM_INTERIOR );
  1693. */
  1694.  
  1695. if ( !newinteriorid && GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT )
  1696. {
  1697. if ( !pData[ playerid ][ P_INVINCIBLE_TICKS ] )
  1698. GetPlayerHealth( playerid, pData[ playerid ][ P_HEALTH ] );
  1699.  
  1700. SetPlayerHealth( playerid, 3.40282346638528860e38 );
  1701.  
  1702. pData[ playerid ][ P_INVINCIBLE_TICKS ] = 3 ;
  1703. }
  1704.  
  1705. return 1;
  1706. }
  1707.  
  1708. public OnPlayerRequestSpawn( playerid )
  1709. {
  1710. // Callback: LVA - OnPlayerRequestSpawn
  1711.  
  1712. if ( !pData[ playerid ][ P_LOGGED_IN ] && !IsPlayerAdmin( playerid ) )
  1713. {
  1714. // If the player is not logged in AND if the player is not admin
  1715. // then we will refuse spawn with return 0
  1716.  
  1717. // RCON administrators are able to override non-logged in account
  1718. // spawn blocking.
  1719.  
  1720. SendError( playerid, "This username is registered. You must login before spawning!" );
  1721.  
  1722. return 0;
  1723. }
  1724.  
  1725. // All is fine then let them spawn with return 1
  1726.  
  1727. return 1;
  1728. }
  1729.  
  1730. public OnPlayerPickUpPickup( playerid, pickupid )
  1731. {
  1732. // Callback: LVA - OnPlayerPickUpPickup
  1733.  
  1734. if ( pickupid == sBeer )
  1735. {
  1736. // If the pickupid is equal to the Beer pickup found
  1737. // in the "Shithole Bar" (Craw Bar)
  1738.  
  1739. new
  1740. _: iMoney = GetPlayerMoney( playerid ),
  1741. Float: fHealth;
  1742.  
  1743. GetPlayerHealth( playerid, fHealth );
  1744.  
  1745. if ( iMoney >= 100 )
  1746. {
  1747. // If the player has $100 or more then
  1748. // we will remove $100 from them.
  1749.  
  1750. AC_GivePlayerMoney( playerid, -100 );
  1751.  
  1752. // If the players health is less than 80.0 then we'll
  1753. // add 20.0 to it.
  1754. if ( fHealth < 80.0 )
  1755. SetPlayerHealth( playerid, fHealth + 20.0 );
  1756.  
  1757. // Otherwise we'll set the players health to 100.0 (full health).
  1758. else
  1759. SetPlayerHealth( playerid, 100.0 );
  1760.  
  1761. // Apply the drunk animation twice so that the effect is set correctly,
  1762. // sometimes the player doesn't animate :(
  1763. ApplyAnimation( playerid, "PED", "WALK_DRUNK", 4.1, 1, 1, 1, 1, 1 );
  1764. ApplyAnimation( playerid, "PED", "WALK_DRUNK", 4.1, 1, 1, 1, 1, 1 );
  1765.  
  1766. // Notify the player what the hell has just happened!
  1767. SendClientMessage( playerid, COLOR_GREEN, "You lost $100 and gained some health from the beer." );
  1768.  
  1769. if ( gPropertyData[ 16 ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  1770. {
  1771. // If the property owner of the "Shithole Bar" (Craw Bar)
  1772. // is valid then we'll give them $100 and notify them why.
  1773. AC_GivePlayerMoney ( gPropertyData[ 16 ][ PROPERTY_OWNER ], 100 );
  1774. SendClientMessage ( gPropertyData[ 16 ][ PROPERTY_OWNER ], COLOR_GREEN, "You gained $100 because somebody purchased a drink from your Shithole Bar property." );
  1775. }
  1776.  
  1777. }
  1778.  
  1779. else
  1780. {
  1781. // If the player has less than $100
  1782. SetPlayerHealth ( playerid, ( fHealth - 10.0 ) );
  1783.  
  1784. ApplyAnimation ( playerid, "PED", "KO_skid_front", 4.1, 0, 1, 1, 0, -1 );
  1785. ApplyAnimation ( playerid, "PED", "KO_skid_front", 4.1, 0, 1, 1, 0, -1 );
  1786.  
  1787. SendClientMessage ( playerid, COLOR_GREEN, "You do not have enough money for a beer!" );
  1788. }
  1789.  
  1790. return 1;
  1791. }
  1792.  
  1793. #if NEW_PIRATE_MODE == true
  1794. else if ( pickupid == sPirateBriefcase )
  1795. {
  1796. DestroyPickup ( sPirateBriefcase );
  1797. AttachObjectToPlayer( sPirateBriefcaseObj, playerid, 0.0, 0.0, 2.25, 0.0, 0.0, 90.0 );
  1798. SendClientMessage ( playerid, COLOR_GREEN, "The briefcase is yours! You will now generate $100 per second on the Pirate Ship." );
  1799.  
  1800. sPirateBriefcase= -1;
  1801. sPirateOwner = playerid;
  1802.  
  1803. return 1;
  1804. }
  1805. #endif
  1806.  
  1807. else if ( pickupid == sPirate )
  1808. {
  1809. SendClientMessage( playerid, COLOR_GREEN, "Pirate Ship:" );
  1810.  
  1811. #if NEW_PIRATE_MODE == true
  1812. SendClientMessage( playerid, COLOR_YELLOW, "You will earn $100 per second if you hold the briefcase on the Pirate Ship." );
  1813. #else
  1814. SendClientMessage( playerid, COLOR_YELLOW, "You will earn $25 per second if you stand on the Pirate Ships." );
  1815. #endif
  1816.  
  1817. return 1;
  1818. }
  1819.  
  1820. else
  1821. {
  1822. for ( new i = 0; i < sizeof( sStrip ); i++ )
  1823. {
  1824. if ( pickupid == sStrip[ i ] )
  1825. return SendClientMessage( playerid, COLOR_GREEN, "Strippers can dance inside the strip club between 8pm and 4am to earn $25 per second (/strip)." );
  1826. }
  1827.  
  1828. for ( new i = 0; i < sMaxPlayers; i++ )
  1829. {
  1830. for ( new j = 1; j < 6; j++ )
  1831. {
  1832. if ( moneyPickups[ i ][ j ] == pickupid )
  1833. {
  1834. AC_GivePlayerMoney( playerid, moneyPickups[ i ][ 0 ] );
  1835. DestroyPickup( pickupid );
  1836. moneyPickups[ i ][ j ] = -1;
  1837.  
  1838. return 1;
  1839. }
  1840. }
  1841. }
  1842.  
  1843. #if RANDOM_PICKUPS == true
  1844. for ( new i = 0; i < MAX_RANDOM_PICKUPS; i++ )
  1845. {
  1846. if ( randPickups[ i ] == pickupid )
  1847. {
  1848. DestroyPickup( pickupid );
  1849. GenerateRandomPickup( i );
  1850.  
  1851. return 1;
  1852. }
  1853. }
  1854. #endif
  1855. }
  1856.  
  1857. return 1;
  1858. }
  1859.  
  1860. public OnPlayerPrivmsg( playerid, recieverid, text[] )
  1861. {
  1862. #define receiverid recieverid
  1863.  
  1864. if ( !( IsPlayerAdmin( receiverid ) || IsPlayerAdmin( playerid ) ) )
  1865. {
  1866. // If the player is an admin OR the receiver is admin
  1867. // then the not logged in and muted checks will be ignored.
  1868. if ( !pData[ playerid ][ P_LOGGED_IN ] )
  1869. {
  1870. SendClientMessage( playerid, COLOR_RED, "You are not logged in!" );
  1871.  
  1872. return 0;
  1873. }
  1874.  
  1875. if ( pData[ playerid ][ P_MUTE ] )
  1876. {
  1877. SendClientMessage( playerid, COLOR_RED, "You are muted! You can only PM admins." );
  1878.  
  1879. return 0;
  1880. }
  1881. }
  1882.  
  1883. new
  1884. szString [ MAX_CLIENT_MSG ],
  1885. szSenderName [ MAX_PLAYER_NAME ],
  1886. szReceiverName [ MAX_PLAYER_NAME ],
  1887. Float: pX,
  1888. Float: pY,
  1889. Float: pZ;
  1890.  
  1891. GetPlayerPos( receiverid, pX, pY, pZ );
  1892.  
  1893. PlayerPlaySound( receiverid, 1139, pX, pY, pZ );
  1894. GameTextForPlayer( receiverid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~ ~y~New Personal Message ...", 5000, 3 );
  1895.  
  1896. GetPlayerName( receiverid, szReceiverName, MAX_PLAYER_NAME );
  1897. format( szString, sizeof( szString ), "PM to %s (ID:%d): %s", szReceiverName, receiverid, text );
  1898. SendClientMessage( playerid, COLOR_YELLOW, szString );
  1899.  
  1900. GetPlayerName( playerid, szSenderName, MAX_PLAYER_NAME );
  1901. format( szString, sizeof( szString ), "PM from %s (ID:%d): %s", szSenderName, playerid, text );
  1902. SendClientMessage( receiverid, COLOR_YELLOW, szString );
  1903.  
  1904. format ( szString, sizeof( szString ), "[pm] %d %s %d %s %s", playerid, szSenderName, receiverid, szReceiverName, text );
  1905. add_log ( szString );
  1906.  
  1907. pData[ playerid ][ P_LAST_PM_ID ] = receiverid;
  1908.  
  1909. return 0;
  1910.  
  1911. #undef receiverid
  1912. }
  1913.  
  1914. public OnPlayerCreateGang( playerid, gangid )
  1915. {
  1916. new
  1917. gString[ MAX_CLIENT_MSG ];
  1918.  
  1919. format( gString, sizeof( gString ), "* You created the gang %s (ID: %d).", gData[ gangid ][ G_NAME ], gangid );
  1920. SendClientMessage( playerid, COLOR_GREEN, gString );
  1921.  
  1922. if ( playerid != sRhinoOwner && playerid != sHighBountyPlayer )
  1923. SetPlayerColor( playerid, setAlpha( gData[ gangid ][ G_COLOR ], 0x40 ) );
  1924.  
  1925. #if VERSION_LITE == false
  1926. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_ZONE_TEXT ] = CreateTerritoryText( gData[ gangid ][ G_NAME ] );
  1927.  
  1928.  
  1929. if ( pData[ playerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  1930. zTicks[ gangid ][ pData[ playerid ][ P_GANG_ZONE ] ][ 1 ] = 1;
  1931. #endif
  1932.  
  1933. return 1;
  1934. }
  1935.  
  1936. public OnPlayerLeaveGang( playerid, gangid, isleader, reason, otherid )
  1937. {
  1938. if ( !gData[ gangid ][ G_TOTALS ] )
  1939. return 0;
  1940.  
  1941. #if VERSION_LITE == false
  1942. TextDrawHideForPlayer( playerid, TEXT_WarProvokedAttack );
  1943. TextDrawHideForPlayer( playerid, TEXT_WarProvokedDefense );
  1944. TextDrawHideForPlayer( playerid, TEXT_TurfLost );
  1945. TextDrawHideForPlayer( playerid, TEXT_TurfIsYours );
  1946. TextDrawHideForPlayer( playerid, TEXT_TurfDefended );
  1947. #endif
  1948.  
  1949. gData[ gangid ][ G_COLOR ] = pColors[ gData[ gangid ][ G_LEADER ] ];
  1950.  
  1951. #if VERSION_LITE == false
  1952. if ( pData[ playerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  1953. zTicks[ gangid ][ pData[ playerid ][ P_GANG_ZONE ] ][ 1 ] --;
  1954. #endif
  1955.  
  1956. new
  1957. gString[ MAX_CLIENT_MSG ];
  1958.  
  1959. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  1960.  
  1961. switch ( reason )
  1962. {
  1963. case GANG_LEAVE_QUIT:
  1964. {
  1965. format( gString, sizeof( gString ), "* %s (ID: %d) left the gang (Quit).", gString, playerid );
  1966. SendClientMessageToGang( gangid, COLOR_ORANGE, gString );
  1967.  
  1968. format( gString, sizeof( gString ), "* You left the gang %s (ID: %d).", gData[ gangid ][ G_NAME ], gangid );
  1969. SendClientMessage( playerid, COLOR_GREEN, gString );
  1970. }
  1971.  
  1972. case GANG_LEAVE_KICK:
  1973. {
  1974. format( gString, sizeof( gString ), "* %s (ID: %d) left the gang (Kicked).", gString, playerid );
  1975. SendClientMessageToGang( gangid, COLOR_ORANGE, gString );
  1976.  
  1977. GetPlayerName( otherid, gString, MAX_PLAYER_NAME );
  1978. format( gString, sizeof( gString ), "* %s (ID:%d) kicked you from the gang %s (ID:%d).", gString, otherid, gData[ gangid ][ G_NAME ], gangid );
  1979. SendClientMessage( playerid, COLOR_ORANGE, gString );
  1980. }
  1981.  
  1982. case GANG_LEAVE_UNKNOWN:
  1983. {
  1984. format( gString, sizeof( gString ), "* %s (ID: %d) left the gang (Unknown).", gString, playerid );
  1985. SendClientMessageToGang( gangid, COLOR_ORANGE, gString );
  1986. }
  1987. }
  1988.  
  1989. if ( isleader )
  1990. {
  1991. GetPlayerName( gData[ gangid ][ G_LEADER ], gString, MAX_PLAYER_NAME );
  1992. format( gString, sizeof( gString ), "* Your new gang leader is %s (ID: %d).", gString, gData[ gangid ][ G_LEADER ] );
  1993.  
  1994. if ( playerid != sRhinoOwner && playerid != sHighBountyPlayer )
  1995. SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  1996.  
  1997. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  1998. {
  1999. if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) )
  2000. {
  2001. if ( sRhinoOwner == gData[ gangid ][ G_MEMBERS ][ memberid ] || sHighBountyPlayer == gData[ gangid ][ G_MEMBERS ][ memberid ] )
  2002. {
  2003. // We don't need to set "memberid"'s colour ...
  2004.  
  2005. for ( new omemberid = 0; omemberid < gData[ gangid ][ G_TOTALS ]; omemberid++ )
  2006. {
  2007. if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ omemberid ] ) )
  2008. continue;
  2009.  
  2010. // We need to set "omemberid"'s colour
  2011. if( sRhinoOwner != gData[ gangid ][ G_MEMBERS ][ omemberid ] && sHighBountyPlayer != gData[ gangid ][ G_MEMBERS ][ omemberid ] )
  2012. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gData[ gangid ][ G_MEMBERS ][ omemberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2013. }
  2014. }
  2015.  
  2016. else
  2017. {
  2018. // We need to set memberid's colour.
  2019. SetPlayerColor( gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0x40 ) );
  2020.  
  2021. for ( new omemberid = 0; omemberid < gData[ gangid ][ G_TOTALS ]; omemberid++ )
  2022. {
  2023. if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ omemberid ] ) )
  2024. continue;
  2025.  
  2026. // We don't need to set "j"'s colour.
  2027. if ( sRhinoOwner == gData[ gangid ][ G_MEMBERS ][ omemberid ] || sHighBountyPlayer == gData[ gangid ][ G_MEMBERS ][ omemberid ] )
  2028. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ omemberid ], gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2029.  
  2030. // We need to set "j"'s and "i"'s colour.
  2031. else
  2032. {
  2033. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gData[ gangid ][ G_MEMBERS ][ omemberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2034. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ omemberid ], gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2035. }
  2036. }
  2037.  
  2038. SendClientMessage( gData[ gangid ][ G_MEMBERS ][ memberid ], COLOR_GREEN, gString );
  2039. }
  2040.  
  2041. }
  2042. }
  2043.  
  2044. #if VERSION_LITE == false
  2045. for ( new gZ = 0; gZ < sizeof( gZones ); gZ++ )
  2046. {
  2047. if ( gZones[ gZ ][ G_ZONE_OWNER ] == gangid )
  2048. {
  2049. gZones[ gZ ][ G_ZONE_COLOR ] = ( gData[ gangid ][ G_COLOR ] & 0xFFFFFF00 ) | 0x80;
  2050.  
  2051. GangZoneShowForAll( gZones[ gZ ][ G_ZONE_ID ], gZones[ gZ ][ G_ZONE_COLOR ] );
  2052.  
  2053. if ( gZones[ gZ ][ G_ZONE_WAR ] )
  2054. GangZoneFlashForAll( gZones[ gZ ][ G_ZONE_ID ], 0xFF000080 );
  2055. }
  2056. }
  2057. #endif
  2058. }
  2059. else
  2060. {
  2061. // We need to show a new colour for i because he has no special colour.
  2062. if ( sRhinoOwner != playerid && sHighBountyPlayer != playerid )
  2063. SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  2064.  
  2065. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  2066. {
  2067. if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) )
  2068. continue;
  2069.  
  2070. if ( sRhinoOwner != gData[ gangid ][ G_MEMBERS ][ memberid ] && sHighBountyPlayer != gData[ gangid ][ G_MEMBERS ][ memberid ] )
  2071. SetPlayerMarkerForPlayer( playerid, gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2072. }
  2073. }
  2074.  
  2075. return 1;
  2076. }
  2077.  
  2078. public OnPlayerJoinGang( playerid, gangid )
  2079. {
  2080. new
  2081. gString[ MAX_CLIENT_MSG ];
  2082.  
  2083. format( gString, sizeof( gString ), "* You joined the gang %s (ID: %d).", gData[ gangid ][ G_NAME ], gangid );
  2084. SendClientMessage( playerid, COLOR_GREEN, gString );
  2085.  
  2086. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  2087. format( gString, sizeof( gString ), "* %s (ID: %d) joined your gang.", gString, playerid );
  2088. SendClientMessageToGang( gangid, COLOR_ORANGE, gString );
  2089.  
  2090. if ( pData[ playerid ][ P_ACTIVITY ] == _:P_ACTIVITY_BANK )
  2091. {
  2092. HideMenuForPlayer( mBank[ e_BANK_MENU_MAIN_NO_GANG ], playerid );
  2093. ShowMenuForPlayer( mBank[ e_BANK_MENU_MAIN_IN_GANG ], playerid );
  2094. }
  2095.  
  2096. #if VERSION_LITE == false
  2097. if ( pData[ playerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  2098. zTicks[ gangid ][ pData[ playerid ][ P_GANG_ZONE ] ][ 1 ]++;
  2099. #endif
  2100.  
  2101. if ( playerid != sRhinoOwner && playerid != sHighBountyPlayer )
  2102. {
  2103. SetPlayerColor( playerid, setAlpha( gData[ gangid ][ G_COLOR ], 0x40 ) );
  2104.  
  2105. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  2106. {
  2107. if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) && gData[ gangid ][ G_MEMBERS ][ memberid ] != sRhinoOwner && gData[ gangid ][ G_MEMBERS ][ memberid ] != sHighBountyPlayer )
  2108. {
  2109. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], playerid, setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2110. SetPlayerMarkerForPlayer( playerid, gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2111. }
  2112. }
  2113. }
  2114. else
  2115. {
  2116. // We don't need to set playerid's colour
  2117. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  2118. {
  2119. if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) && gData[ gangid ][ G_MEMBERS ][ memberid ] != sRhinoOwner && gData[ gangid ][ G_MEMBERS ][ memberid ] != sHighBountyPlayer )
  2120. SetPlayerMarkerForPlayer( playerid, gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  2121. }
  2122. }
  2123.  
  2124. return 1;
  2125. }
  2126.  
  2127. public OnGangDeath( gangid, leaderid, gname[ ] )
  2128. {
  2129. new
  2130. gString[ MAX_CLIENT_MSG ];
  2131.  
  2132. #if VERSION_LITE == false
  2133. TextDrawHideForPlayer( leaderid, TEXT_WarProvokedAttack );
  2134. TextDrawHideForPlayer( leaderid, TEXT_WarProvokedDefense );
  2135. TextDrawHideForPlayer( leaderid, TEXT_TurfLost );
  2136. TextDrawHideForPlayer( leaderid, TEXT_TurfIsYours );
  2137. TextDrawHideForPlayer( leaderid, TEXT_TurfDefended );
  2138. #endif
  2139.  
  2140. format( gString, sizeof( gString ), "* You left the gang %s (ID: %d).", gname, gangid );
  2141. SendClientMessage( leaderid, COLOR_GREEN, gString );
  2142.  
  2143. #if VERSION_LITE == false
  2144. for ( new zoneid = 0; zoneid < MAX_SCRIPT_ZONES; zoneid++ )
  2145. {
  2146. if ( gZones[ zoneid ][ G_ZONE_OWNER ] == gangid )
  2147. {
  2148. if ( gZones[ zoneid ][ G_ZONE_WAR ] )
  2149. EndGangWar( zoneid );
  2150.  
  2151. else
  2152. {
  2153. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  2154. {
  2155. if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) && pData[ gData[ gangid ][ G_MEMBERS ][ memberid ] ][ P_GANG_ZONE ] == zoneid )
  2156. {
  2157. TextDrawHideForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gZones[ zoneid ][ G_ZONE_TEXT ] );
  2158. TextDrawShowForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], TEXT_NoZoneOwner );
  2159. }
  2160. }
  2161.  
  2162. gZones[ zoneid ][ G_ZONE_OWNER ] = INVALID_GANG_ID;
  2163. gZones[ zoneid ][ G_ZONE_COLOR ] = COLOR_ZONE_DEFAULT;
  2164. gZones[ zoneid ][ G_ZONE_TEXT ] = TEXT_NoZoneOwner;
  2165.  
  2166. zTicks [ gangid ][ zoneid ][ 0 ] = zTicks[ gangid ][ zoneid ][ 1 ] = 0;
  2167. zDeaths [ gangid ][ zoneid ][ 0 ] = zDeaths[ gangid ][ zoneid ][ 1 ] = 0;
  2168.  
  2169. GangZoneHideForAll ( zoneid );
  2170. GangZoneShowForAll ( zoneid, gZones[ zoneid ][ G_ZONE_COLOR ] );
  2171. }
  2172. }
  2173. }
  2174. #endif
  2175.  
  2176. if ( leaderid != sRhinoOwner && leaderid != sHighBountyPlayer )
  2177. SetPlayerColor( leaderid, setAlpha( pColors[ leaderid ], 0x40 ) );
  2178.  
  2179. return 1;
  2180. }
  2181.  
  2182. #if VERSION_LITE == false
  2183. public OnPlayerEnterGangZone( playerid, zoneid )
  2184. {
  2185. // Can't be bothered typing this stuff all the time..
  2186. // Lets create a easy to remember variable.
  2187. new gangid = pData[ playerid ][ P_GANG_ID ];
  2188.  
  2189. // If playerid is not OFFICIALLY in this zone.
  2190. if ( !pData[ playerid ][ P_IN_ZONE ] )
  2191. {
  2192. // Show zone name to player.
  2193. TextDrawShowForPlayer( playerid, gZones[ zoneid ][ G_ZONE_TEXT ] );
  2194.  
  2195. // Set player status to OFFICIALLY in zone so this won't increase again
  2196. // until he leaves.
  2197. pData[ playerid ][ P_IN_ZONE ] = 1;
  2198.  
  2199. // Increase amount of gang members in zone.
  2200. if ( IsPlayerInAnyGang( playerid ) )
  2201. zTicks[ gangid ][ zoneid ][ 1 ]++;
  2202. }
  2203.  
  2204. // End code if player is not in any gang.
  2205. if ( !IsPlayerInAnyGang( playerid ) )
  2206. return 0;
  2207.  
  2208. // If zone owner does not equal an invalid gang.
  2209. if ( gZones[ zoneid ][ G_ZONE_OWNER ] != INVALID_GANG_ID )
  2210. {
  2211. // If the players gang is allied with the zone owner then return 0.
  2212. if ( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_ALLY ] == gZones[ zoneid ][ G_ZONE_OWNER ] )
  2213. return 0;
  2214. }
  2215.  
  2216. // If gang war is happening.
  2217. if ( gZones[ zoneid ][ G_ZONE_WAR ] )
  2218. {
  2219. // Decrease gang ticks.
  2220. zTicks[ gangid ][ zoneid ][ 0 ]--;
  2221.  
  2222. // If no ticks for this gang ...
  2223. if ( !zTicks[ gangid ][ zoneid ][ 0 ] )
  2224. {
  2225. // Since this gang ended the war we'll give them
  2226. // 1 more kill.
  2227. zDeaths[ gangid ][ zoneid ][ 0 ]++;
  2228.  
  2229. // End the gang war.
  2230. EndGangWar( zoneid );
  2231. }
  2232. }
  2233.  
  2234. // zTicks[ gangid ][ zoneid ][ Ticks(0) | Players(1) ]
  2235. // If there's less than two players in the turf then return 0.
  2236. else if ( zTicks[ pData[ playerid ][ P_GANG_ID ] ][ zoneid ][ 1 ] < 2 )
  2237. return 0;
  2238.  
  2239. // NO GANG WAR STARTED BELOW!!!
  2240.  
  2241. // If the player is not in the zone owners gang.
  2242. else if ( !IsPlayerInGang( playerid, gZones[ zoneid ][ G_ZONE_OWNER ] ) )
  2243. {
  2244. // If zone ticks for the gang is greater than MAX_ZONE_TICKS.
  2245. if ( zTicks[ gangid ][ zoneid ][ 0 ] > MAX_ZONE_TICKS )
  2246. {
  2247. // Clear deaths/kills for all gangs for this zone.
  2248. // This makes it so kills that did not happen in the turf war are not counted.
  2249.  
  2250. for ( new g = 0; g < MAX_GANGS; g++ )
  2251. {
  2252. zDeaths[ g ][ zoneid ][ 0 ] = 0; // Kills
  2253. zDeaths[ g ][ zoneid ][ 1 ] = 0; // Deaths
  2254. }
  2255.  
  2256. // If the zone owner is an INVALID_GANG_ID we'll make it the
  2257. // players gang's turf.
  2258. if ( gZones[ zoneid ][ G_ZONE_OWNER ] == INVALID_GANG_ID )
  2259. {
  2260. // Get our old text id for use.
  2261. new
  2262. Text:oldText = gZones[ zoneid ][ G_ZONE_TEXT ];
  2263.  
  2264. SendClientMessageToGang( gangid, COLOR_GREEN, "* $1000 was deposited into your gangs bank account for taking the turf." );
  2265. gData[ gangid ][ G_BANK ] += 1000;
  2266.  
  2267. // Set new zone variables.
  2268. gZones[ zoneid ][ G_ZONE_COLOR ] = ( gData[ gangid ][ G_COLOR ] & 0xFFFFFF00 ) | 0x80;
  2269. gZones[ zoneid ][ G_ZONE_OWNER ] = gangid;
  2270. gZones[ zoneid ][ G_ZONE_TEXT ] = gData[ gangid ][ G_ZONE_TEXT ];
  2271.  
  2272. // Hide the current gang zone text and show new text for all players in the zone.
  2273. loopPlayers( i )
  2274. {
  2275. if ( pData[ i ][ P_GANG_ZONE ] == zoneid )
  2276. {
  2277. TextDrawHideForPlayer( i, oldText );
  2278. TextDrawShowForPlayer( i, gZones[ zoneid ][ G_ZONE_TEXT ] );
  2279. }
  2280. }
  2281.  
  2282. // Show the new gangzone for all players.
  2283. GangZoneShowForAll( zoneid, gZones[ zoneid ][ G_ZONE_COLOR ] );
  2284.  
  2285. // Show TurfIsYours text to the new gang zone owner.
  2286. TextDrawShowForGang( gangid, TEXT_TurfIsYours );
  2287.  
  2288. // Hide the TurfIsYours text after 10 seconds.
  2289. SetTimerEx( "TextDrawHideForGang", 10000, 0, "ii", gangid, _:TEXT_TurfIsYours );
  2290. }
  2291.  
  2292. // Otherwise we'll start a turfwar.
  2293. else
  2294. {
  2295. #define TURF_WAR_TIME 480000 // 8 minutes, milliseconds
  2296. #define TURF_WAR_TICK 240 // 4 minutes for one players, seconds
  2297.  
  2298. // Set turf status to started.
  2299. gZones[ zoneid ][ G_ZONE_WAR ] = 1;
  2300.  
  2301. // Give gang one kill for starting gang war.
  2302. zDeaths[ gangid ][ zoneid ][ 0 ] += 1;
  2303.  
  2304. // Clear deaths/kills for all gangs for this zone.
  2305. // This makes it so kills that did not happen in the turf war are not counted.
  2306.  
  2307. for ( new g = 0; g < MAX_GANGS; g++ )
  2308. {
  2309. zDeaths[ g ][ zoneid ][ 0 ] = 0; // Kills
  2310. zDeaths[ g ][ zoneid ][ 1 ] = 0; // Deaths
  2311. }
  2312.  
  2313. for ( new gID = 0; gID < MAX_GANGS; gID++ )
  2314. {
  2315. if ( gData[ gID ][ G_TOTALS ] )
  2316. {
  2317. zTicks[ gID ][ zoneid ][ 0 ] = TURF_WAR_TICK;
  2318. zDeaths[ gID ][ zoneid ][ 0 ] = zDeaths[ gID ][ zoneid ][ 1 ] = 0;
  2319. }
  2320. }
  2321.  
  2322. // Make the zone flash.
  2323. GangZoneFlashForAll( zoneid, 0xFF000080 );
  2324.  
  2325. // Tell the attacking gang that they've provoked a war.
  2326. TextDrawShowForGang( gangid, TEXT_WarProvokedAttack );
  2327.  
  2328. // Tell the defense gang that a war has been provoked.
  2329. TextDrawShowForGang( gZones[ zoneid ][ G_ZONE_OWNER ], TEXT_WarProvokedDefense );
  2330.  
  2331. // Make text draws disappear after 10 seconds.
  2332. SetTimerEx( "TextDrawHideForGang", 10000, 0, "ii", pData[ playerid ][ P_GANG_ID ], _:TEXT_WarProvokedAttack );
  2333. SetTimerEx( "TextDrawHideForGang", 10000, 0, "ii", gZones[ zoneid ][ G_ZONE_OWNER ], _:TEXT_WarProvokedDefense );
  2334.  
  2335. // End the gang war after 10 minutes if it doesn't end itself.
  2336. gZones[ zoneid ][ G_ZONE_TIMER ] = SetTimerEx( "EndGangWar", TURF_WAR_TIME, 0, "i", zoneid );
  2337.  
  2338. #undef TURF_WAR_TIME
  2339. #undef TURF_WAR_TICK
  2340. }
  2341. }
  2342. // Otherwise increase ticks in zone.
  2343. else zTicks[ gangid ][ zoneid ][ 0 ]++;
  2344. }
  2345. return 1;
  2346. }
  2347.  
  2348. public OnPlayerLeaveGangZone( playerid, zoneid )
  2349. {
  2350. TextDrawHideForPlayer( playerid, gZones[ zoneid ][ G_ZONE_TEXT ] );
  2351.  
  2352. if ( IsPlayerInAnyGang( playerid ) )
  2353. {
  2354. new gangid = pData[ playerid ][ P_GANG_ID ];
  2355.  
  2356. if ( pData[ playerid ][ P_IN_ZONE ] )
  2357. {
  2358. zTicks[ gangid ][ zoneid ][ 1 ] --;
  2359.  
  2360. if ( !gZones[ zoneid ][ G_ZONE_WAR ] && !zTicks[ gangid ][ zoneid ][ 1 ] )
  2361. zTicks[ gangid ][ zoneid ][ 0 ] = 0;
  2362. }
  2363.  
  2364. // if ( !zTicks[ gangid ][ zoneid ][ 1 ] ) zTicks[ gangid ][ zoneid ][ 0 ] = 0;
  2365. // else if ( zTicks[ gangid ][ zoneid ][ 0 ] ) zTicks[ gangid ][ zoneid ][ 0 ] += zTicks[ gangid ][ zoneid ][ 0 ] / zTicks[ gangid ][ zoneid ][ 1 ];
  2366. }
  2367.  
  2368. pData[ playerid ][ P_IN_ZONE ] = 0;
  2369.  
  2370. return 1;
  2371. }
  2372. #endif
  2373.  
  2374. public OnPlayerEnterCheckpoint( playerid )
  2375. {
  2376. if ( !pData[ playerid ][ P_IN_CHECKPOINT ] )
  2377. {
  2378. pData[ playerid ][ P_IN_CHECKPOINT ] = 1;
  2379.  
  2380. switch ( pData[ playerid ][ P_CHECKPOINT_AREA ] )
  2381. {
  2382. case CP_S_BANK, CP_L_BANK:
  2383. {
  2384. SendClientMessage( playerid, COLOR_GREEN, "24/7 Bank:" );
  2385. SendClientMessage( playerid, COLOR_YELLOW, "You can use the bank to store cash in your bank account." );
  2386. SendClientMessage( playerid, COLOR_YELLOW, "Commands: /bank [amount], /withdraw [amount], /balance" );
  2387.  
  2388. if ( IsPlayerInAnyGang( playerid ) )
  2389. {
  2390. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK_TEXT ] = CreateGangBankText( pData[ playerid ][ P_GANG_ID ] );
  2391. SendClientMessage( playerid, COLOR_YELLOW, "Commands: /gbank [amount], /gwithdraw [amount], /gbalance" );
  2392. }
  2393.  
  2394. SetPlayerPos( playerid, gCheckpoints[ pData[ playerid ][ P_CHECKPOINT_AREA ] ][ CP_POS_X ] + minrand( -1, 1 ), gCheckpoints[ pData[ playerid ][ P_CHECKPOINT_AREA ] ][ CP_POS_Y ] + minrand( -1, 1 ), gCheckpoints[ pData[ playerid ][ P_CHECKPOINT_AREA ] ][ CP_POS_Z ] );
  2395. SetPlayerFacingAngle( playerid, 180.0 );
  2396.  
  2397. pData[ playerid ][ P_BANK_TEXT ] = CreateBankText( playerid );
  2398. ShowBankMenu( playerid );
  2399. }
  2400.  
  2401. case CP_S_AMMUNATION, CP_M_AMMUNATION, CP_L_AMMUNATION:
  2402. {
  2403. SendClientMessage( playerid, COLOR_GREEN, "Spawn Weapons:" );
  2404. SendClientMessage( playerid, COLOR_YELLOW, "You can buy weapons to spawn with here using the command" );
  2405. SendClientMessage( playerid, COLOR_YELLOW, "/buyweapon [weaponid] [amount]. To see a list of weapons type /weaponlist" );
  2406.  
  2407. SetPlayerPos( playerid, gCheckpoints[ pData[ playerid ][ P_CHECKPOINT_AREA ] ][ CP_POS_X ] + minrand( -1, 1 ), gCheckpoints[ pData[ playerid ][ P_CHECKPOINT_AREA ] ][ CP_POS_Y ] + minrand( -1, 1 ), gCheckpoints[ pData[ playerid ][ P_CHECKPOINT_AREA ] ][ CP_POS_Z ] );
  2408.  
  2409. ShowWeaponMenu( playerid );
  2410. }
  2411.  
  2412. case CP_ZIP .. CP_DIDIER_SACHS:
  2413. {
  2414. new
  2415. tString[ MAX_CLIENT_MSG ],
  2416. tPropertyID = pData[ playerid ][ P_CHECKPOINT_AREA ] - _:CP_ZIP;
  2417.  
  2418. if ( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] == playerid )
  2419. {
  2420. format( tString, sizeof( tString ), "* You can sell %s for $%d with /sell.", gPropertyData[ tPropertyID ][ PROPERTY_NAME ], gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] );
  2421. SendClientMessage( playerid, COLOR_YELLOW, tString );
  2422.  
  2423. ShowPropertyMenu( playerid );
  2424. }
  2425.  
  2426. else
  2427. {
  2428. if ( gPropertyData[ tPropertyID ][ PROPERTY_CAN_BE_BOUGHT ] )
  2429. {
  2430. format( tString, sizeof( tString ), "* You can purchase %s for $%d with /buy.", gPropertyData[ tPropertyID ][ PROPERTY_NAME ], gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] );
  2431. SendClientMessage( playerid, COLOR_YELLOW, tString );
  2432. format( tString, sizeof( tString ), "* You will earn $%d regularly.", gPropertyData[ tPropertyID ][ PROPERTY_PAYMENT ] );
  2433. SendClientMessage( playerid, COLOR_YELLOW, tString );
  2434.  
  2435. ShowPropertyMenu( playerid );
  2436. }
  2437.  
  2438. else
  2439. SendClientMessage( playerid, COLOR_RED, "This property is not for sale right now. Please check back soon." );
  2440.  
  2441. if ( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  2442. {
  2443. GetPlayerName( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ], tString, MAX_PLAYER_NAME );
  2444.  
  2445. format( tString, sizeof( tString ), "* This property is currently owned by %s (ID: %d)", tString, gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] );
  2446. SendClientMessage( playerid, COLOR_RED, tString );
  2447. }
  2448. }
  2449. }
  2450.  
  2451. case CP_LIBERTY: GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Press ~r~~k~~PED_FIREWEAPON~ ~y~to go to Las Venturas", 3000, 3 );
  2452. }
  2453. }
  2454.  
  2455. return 1;
  2456. }
  2457.  
  2458. public OnPlayerLeaveCheckpoint( playerid )
  2459. {
  2460. pData[ playerid ][ P_IN_CHECKPOINT ] = 0;
  2461. return 1;
  2462. }
  2463.  
  2464. public OnPlayerSelectedMenuRow( playerid, row )
  2465. {
  2466. new
  2467. Menu:tmpMenu = GetPlayerMenu( playerid ), // Get the players menuid.
  2468. bMenu = GetBankMenuID( tmpMenu ); // Get the bank menuid from the player menu.
  2469.  
  2470. HideMenuForPlayer( tmpMenu, playerid );
  2471.  
  2472. if ( bMenu != INVALID_BANK_MENU )
  2473. {
  2474. // If bMenu is not equal to INVALID_BANK_MENU then call to
  2475. // our bank menu handler.
  2476.  
  2477. OnPlayerSelectedBankRow( playerid, e_BANK_MENU:bMenu, row );
  2478.  
  2479. return 1;
  2480. }
  2481.  
  2482. else if ( OnPlayerSelectedPropertyRow( playerid, tmpMenu, row ) )
  2483. return 1;
  2484.  
  2485. else if ( OnPlayerSelectedWeaponRow( playerid, tmpMenu, row ) )
  2486. return 1;
  2487.  
  2488. return 1;
  2489. }
  2490.  
  2491. public OnPlayerExitedMenu( playerid )
  2492. {
  2493. if ( pData[ playerid ][ P_ACTIVITY ] >= _:P_ACTIVITY_BANK && pData[ playerid ][ P_ACTIVITY ] <= _:G_BANK_WITHDRAW )
  2494. {
  2495. // Hide the bank text for the player.
  2496. TextDrawHideForPlayer( playerid, pData[ playerid ][ P_BANK_TEXT ] );
  2497.  
  2498. // If IsPlayerInAnyGang then hide the gang bank text.
  2499. if ( IsPlayerInAnyGang( playerid ) )
  2500. TextDrawHideForPlayer( playerid, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK_TEXT ] );
  2501.  
  2502. // If the players activity is in between _P_ACTIVITY bank and _G_BANK_WITHDRAW (inclusive) then
  2503. // show the main bank menu.
  2504. if ( pData[ playerid ][ P_ACTIVITY ] != _:P_ACTIVITY_BANK )
  2505. ShowBankMenu( playerid );
  2506. else
  2507. {
  2508. // Menu's are an activity so we'll set the player to _P_ACTIVITY_NONE since the script
  2509. // currently only allows ONE activity.
  2510.  
  2511. pData[ playerid ][ P_ACTIVITY ] = _:P_ACTIVITY_NONE;
  2512. TogglePlayerControllable( playerid, 1 );
  2513. }
  2514. }
  2515.  
  2516. else if ( pData[ playerid ][ P_ACTIVITY ] >= _:P_ACTIVITY_AMMU_MAIN && pData[ playerid ][ P_ACTIVITY ] <= _:P_ACTIVITY_AMMU_ASSAULT )
  2517. {
  2518. if ( pData[ playerid ][ P_ACTIVITY ] != _:P_ACTIVITY_AMMU_MAIN )
  2519. ShowWeaponMenu( playerid );
  2520. else
  2521. {
  2522. // Menu's are an activity so we'll set the player to _P_ACTIVITY_NONE since the script
  2523. // currently only allows ONE activity.
  2524.  
  2525. pData[ playerid ][ P_ACTIVITY ] = _:P_ACTIVITY_NONE;
  2526. TogglePlayerControllable( playerid, 1 );
  2527. }
  2528. }
  2529.  
  2530. else if ( pData[ playerid ][ P_ACTIVITY ] == _:P_ACTIVITY_PROPERTY )
  2531. TogglePlayerControllable( playerid, 1 );
  2532.  
  2533. return 1;
  2534. }
  2535.  
  2536. public OnPlayerStateChange( playerid, newstate, oldstate )
  2537. {
  2538. if ( newstate == PLAYER_STATE_DRIVER )
  2539. {
  2540. new
  2541. iVehicleID = GetPlayerVehicleID( playerid );
  2542.  
  2543. if ( iVehicleID == sRhino )
  2544. {
  2545. sRhinoOwner = playerid;
  2546.  
  2547. SetPlayerColor ( sRhinoOwner, COLOR_RED );
  2548. SendClientMessageToAll ( COLOR_ORANGE, "(News) An unauthorized person has stolen a Rhino. The Rhino has been marked RED on your radar." );
  2549. }
  2550.  
  2551. return 1;
  2552. }
  2553.  
  2554. if ( oldstate == PLAYER_STATE_DRIVER )
  2555. {
  2556. new
  2557. iVehicleID = GetPlayerVehicleID( playerid );
  2558.  
  2559. if ( iVehicleID == sRhino || sRhinoOwner == playerid )
  2560. {
  2561. if ( sHighBountyPlayer == playerid )
  2562. SetPlayerColor( playerid, COLOR_ORANGE );
  2563.  
  2564. else if ( !IsPlayerInAnyGang( playerid ) )
  2565. SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  2566.  
  2567. else
  2568. {
  2569. // If player isn't high bounty and if the player is in a gang...
  2570. SetPlayerColor( playerid, setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0x40 ) );
  2571.  
  2572. for ( new memberid = 0; memberid < gData[ pData[ playerid ][ P_GANG_ID ] ][ G_TOTALS ]; memberid++ )
  2573. {
  2574. if ( IsPlayerConnected( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] ) )
  2575. {
  2576. SetPlayerMarkerForPlayer( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], playerid, setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  2577.  
  2578. if ( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] != sRhinoOwner && gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] != sHighBountyPlayer )
  2579. SetPlayerMarkerForPlayer( playerid, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  2580. }
  2581. }
  2582. }
  2583.  
  2584. sRhinoOwner = INVALID_PLAYER_ID;
  2585. }
  2586.  
  2587. return 1;
  2588. }
  2589.  
  2590. return 1;
  2591. }
  2592.  
  2593. public OnPlayerExitVehicle( playerid )
  2594. {
  2595.  
  2596. new
  2597. iVehicleID = GetPlayerVehicleID( playerid );
  2598.  
  2599. if ( iVehicleID == sRhino || sRhinoOwner == playerid )
  2600. {
  2601. if ( sHighBountyPlayer == playerid )
  2602. SetPlayerColor( playerid, COLOR_ORANGE );
  2603.  
  2604. else if ( !IsPlayerInAnyGang( playerid ) )
  2605. SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  2606.  
  2607. else
  2608. {
  2609. // If player isn't high bounty and if the player is in a gang...
  2610. SetPlayerColor( playerid, setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0x40 ) );
  2611.  
  2612. for ( new memberid = 0; memberid < gData[ pData[ playerid ][ P_GANG_ID ] ][ G_TOTALS ]; memberid++ )
  2613. {
  2614. if ( IsPlayerConnected( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] ) )
  2615. {
  2616. SetPlayerMarkerForPlayer( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], playerid, setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  2617.  
  2618. if ( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] != sRhinoOwner && gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] != sHighBountyPlayer )
  2619. SetPlayerMarkerForPlayer( playerid, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], setAlpha( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  2620. }
  2621. }
  2622. }
  2623.  
  2624. sRhinoOwner = INVALID_PLAYER_ID;
  2625. }
  2626.  
  2627. return 1;
  2628. }
  2629.  
  2630. public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
  2631. {
  2632. if ( ( newkeys & KEY_FIRE ) && !( oldkeys & KEY_FIRE ) )
  2633. {
  2634. if ( pData[ playerid ][ P_CHECKPOINT_AREA ] == _:CP_LIBERTY && IsPlayerInCheckpoint( playerid ) )
  2635. {
  2636. static const
  2637. Float:SRSLY[ 7 ][ 4 ] =
  2638. {
  2639. { 1674.9288,1447.7271,10.7889,267.6050 },
  2640. { 1666.4042,1423.3108,10.7832,270.9067 },
  2641. { 1677.5438,1394.1249,10.7260,303.3253 },
  2642. { 1703.5583,1365.9127,10.7502,355.6524 },
  2643. { 1667.1312,1472.3821,10.7750,272.3050 },
  2644. { 1679.9237,1502.2502,10.7687,242.5380 },
  2645. { 1703.4874,1526.3577,10.7578,181.4375 }
  2646. };
  2647.  
  2648. new
  2649. ORLY = random( sizeof( SRSLY ) );
  2650.  
  2651. SetPlayerInterior( playerid, 0 );
  2652. SetPlayerPos( playerid, SRSLY[ ORLY ][ 0 ], SRSLY[ ORLY ][ 1 ], SRSLY[ ORLY ][ 2 ] );
  2653. SetPlayerFacingAngle( playerid, SRSLY[ ORLY ][ 3 ] );
  2654. }
  2655. else
  2656. {
  2657. new
  2658. Float:pX,
  2659. Float:pY,
  2660. Float:pZ,
  2661. pState = GetPlayerState( playerid );
  2662.  
  2663. GetPlayerPos( playerid, pX, pY, pZ );
  2664.  
  2665. if ( pX >= 8000.0 && pZ >= 100.0 && pState == PLAYER_STATE_DRIVER )
  2666. {
  2667. new
  2668. plyrVehicle = GetPlayerVehicleID( playerid );
  2669.  
  2670. loopPlayers( i )
  2671. {
  2672. if ( GetPlayerVehicleID( i ) == plyrVehicle )
  2673. {
  2674. SetPlayerInterior( i, 1 );
  2675. SetPlayerPos( i, -784.3389,494.7509,1376.1953 );
  2676. SetPlayerFacingAngle( i, 90.6109 );
  2677. }
  2678. }
  2679.  
  2680. SetVehicleToRespawn( plyrVehicle );
  2681. }
  2682. }
  2683. }
  2684.  
  2685. return 1;
  2686. }
  2687.  
  2688. //******************************************************************************
  2689. // Functions
  2690. //******************************************************************************
  2691.  
  2692. public GetPlayerLevel( playerid )
  2693. return pData[ playerid ][ P_LEVEL ];
  2694.  
  2695. public AC_GetPlayerMoney( playerid )
  2696. return AC_Money[ playerid ];
  2697.  
  2698. public AC_GivePlayerMoney( playerid, money )
  2699. {
  2700. GivePlayerMoney( playerid, money );
  2701.  
  2702. pData [ playerid ][ P_SCRIPT_MONEY ] += 2;
  2703. AC_Money[ playerid ] += money;
  2704.  
  2705. return 1;
  2706. }
  2707.  
  2708. public AC_ResetPlayerMoney( playerid )
  2709. {
  2710. ResetPlayerMoney( playerid );
  2711.  
  2712. pData [ playerid ][ P_SCRIPT_MONEY ] += 2;
  2713. AC_Money[ playerid ] = 0;
  2714.  
  2715. return 1;
  2716. }
  2717.  
  2718. public PropertySync( )
  2719. {
  2720. new
  2721. pPayments [ sizeof ( gPropertyData ) ][ 2 ],
  2722. tString [ MAX_CLIENT_MSG ];
  2723.  
  2724. for ( new i = 0; i < sizeof ( gPropertyData ); i++ )
  2725. {
  2726. // Set this array to equal { INVALID_PLAYER_ID, 0 };
  2727. pPayments[ i ] = { INVALID_PLAYER_ID, 0 };
  2728.  
  2729. // If this property is owned by a valid player id
  2730. if ( gPropertyData[ i ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  2731. {
  2732. gPropertyData[ i ][ PROPERTY_TICKS ]--;
  2733.  
  2734. if ( !gPropertyData[ i ][ PROPERTY_TICKS ] )
  2735. {
  2736. gPropertyData[ i ][ PROPERTY_CAN_BE_BOUGHT ]= 1;
  2737. gPropertyData[ i ][ PROPERTY_TICKS ] = gPropertyData[ i ][ PROPERTY_TIME ];
  2738.  
  2739. for ( new k = 0; k < sizeof ( gPropertyData ); k++ )
  2740. {
  2741. if ( pPayments[ k ][ 0 ] == gPropertyData[ i ][ PROPERTY_OWNER ] )
  2742. {
  2743. pPayments[ k ][ 1 ] += gPropertyData[ i ][ PROPERTY_PAYMENT ];
  2744. break;
  2745. }
  2746.  
  2747. else if ( pPayments[ k ][ 0 ] == INVALID_PLAYER_ID )
  2748. {
  2749. pPayments[ k ][ 0 ] = gPropertyData[ i ][ PROPERTY_OWNER ];
  2750. pPayments[ k ][ 1 ] = gPropertyData[ i ][ PROPERTY_PAYMENT ];
  2751. break;
  2752. }
  2753. }
  2754. }
  2755. }
  2756. }
  2757.  
  2758. for ( new i = 0; i < sizeof( gPropertyData ); i++ )
  2759. {
  2760. if ( pPayments[ i ][ 0 ] != INVALID_PLAYER_ID )
  2761. {
  2762. AC_GivePlayerMoney( pPayments[ i ][ 0 ], pPayments[ i ][ 1 ] );
  2763. format( tString, sizeof( tString ), "* You earned $%d from your properties.", pPayments[ i ][ 1 ] );
  2764. SendClientMessage( pPayments[ i ][ 0 ], COLOR_GREEN, tString );
  2765. }
  2766. }
  2767. }
  2768.  
  2769. public WeatherSync( )
  2770. {
  2771. for ( new s = 0; s < 3; s++ )
  2772. {
  2773. sWeather[ s ][ 1 ]--;
  2774.  
  2775. if ( !sWeather[ s ][ 1 ] )
  2776. {
  2777. switch ( s )
  2778. {
  2779. case 0 : sWeather[ s ][ 0 ] = randarg( 10, 11, 12 ); // Las Venturas
  2780. case 1 : sWeather[ s ][ 0 ] = randarg( 17, 18, 19 ); // Desert
  2781. default: sWeather[ s ][ 0 ] = randarg( 0, 1, 2, 15 ); // Everywhere else
  2782. }
  2783.  
  2784. sWeather[ s ][ 1 ] = minrand( 2, 16 );
  2785. }
  2786. }
  2787. }
  2788.  
  2789. public SaveSync( )
  2790. {
  2791. for ( new tmpSave = 0; tmpSave < MAX_SAVES; tmpSave++ )
  2792. {
  2793. if ( !tData[ tmpSave ][ T_TICKS ] )
  2794. continue;
  2795.  
  2796. tData[ tmpSave ][ T_TICKS ]--;
  2797.  
  2798. if ( !tData[ tmpSave ][ T_TICKS ] )
  2799. {
  2800. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  2801. {
  2802. tData[ tmpSave ][ T_TEMP_WEAPONS ][ i ] = tData[ tmpSave ][ T_TEMP_AMMO ][ i ] = 0;
  2803. tData[ tmpSave ][ T_SPAWN_WEAPONS ][ i ]= tData[ tmpSave ][ T_SPAWN_AMMO ][ i ] = 0;
  2804. }
  2805.  
  2806. tData[ tmpSave ][ T_NAME ] = '\0';
  2807. tData[ tmpSave ][ T_MONEY ] = tData[ tmpSave ][ T_MUTE ] = tData[ tmpSave ][ T_BANK ] = tData[ tmpSave ][ T_BOUNTY ] = 0;
  2808. tData[ tmpSave ][ T_SKIN ] = -1;
  2809. tData[ tmpSave ][ T_ARMOR ] = 0.0;
  2810. tData[ tmpSave ][ T_HEALTH ] = 100.0;
  2811. }
  2812. }
  2813. }
  2814.  
  2815. public ScriptSync( )
  2816. {
  2817. new
  2818. tString[ MAX_CLIENT_MSG ];
  2819.  
  2820. #if NEW_PIRATE_MODE == true
  2821. if ( sPirateOwner != INVALID_PLAYER_ID )
  2822. {
  2823. new
  2824. Float:pX, Float:pY, Float:pZ;
  2825.  
  2826. GetPlayerPos( sPirateOwner, pX, pY, pZ );
  2827.  
  2828. // If the pirate owner is in the pirate ship area then give them $100.
  2829. if (
  2830. pZ >= 10.75 && pZ <= 60.75 &&
  2831. (
  2832. IsPointInArea( pX, pY, pZ, 1995.5, 2006.0, 1518.0, 1569.0 ) || // Ship 1
  2833. IsPointInArea( pX, pY, pZ, 1930.7327, 1975.8258, 1471.5734, 1556.2048 ) || // Ship 2
  2834. IsPointInArea( pX, pY, pZ, 1957.9447, 1997.2313, 1521.3459, 1548.3746 ) // BoardWalk
  2835. )
  2836. ) AC_GivePlayerMoney( sPirateOwner, 100 );
  2837.  
  2838. else
  2839. {
  2840. SendClientMessage ( sPirateOwner, COLOR_GREEN, "You lost the briefcase because you left the ship." );
  2841. DestroyObject ( sPirateBriefcaseObj );
  2842. sPirateBriefcaseObj = CreateObject( 1318,2002.7188, 1548.1165, 0.0, 0.0, 0.0, 0.0 );
  2843.  
  2844. sPirateOwner = INVALID_PLAYER_ID;
  2845. sPirateBriefcase= CreatePickup( 1210,DEFAULT_PICKUP_TYPE, 2002.7188, 1548.1165, 13.5859 );
  2846. }
  2847. }
  2848. #endif
  2849.  
  2850. if ( sRhinoOwner != INVALID_PLAYER_ID )
  2851. AC_GivePlayerMoney( sRhinoOwner, -25 );
  2852.  
  2853. loopPlayers( playerid )
  2854. {
  2855. new
  2856. pState = GetPlayerState( playerid );
  2857.  
  2858. // Increase the amount of seconds online.
  2859. pData[ playerid ][ P_ONLINE_TICKS ] ++;
  2860.  
  2861. // Set the players score to their money.
  2862. SetPlayerScore( playerid, GetPlayerMoney( playerid ) );
  2863.  
  2864. // If the player has no state (aka not spawned) then go to next playerid.
  2865. if ( !pState )
  2866. continue;
  2867.  
  2868. // If the minute is 0 (new hour) then resync the time.
  2869. if ( !sMinute )
  2870. SetPlayerTime( playerid, sHour, sMinute );
  2871.  
  2872. // Create pOldGangZone to store old gangzone for when the player leaves
  2873. new
  2874. pOldCheckpoint = pData[ playerid ][ P_CHECKPOINT_AREA],
  2875. pOldGangZone = pData[ playerid ][ P_GANG_ZONE ],
  2876. pSpecialAction = GetPlayerSpecialAction( playerid ),
  2877. pMoney = GetPlayerMoney( playerid ),
  2878. pInterior = GetPlayerInterior( playerid ),
  2879. Float:pX,
  2880. Float:pY,
  2881. Float:pZ;
  2882.  
  2883. GetPlayerPos( playerid, pX, pY, pZ );
  2884.  
  2885. if ( !IsPlayerAdmin( playerid ) && pData[ playerid ][ P_LEVEL ] < _:P_LEVEL_SERVER )
  2886. {
  2887. if ( pSpecialAction == SPECIAL_ACTION_USEJETPACK )
  2888. {
  2889. new
  2890. DB:Database = db_open( SZ_SQLITE_DB );
  2891.  
  2892. if ( Database )
  2893. {
  2894. BanPlayer ( Database, playerid, 1000, "Jetpack." );
  2895. db_close ( Database );
  2896. }
  2897.  
  2898. else
  2899. BanEx( playerid, "Jetpack." );
  2900.  
  2901. continue;
  2902. }
  2903. }
  2904.  
  2905. if ( pData[ playerid ][ P_INVINCIBLE_TICKS ] )
  2906. {
  2907. pData[ playerid ][ P_INVINCIBLE_TICKS ]--;
  2908.  
  2909. if ( !pData[ playerid ][ P_INVINCIBLE_TICKS ] )
  2910. {
  2911. if ( pData[ playerid ][ P_HEALTH ] > 0.0 )
  2912. SetPlayerHealth( playerid, pData[ playerid ][ P_HEALTH ] );
  2913.  
  2914. else
  2915. {
  2916. SetPlayerHealth ( playerid, 100.0 );
  2917. SendClientMessage ( playerid, COLOR_RED, "ERROR: FAILSAFE 001 APPLIED" );
  2918. printf ( "ERROR: FAILSAFE 001 APPLIED TO PLAYER %d", playerid );
  2919. }
  2920. }
  2921. }
  2922.  
  2923. if ( pState == PLAYER_STATE_DRIVER || pState == PLAYER_STATE_PASSENGER )
  2924. {
  2925. if ( pX >= 8000.0 && pZ >= 100.0 )
  2926. GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Press ~r~~k~~PED_FIREWEAPON~ ~y~to go to Liberty City", 3000, 3 );
  2927. }
  2928.  
  2929. if ( pData[ playerid ][ P_LOGGED_IN ] && pData[ playerid ][ P_REGISTERED ] )
  2930. {
  2931. pData[ playerid ][ P_RESAVE_TICKS ]++;
  2932.  
  2933. if ( pData[ playerid ][ P_RESAVE_TICKS ] > 1200 ) // SAVE EVERY 20 MINUTES
  2934. {
  2935. new
  2936. DB:Database = db_open( SZ_SQLITE_DB );
  2937.  
  2938. GetPlayerName( playerid, tString, MAX_PLAYER_NAME );
  2939.  
  2940. if ( Database )
  2941. {
  2942. SaveUser ( Database, playerid, tString );
  2943. SendClientMessage ( playerid, 0xFFFFFFFF, "* Your stats have been automatically saved." );
  2944. db_close ( Database );
  2945. }
  2946. else
  2947. print ( "[ERROR] NO DATABASE!" );
  2948.  
  2949. pData[ playerid ][ P_RESAVE_TICKS ] = 0;
  2950. }
  2951. }
  2952.  
  2953. if ( ( sHour >= 20 || sHour <= 4 ) && IsPlayerStripper( playerid ) && IsPlayerInAnyStripClub( playerid ) && pSpecialAction == SPECIAL_ACTION_DANCE4 )
  2954. AC_GivePlayerMoney( playerid, 25 );
  2955.  
  2956. if ( !pInterior )
  2957. {
  2958. if ( IsPointInArea( pX, pY, pZ, 618.9274, 2966.18, 607.2495, 2989.536 ) ) // Las Venturas
  2959. SetPlayerWeather( playerid, sWeather[ 0 ][ 0 ] );
  2960.  
  2961. else if ( IsPointInArea( pX, pY, pZ, -1307.922, 618.9274, 910.8743, 2884.435 ) )// Desert
  2962. SetPlayerWeather( playerid, sWeather[ 1 ][ 0 ] );
  2963.  
  2964. else
  2965. SetPlayerWeather( playerid, sWeather[ 2 ][ 0 ] );
  2966. }
  2967. else
  2968. SetPlayerWeather( playerid, 0 );
  2969.  
  2970. #if NEW_PIRATE_MODE == false
  2971. if (
  2972. pZ >= 10.75 && pZ <= 60.75 &&
  2973. (
  2974. IsPointInArea( pX, pY, pZ, 1995.5, 2006.0, 1518.0, 1569.0 ) || // Ship 1
  2975. IsPointInArea( pX, pY, pZ, 1930.7327, 1975.8258, 1471.5734, 1556.2048 ) || // Ship 2
  2976. IsPointInArea( pX, pY, pZ, 1957.9447, 1997.2313, 1521.3459, 1548.3746 ) // BoardWalk
  2977. )
  2978. ) AC_GivePlayerMoney( playerid, 25 );
  2979. #endif
  2980.  
  2981. if ( pInterior )
  2982. {
  2983. // Majority of checkpoints are interior based so
  2984. // we can start checking checkpoints here.
  2985. pData[ playerid ][ P_GANG_ZONE ] = INVALID_GANG_ZONE;
  2986.  
  2987. if (
  2988. pData[ playerid ][ P_CHECKPOINT_AREA ] == 255 ||
  2989. !IsPointInCheckpointArea( pInterior, pX, pY, pZ, pData[ playerid ][ P_CHECKPOINT_AREA ] )
  2990. )
  2991. {
  2992. pData[ playerid ][ P_CHECKPOINT_AREA ] = 255;
  2993.  
  2994. // Check if player is in any of the checkpoints.
  2995. for ( new i = 0, j = sizeof ( gCheckpoints ); i < j; i++ )
  2996. {
  2997. // If player is in the checkpoint area for CPID i, then create the checkpoint,
  2998. // set pInCP to 1 (true) and end the loop.
  2999. if ( IsPointInCheckpointArea( pInterior, pX, pY, pZ, i ) )
  3000. {
  3001. CreateCheckpoint( playerid, i );
  3002.  
  3003. break;
  3004. }
  3005. }
  3006. }
  3007. }
  3008.  
  3009. else
  3010. {
  3011. // All gang territories are not in interiors so
  3012. // we can start checking gangzones here.
  3013.  
  3014. pData[ playerid ][ P_CHECKPOINT_AREA ] = 255;
  3015.  
  3016. #if VERSION_LITE == false
  3017.  
  3018. if (
  3019. pData[ playerid ][ P_GANG_ZONE ] == INVALID_GANG_ZONE ||
  3020. !IsPointInGangZone( pX, pY, pZ, pData[ playerid ][ P_GANG_ZONE ] )
  3021. )
  3022. {
  3023. pData[ playerid ][ P_GANG_ZONE ] = INVALID_GANG_ZONE;
  3024.  
  3025. // Check if player is in any of the gang zones.
  3026. for ( new i = 0, j = sizeof ( gZones ); i < j; i++ )
  3027. {
  3028. // If player is in gang zone then set current gang zone to the current
  3029. // gangid and end the loop.
  3030.  
  3031. if ( IsPointInGangZone( pX, pY, pZ, i ) )
  3032. {
  3033. pData[ playerid ][ P_GANG_ZONE ] = i;
  3034.  
  3035. break;
  3036. }
  3037. }
  3038. }
  3039.  
  3040. #endif
  3041. }
  3042.  
  3043. // If players checkpoint is invalid then disable the checkpoint.
  3044. if ( pOldCheckpoint != 0xFF )
  3045. {
  3046. if ( pData[ playerid ][ P_CHECKPOINT_AREA ] == 0xFF )
  3047. {
  3048. DisablePlayerCheckpoint( playerid );
  3049.  
  3050. if ( pData[ playerid ][ P_NO_WEAPON_AREA ] )
  3051. {
  3052. // Player is in NO WEAPON AREA and is leaving it
  3053. // ...
  3054.  
  3055. SetPlayerTeam ( playerid, playerid );
  3056.  
  3057. #if MODE_PROTECTED_WEAPONS == 0
  3058.  
  3059. GameTextForPlayer ( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~ ~y~Weapons Enabled:~n~ ~r~Fighting Allowed", 5000, 3 );
  3060.  
  3061. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  3062. {
  3063. GivePlayerWeapon( playerid, pData[ playerid ][ P_TEMP_WEAPONS ][ i ], pData[ playerid ][ P_TEMP_AMMO ][ i ] );
  3064.  
  3065. pData[ playerid ][ P_TEMP_AMMO ][ i ] =0;
  3066. pData[ playerid ][ P_TEMP_WEAPONS ][ i ]=0;
  3067. }
  3068.  
  3069. #elseif MODE_PROTECTED_WEAPONS == 1
  3070.  
  3071. GameTextForPlayer ( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~ ~y~Weapon Damage Enabled:~n~ ~r~Fighting Allowed", 5000, 3 );
  3072.  
  3073. #endif
  3074.  
  3075. pData[ playerid ][ P_NO_WEAPON_AREA ] = 0;
  3076. }
  3077.  
  3078. }
  3079.  
  3080. else if ( pData[ playerid ][ P_NO_WEAPON_AREA ] )
  3081. {
  3082. #if MODE_PROTECTED_WEAPONS == 0
  3083.  
  3084. new
  3085. lTempWeaponData[ 2 ];
  3086.  
  3087. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  3088. {
  3089. GetPlayerWeaponData( playerid, i, lTempWeaponData[ 0 ], lTempWeaponData[ 1 ] );
  3090.  
  3091. if ( lTempWeaponData[ 0 ] && lTempWeaponData[ 1 ] && ( lTempWeaponData[ 1 ] < 65535 || !i || i == 1 || i == 10 || i == 12 ) )
  3092. {
  3093. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = lTempWeaponData[ 0 ];
  3094. pData[ playerid ][ P_TEMP_AMMO ][ i ] +=lTempWeaponData[ 1 ];
  3095. }
  3096.  
  3097. lTempWeaponData[ 0 ] = 0;
  3098. lTempWeaponData[ 1 ] = 0;
  3099.  
  3100. SetPlayerAmmo( playerid, i, 0 );
  3101. }
  3102.  
  3103. GameTextForPlayer ( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~ ~y~Weapons Disabled:~n~ ~r~Fighting Disallowed", 2000, 3 );
  3104. ResetPlayerWeapons ( playerid );
  3105.  
  3106. #elseif MODE_PROTECTED_WEAPONS == 1
  3107.  
  3108. SetPlayerTeam( playerid, TEAM_INTERIOR );
  3109. GameTextForPlayer ( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~ ~y~Weapon Damage Disabled:~n~ ~r~Fighting Disallowed", 2000, 3 );
  3110.  
  3111. #endif
  3112. }
  3113. }
  3114.  
  3115. #if VERSION_LITE == false
  3116. // If player gangzone is not equal to their old zone and old gang zone is not equal to
  3117. // an invalid gang zone then call the callback OnPlayerLeaveGangZone.
  3118. if ( pData[ playerid ][ P_GANG_ZONE ] != pOldGangZone && pOldGangZone != INVALID_GANG_ZONE )
  3119. OnPlayerLeaveGangZone( playerid, pOldGangZone );
  3120. // CallRemoteFunction( "OnPlayerLeaveGangZone", "ii", playerid, pOldGangZone );
  3121.  
  3122. // If the player gang zone is not equal to an invalid gang zone then call the
  3123. // callback OnPlayerEnterGangZone.
  3124. if ( pData[ playerid ][ P_GANG_ZONE ] != INVALID_GANG_ZONE )
  3125. OnPlayerEnterGangZone( playerid, pData[ playerid ][ P_GANG_ZONE ] );
  3126. // CallRemoteFunction( "OnPlayerEnterGangZone", "ii", playerid, pData[ playerid ][ P_GANG_ZONE ] );
  3127. #endif
  3128.  
  3129. if ( !pData[ playerid ][ P_SCRIPT_MONEY ] )
  3130. {
  3131. if ( pMoney > AC_GetPlayerMoney( playerid ) + 5000 )
  3132. {
  3133. new
  3134. iACMoneyIncrease = pMoney - AC_GetPlayerMoney( playerid ),
  3135. pName[ MAX_PLAYER_NAME ],
  3136. mName[ 32 ] = "Unknown";
  3137.  
  3138. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  3139.  
  3140. if ( IsPointInArea( pX, pY, pZ, 1995.5, 2006.0, 1518.0, 1569.0 ) )
  3141. mName = "Pirate Ship";
  3142.  
  3143. else
  3144. {
  3145. switch ( pData[ playerid ][ P_CHECKPOINT_AREA ] )
  3146. {
  3147. case CP_LIBERTY : mName = "Liberty City";
  3148. case CP_S_BANK : mName = "Small Bank";
  3149. case CP_L_BANK : mName = "Large Bank";
  3150. case CP_S_AMMUNATION : mName = "Small Ammunation";
  3151. case CP_M_AMMUNATION : mName = "Medium Ammunation";
  3152. case CP_L_AMMUNATION : mName = "Large Ammunation";
  3153. case CP_ZIP .. CP_DANCE_CLUB: strcpy( mName, gPropertyData[ pData[ playerid ][ P_CHECKPOINT_AREA ] - _:CP_ZIP ][ PROPERTY_NAME ] );
  3154. default : mName = "Unknown";
  3155. }
  3156. }
  3157.  
  3158.  
  3159. format( tString, sizeof( tString ), "(Warning) %s (%d)'s cash just increased by $%d ($%d -> $%d) (%s).",
  3160. pName, playerid,
  3161. iACMoneyIncrease, AC_GetPlayerMoney( playerid ),
  3162. pMoney, mName
  3163. );
  3164.  
  3165. SendMessageToLevelAndHigher( _:P_LEVEL_MOD, 0xFF9900AA, tString );
  3166.  
  3167. format( tString, MAX_CLIENT_MSG, "[cashincrease] %s %d %d %d %s",
  3168. pName, playerid, AC_GetPlayerMoney( playerid ),
  3169. pMoney, mName
  3170. );
  3171.  
  3172. add_log( tString );
  3173. }
  3174.  
  3175. AC_Money[ playerid ] = pMoney;
  3176. }
  3177. else
  3178. pData[ playerid ][ P_SCRIPT_MONEY ]--;
  3179. }
  3180.  
  3181.  
  3182. // Increase sMinute.
  3183. sMinute++;
  3184.  
  3185. // Server minutes now equals the remainder of 60 divided by sMinute.
  3186. sMinute %= 60;
  3187.  
  3188. // If sMinute is 0 (New hour).
  3189. if ( !sMinute )
  3190. {
  3191. // Increase sHour and then make it the remainder of 24 divided by sHour. Set the world time to this hour also.
  3192. sHour++; sHour %= 24; SetWorldTime( sHour );
  3193.  
  3194. // If sHour is 0
  3195. if ( !sHour )
  3196. {
  3197. new str[ 64 ];
  3198.  
  3199. // Increase the sDay.
  3200. sDay++;
  3201.  
  3202. // sDay is now equal to the remainder of 7 divided by sDay.
  3203. sDay %= 7;
  3204.  
  3205. // Notify the server of the new day through client messages ...
  3206. // Might use text draw for this later on.
  3207.  
  3208.  
  3209. if ( sDay == 6 )
  3210. {
  3211. format( str, sizeof( str ), "~y~%s", random( 2 ) ? ("Caturday") : ("Saturday") );
  3212.  
  3213. if ( !sRhino )
  3214. {
  3215. sRhino = CreateVehicle( 432, 307.8188, 1801.3085, 17.6503, 179.5013, 43, 0, 960 );
  3216. SetVehicleHealth( sRhino, 2500.0 );
  3217. }
  3218. }
  3219. else
  3220. format( str, sizeof( str ), "~y~%s", sDays[ sDay ] );
  3221.  
  3222. TextDrawSetString( TEXT_Day, str );
  3223. }
  3224. }
  3225. }
  3226.  
  3227. public SpawnFinish( playerid )
  3228. {
  3229. #define gangid pData[ playerid ][ P_GANG_ID ]
  3230.  
  3231. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  3232. {
  3233. if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) && sRhinoOwner != gData[ gangid ][ G_MEMBERS ][ memberid ] && sHighBountyPlayer != gData[ gangid ][ G_MEMBERS ][ memberid ] )
  3234. {
  3235. // If the players i and playerid are in the same gang then set the marker to the gang colour
  3236. // with an alpha of 0xAA.
  3237.  
  3238. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], playerid, setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  3239. SetPlayerMarkerForPlayer( playerid, gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  3240. }
  3241. }
  3242.  
  3243. #undef gangid
  3244. }
  3245.  
  3246. stock randarg( ... )
  3247. return getarg( random( numargs( ) ) );
  3248.  
  3249. stock CreateDeathPickups( playerid )
  3250. {
  3251. new
  3252. tmpMoney = GetPlayerMoney( playerid ),
  3253. Float: pX,
  3254. Float: pY,
  3255. Float: pZ;
  3256.  
  3257. GetPlayerPos( playerid, pX, pY, pZ );
  3258.  
  3259. if ( moneyPickups[ playerid ][ 6 ] )
  3260. {
  3261. KillTimer ( moneyPickups[ playerid ][ 6 ] );
  3262. DestroyDeathPickups ( playerid );
  3263. }
  3264.  
  3265. if ( tmpMoney > 0 )
  3266. {
  3267. new
  3268. pickup = 1212;
  3269.  
  3270. moneyPickups[ playerid ][ 0 ] = tmpMoney / 5;
  3271.  
  3272. if ( moneyPickups[ playerid ][ 0 ] >= 10000 )
  3273. pickup = 1550;
  3274.  
  3275. for ( new i = 1; i < 6; i++ )
  3276. moneyPickups[ playerid ][ i ] = CreatePickup( pickup, DEFAULT_PICKUP_TYPE, pX + minrand(-4, 4), pY + minrand(-4, 4), pZ );
  3277. }
  3278.  
  3279. moneyPickups[ playerid ][ 6 ] = SetTimerEx( "DestroyDeathPickups", 16000, 0, "i", playerid );
  3280. }
  3281.  
  3282. public DestroyDeathPickups( playerid )
  3283. {
  3284. for ( new i = 1; i < 6; i++ )
  3285. {
  3286. if ( moneyPickups[ playerid ][ i ] != -1 )
  3287. DestroyPickup( moneyPickups[ playerid ][ i ] );
  3288.  
  3289. moneyPickups[ playerid ][ i ] = -1;
  3290. }
  3291.  
  3292. moneyPickups[ playerid ][ 0 ] = 0;
  3293. moneyPickups[ playerid ][ 6 ] = 0;
  3294. }
  3295.  
  3296. stock IsPlayerInGangZone( playerid, zoneid )
  3297. {
  3298. if ( IsPlayerInArea( playerid,
  3299. gZones[ zoneid ][ G_ZONE_MINX ],
  3300. gZones[ zoneid ][ G_ZONE_MAXX ],
  3301. gZones[ zoneid ][ G_ZONE_MINY ],
  3302. gZones[ zoneid ][ G_ZONE_MAXY ]
  3303. ) && !GetPlayerInterior( playerid ) ) return 1;
  3304. else return 0;
  3305. }
  3306.  
  3307. stock IsPointInGangZone( Float:X, Float:Y, Float:Z, zoneid )
  3308. {
  3309. if ( IsPointInArea( X, Y, Z,
  3310. gZones[ zoneid ][ G_ZONE_MINX ],
  3311. gZones[ zoneid ][ G_ZONE_MAXX ],
  3312. gZones[ zoneid ][ G_ZONE_MINY ],
  3313. gZones[ zoneid ][ G_ZONE_MAXY ]
  3314. ) ) return 1;
  3315. else return 0;
  3316. }
  3317.  
  3318. stock IsPlayerInCheckpointArea( playerid, checkpointid )
  3319. {
  3320. if ( GetPlayerInterior( playerid ) == gCheckpoints[ checkpointid ][ CP_INT_ID ] &&
  3321. IsPlayerInArea( playerid,
  3322. gCheckpoints[ checkpointid ][ CP_MIN_X ],
  3323. gCheckpoints[ checkpointid ][ CP_MAX_X ],
  3324. gCheckpoints[ checkpointid ][ CP_MIN_Y ],
  3325. gCheckpoints[ checkpointid ][ CP_MAX_Y ],
  3326. gCheckpoints[ checkpointid ][ CP_MIN_Z ],
  3327. gCheckpoints[ checkpointid ][ CP_MAX_Z ]
  3328. ) ) return 1;
  3329. else return 0;
  3330. }
  3331.  
  3332. stock IsPointInCheckpointArea( Interior, Float:X, Float:Y, Float:Z, checkpointid )
  3333. {
  3334. if ( Interior == gCheckpoints[ checkpointid ][ CP_INT_ID ] &&
  3335. IsPointInArea( X, Y, Z,
  3336. gCheckpoints[ checkpointid ][ CP_MIN_X ],
  3337. gCheckpoints[ checkpointid ][ CP_MAX_X ],
  3338. gCheckpoints[ checkpointid ][ CP_MIN_Y ],
  3339. gCheckpoints[ checkpointid ][ CP_MAX_Y ],
  3340. gCheckpoints[ checkpointid ][ CP_MIN_Z ],
  3341. gCheckpoints[ checkpointid ][ CP_MAX_Z ]
  3342. ) ) return 1;
  3343. else return 0;
  3344. }
  3345.  
  3346. stock CreateCheckpoint( playerid, checkpointid )
  3347. {
  3348. pData[ playerid ][ P_CHECKPOINT_AREA ] = checkpointid;
  3349.  
  3350. SetPlayerCheckpoint( playerid, gCheckpoints[ checkpointid ][ CP_POS_X ], gCheckpoints[ checkpointid ][ CP_POS_Y ], gCheckpoints[ checkpointid ][ CP_POS_Z ], gCheckpoints[ checkpointid ][ CP_SIZE ] );
  3351.  
  3352. if ( !gCheckpoints[ checkpointid ][ CP_WEAPONS ] )
  3353. {
  3354.  
  3355. SetPlayerTeam( playerid, TEAM_INTERIOR );
  3356.  
  3357. pData[ playerid ][ P_NO_WEAPON_AREA ] = 1;
  3358.  
  3359. #if MODE_PROTECTED_WEAPONS == 0
  3360.  
  3361. new
  3362. lTempWeaponData[ 2 ];
  3363.  
  3364. for ( new i = 0; i < MAX_WEAPON_SLOT; i++ )
  3365. {
  3366. GetPlayerWeaponData( playerid, i, lTempWeaponData[ 0 ], lTempWeaponData[ 1 ] );
  3367.  
  3368. if ( lTempWeaponData[ 0 ] && lTempWeaponData[ 1 ] && ( lTempWeaponData[ 1 ] < 65535 || !i || i == 1 || i == 10 || i == 12 ) )
  3369. {
  3370. pData[ playerid ][ P_TEMP_WEAPONS ][ i ] = lTempWeaponData[ 0 ];
  3371. pData[ playerid ][ P_TEMP_AMMO ][ i ] = lTempWeaponData[ 1 ];
  3372. }
  3373.  
  3374. lTempWeaponData[ 0 ] = 0;
  3375. lTempWeaponData[ 1 ] = 0;
  3376.  
  3377. SetPlayerAmmo( playerid, i, 0 );
  3378. }
  3379.  
  3380. ResetPlayerWeapons( playerid );
  3381.  
  3382. #endif
  3383. }
  3384. else
  3385. SetPlayerTeam( playerid, playerid );
  3386. }
  3387.  
  3388. stock SetPlayerRandomSpawn( playerid )
  3389. {
  3390. #define OFFSET_STRIPPER 0
  3391. #define OFFSET_POLICE 1
  3392. #define OFFSET_MEDIC 14
  3393. #define OFFSET_FIREMAN 22
  3394. #define OFFSET_CIVILIAN 25
  3395.  
  3396. enum e_RANDOM_SPAWNS
  3397. {
  3398. Float:RANDOM_SPAWN_X,
  3399. Float:RANDOM_SPAWN_Y,
  3400. Float:RANDOM_SPAWN_Z,
  3401. Float:RANDOM_SPAWN_A,
  3402. RANDOM_SPAWN_INTERIOR
  3403. };
  3404.  
  3405. static const
  3406. pSpawns[ ][ e_RANDOM_SPAWNS ] = {
  3407. {1208.2711,-33.2142,1000.9531,315.0714,3}, // Spawn - Stripper (LV)
  3408. {2295.0415,2451.5464,10.8203,89.0655,0}, // Spawn - Police (LV)
  3409. {2294.6040,2468.9285,10.8203,90.8953,0},
  3410. {2286.0598,2427.5940,10.8203,149.8661,0},
  3411. {231.0483,161.4586,1003.0234,233.0988,3},
  3412. {246.9417,164.7775,1003.0234,149.1481,3},
  3413. {213.2755,163.4328,1003.0234,206.1519,3},
  3414. {197.8837,168.1885,1003.0234,268.8191,3},
  3415. {269.6069,176.8701,1005.3715,67.9705,3},
  3416. {297.5797,186.0465,1007.1719,178.5549,3},
  3417. {262.4999,190.0030,1008.1719,297.0194,3},
  3418. {2341.1389,2455.0972,14.9688,92.3127,0},
  3419. {2281.7095,2426.2266,3.4692,357.8210,0},
  3420. {2268.0894,2447.0925,3.5313,193.4319,0},
  3421. {1606.8721,1819.4994,10.8280,0.3462,0}, // Spawn - Medic (LV)
  3422. {1584.9095,1799.6050,10.8280,6.6925,0},
  3423. {1581.0449,1769.0640,10.8203,87.1078,0},
  3424. {1581.6655,1761.6107,10.8280,134.8145,0},
  3425. {1581.8123,1777.5729,10.8280,45.2565,0},
  3426. {1631.4338,1794.3911,10.8203,326.6888,0},
  3427. {1604.5007,1720.9878,10.8203,177.9336,0},
  3428. {1593.2970,1722.1927,10.8203,176.1098,0},
  3429. {1734.5189,2107.8079,12.2891,51.2150,0}, // Spawn - Fireman (LV)
  3430. {1748.1394,2065.3582,10.8203,269.1852,0},
  3431. {1774.9980,2075.9319,10.8203,137.3502,0},
  3432. {2577.8779,1972.4156,10.8203,317.8635,0}, // Spawn - Civilian (LV)
  3433. {2615.7769,2017.8888,14.1161,182.3087,0},
  3434. {2367.7322,2122.5745,10.8209,41.5126,0},
  3435. {2216.5132,2460.9226,10.8203,247.9833,0},
  3436. {2214.7400,2523.0300,10.8203,179.2060,0},
  3437. {2244.5078,2521.6494,10.8203,180.6782,0},
  3438. {2274.0713,2554.3535,10.8252,275.0790,0},
  3439. {2386.1064,2465.6763,10.8203,88.1180,0},
  3440. {2254.0007,2397.7883,10.8203,0.3858,0},
  3441. {2375.5303,2309.9895,8.1406,359.5600,0},
  3442. {2445.2883,2376.2554,12.1635,90.5498,0},
  3443. {2518.4126,2447.8909,11.0313,268.1938,0},
  3444. {2520.1628,2297.4150,10.8203,273.2206,0},
  3445. {2534.1780,2259.4719,10.8203,91.3519,0},
  3446. {2490.0181,2397.4844,10.8203,272.8332,0},
  3447. {2501.8943,2125.4211,10.8203,331.3618,0},
  3448. {2440.7119,2158.0991,10.8203,181.0481,0},
  3449. {2334.2920,2163.1619,10.8487,233.1796,0},
  3450. {2420.9590,2059.7786,10.8125,178.0299,0},
  3451. {2636.2859,2347.0620,10.6719,189.9837,0},
  3452. {2860.4919,2425.5583,11.0690,180.3352,0},
  3453. {2785.2432,2444.8469,11.0625,138.1644,0},
  3454. {2822.6577,2135.0352,14.6615,174.2129,0},
  3455. {2855.4690,1292.8123,11.3906,230.3576,0},
  3456. {2806.3787,1254.6965,11.3125,0.9955,0},
  3457. {2630.8098,1717.1105,11.0234,84.9371,0},
  3458. {2630.5859,1824.1240,11.0234,90.6243,0},
  3459. {2597.6101,1895.4417,11.0312,179.5940,0},
  3460. {2412.1411,1996.7469,10.8203,274.8322,0},
  3461. {2166.3579,2010.9558,10.8203,53.6476,0},
  3462. {2260.8037,2036.1832,10.8203,92.1344,0},
  3463. {2365.2429,1981.6089,10.8125,130.0798,0},
  3464. {2021.1766,1913.4680,12.3135,281.7769,0},
  3465. {2312.5847,2160.6587,10.8203,129.3867,0},
  3466. {2602.4929,2210.4753,14.1161,358.6106,0},
  3467. {2574.3264,2382.7058,17.8145,164.0770,0},
  3468. {2586.8696,2313.0674,17.8222,265.9113,0},
  3469. {2445.8601,2376.0947,12.1635,100.1473,0},
  3470. {2464.7188,2546.0286,22.0781,11.0318,0},
  3471. {2494.6345,2764.3513,10.8203,70.6827,0},
  3472. {2167.9028,2808.3481,15.8516,109.0852,0},
  3473. {1998.9938,2725.4814,10.8203,5.0576,0},
  3474. {1967.4832,2764.8647,10.8203,180.9842,0},
  3475. {1807.0913,2774.5479,14.2735,163.5764,0},
  3476. {1724.9543,2799.0471,14.2735,103.6899,0},
  3477. {1626.7462,2751.4436,10.8203,178.4174,0},
  3478. {1570.0924,2713.8940,10.8203,0.2305,0},
  3479. {1602.1322,2844.2751,10.8203,175.6702,0},
  3480. {1457.6132,2773.6250,10.8203,271.4428,0},
  3481. {1457.3605,2641.5591,11.3926,122.1264,0},
  3482. {1430.6111,2617.6753,11.3926,176.9603,0},
  3483. {1881.1653,2647.5256,10.8203,171.1578,0},
  3484. {1618.9598,2608.4185,10.8203,185.4744,0},
  3485. {1564.3478,2566.7036,10.8203,359.6001,0},
  3486. {1515.7629,2609.5220,11.0549,177.2384,0},
  3487. {1349.5146,2569.6555,10.8203,3.5719,0},
  3488. {1320.0276,1253.6912,14.2731,5.4793,0},
  3489. {1492.1433,700.1144,10.8203,350.1037,0},
  3490. {1019.3434,1181.7448,10.8203,332.1364,0},
  3491. {1163.7324,1367.5988,10.8125,22.0233,0},
  3492. {1076.2146,1806.5125,10.8203,45.2157,0},
  3493. {946.8815,1733.8002,8.8516,269.5771,0},
  3494. {922.6499,1923.8794,11.2408,114.3823,0},
  3495. {922.5867,2021.8718,11.2301,106.9798,0},
  3496. {987.4793,2274.9309,11.4609,307.5706,0},
  3497. {1136.7711,2284.9666,10.8203,48.7268,0},
  3498. {987.2609,2345.8391,11.4688,308.8089,0},
  3499. {1022.8469,2366.5178,10.8203,90.8182,0},
  3500. {1136.8528,2072.9814,11.0625,139.8002,0},
  3501. {367.5206,-67.0627,1001.5078,168.3720,10},
  3502. {371.0161,-58.0332,1001.5212,163.9853,10},
  3503. {1413.1840,2080.5415,10.9746,105.2389,0},
  3504. {1418.5743,2031.2112,14.7396,185.3032,0},
  3505. {1481.4432,2198.7378,11.0234,304.3298,0},
  3506. {1601.8604,2218.4690,11.0625,224.6605,0},
  3507. {1529.1097,2357.6594,10.8203,277.1359,0},
  3508. {1445.5994,2360.0820,10.8203,261.4203,0},
  3509. {1366.8798,2525.6194,10.8203,252.2024,0},
  3510. {1313.8385,2607.1514,10.8203,189.9668,0},
  3511. {2325.8823,-1013.2347,1050.2109,89.5907,9},
  3512. {2321.2080,-1004.9431,1054.7188,0.7716,9},
  3513. {2329.4036,-1012.3550,1054.7188,58.1847,9},
  3514. {2326.8652,-1019.3565,1050.2109,126.6112,9},
  3515. {1431.2281,2660.7188,11.3926,324.2330,0},
  3516. {1608.0023,2748.8513,10.8203,174.1419,0},
  3517. {2014.1615,2316.2676,10.8203,188.2945,0},
  3518. {1937.1332,2180.7773,10.8125,45.9298,0},
  3519. {1917.4487,2131.6924,10.8203,339.4210,0},
  3520. {2162.8660,2014.3800,10.8125,52.3273,0},
  3521. {2304.3101,1516.8859,10.8203,261.1006,0},
  3522. {2138.3115,1489.1532,10.8203,6.9977,0},
  3523. {2083.8821,1654.0415,10.8125,141.4223,0},
  3524. {2241.6531,1633.5273,1008.3594,130.6612,1},
  3525. {2271.4438,1612.3309,1006.1797,4.8450,1},
  3526. {2255.3396,1593.0006,1006.1797,280.8943,1},
  3527. {2234.5908,1593.5117,1006.1839,190.0502,1},
  3528. {2208.0190,1609.3539,1006.1865,118.2961,1},
  3529. {2174.8818,1609.6324,1006.1474,240.9556,1},
  3530. {2153.1348,1625.5502,1008.3594,215.0936,1},
  3531. {2179.8560,1630.5339,1008.3594,246.1140,1},
  3532. {2224.5852,1667.7716,1008.3594,315.6746,1},
  3533. {2022.7483,1514.0011,10.8203,328.8952,0},
  3534. {2022.1515,1342.4635,10.8130,269.2837,0},
  3535. {1936.3739,1345.1782,9.8533,270.7993,0},
  3536. {2096.2881,1276.3656,10.8203,177.9783,0},
  3537. {2235.2576,1290.9464,10.8203,124.2882,0},
  3538. {2146.0208,1134.6913,13.5043,62.7541,0},
  3539. {2030.2075,999.7216,10.8131,323.0244,0},
  3540. {2003.6809,1013.4965,994.4688,50.5196,10},
  3541. {1951.7550,997.6650,992.8594,39.2395,10},
  3542. {1941.7075,995.3929,992.4609,315.2654,10},
  3543. {1927.5110,1031.1006,994.4688,230.3513,10},
  3544. {1941.6832,1049.3741,992.4745,249.4648,10},
  3545. {1981.6357,1026.2520,994.4688,221.8912,10},
  3546. {2419.1633,1131.2460,10.8203,240.9675,0},
  3547. {2419.1633,1131.2460,10.8203,240.9675,0},
  3548. {371.1117,169.4952,1008.3828,43.6262,3},
  3549. {2508.6870,1292.2231,10.8125,109.9921,0},
  3550. {2511.8875,1246.0981,10.8203,42.4873,0},
  3551. {2087.4797,1449.8265,10.8203,110.5767,0},
  3552. {1686.9507,1449.5842,10.7688,276.4518,0},
  3553. {1628.5875,1017.4887,10.8203,268.9178,0},
  3554. {1666.2279,1034.0123,10.9043,177.4236,0},
  3555. {1704.4568,1024.7406,10.8203,92.8227,0},
  3556. {1713.1708,915.2463,10.8203,2.5357,0},
  3557. {1561.1823,1006.5410,10.8125,272.9501,0},
  3558. {1848.7124,739.3742,11.4609,220.8529,0},
  3559. {1848.6520,693.4667,11.4531,296.3435,0},
  3560. {2011.8123,653.5253,11.4609,41.7111,0},
  3561. {2088.1978,691.9083,11.4609,147.2122,0},
  3562. {2226.3628,732.1501,11.4609,140.4870,0},
  3563. {2315.1467,693.3939,11.4609,31.6523,0},
  3564. {2617.5413,717.0925,14.7396,2.5372,0} //
  3565. };
  3566.  
  3567. new
  3568. r,
  3569. isStripper;
  3570.  
  3571. if ( ( sHour >= 20 || sHour <= 4 ) && IsPlayerStripper( playerid ) )
  3572. {
  3573. isStripper = 1;
  3574. r = OFFSET_STRIPPER;
  3575.  
  3576. if ( !pData[ playerid ][ P_TEMP_WEAPONS ][ 1 ] )
  3577. GivePlayerWeapon( playerid, 10, 1 );
  3578. }
  3579.  
  3580. else
  3581. {
  3582. switch ( GetPlayerSkin( playerid ) )
  3583. {
  3584. case 265 .. 267, 280 .. 286, 288:
  3585. {
  3586. // Police
  3587.  
  3588. if ( !pData[ playerid ][ P_TEMP_WEAPONS ][ 1 ] )
  3589. GivePlayerWeapon( playerid, 3, 1 );
  3590.  
  3591. r = minrand( OFFSET_POLICE, OFFSET_MEDIC );
  3592. }
  3593. case 274 .. 276:
  3594. {
  3595. // Medic
  3596.  
  3597. // if ( !pData[ playerid ][ P_TEMP_WEAPONS ][ 1 ] )
  3598. // GivePlayerWeapon( playerid, 4, 1 );
  3599.  
  3600. if ( pData[ playerid ][ P_ARMOR ] < 1.0 )
  3601. SetPlayerArmour( playerid, 50.0 );
  3602.  
  3603. r = minrand( OFFSET_MEDIC, OFFSET_FIREMAN );
  3604. }
  3605. case 277 .. 279:
  3606. {
  3607. // Fireman
  3608.  
  3609. if ( !pData[ playerid ][ P_TEMP_WEAPONS ][ 9 ] )
  3610. GivePlayerWeapon( playerid, 42, 0xFF );
  3611.  
  3612. r = minrand( OFFSET_FIREMAN, OFFSET_CIVILIAN );
  3613. }
  3614. default:
  3615. {
  3616. // Civilian
  3617.  
  3618. if ( !pData[ playerid ][ P_TEMP_WEAPONS ][ 1 ] )
  3619. GivePlayerWeapon( playerid, 5, 1 );
  3620.  
  3621. r = minrand( OFFSET_CIVILIAN, sizeof( pSpawns ) );
  3622. }
  3623. }
  3624. }
  3625.  
  3626. SetPlayerFacingAngle( playerid, pSpawns[ r ][ RANDOM_SPAWN_A ] );
  3627. SetPlayerInterior ( playerid, pSpawns[ r ][ RANDOM_SPAWN_INTERIOR ] );
  3628. SetPlayerPos ( playerid, pSpawns[ r ][ RANDOM_SPAWN_X ], pSpawns[ r ][ RANDOM_SPAWN_Y ], pSpawns[ r ][ RANDOM_SPAWN_Z ] );
  3629.  
  3630. if ( isStripper )
  3631. SetPlayerSpecialAction( playerid, SPECIAL_ACTION_DANCE4 );
  3632.  
  3633. return 1;
  3634. }
  3635.  
  3636. #if RANDOM_PICKUPS == true
  3637.  
  3638. stock GenerateRandomPickup( pickupid )
  3639. {
  3640. static const
  3641. Float:pPickups[ ][ 3 ] = {
  3642. {2437.8604,1988.5696,10.8203},
  3643. {2571.1519,1974.9261,11.1641},
  3644. {2558.6392,1788.0098,11.0234},
  3645. {2546.5266,1852.1418,28.8935},
  3646. {2862.1843,2429.7729,11.0690},
  3647. {2816.0967,2203.6150,11.0234},
  3648. {2598.9106,2084.5854,10.8130},
  3649. {2586.4353,2179.0161,12.6400},
  3650. {2644.7522,2259.0076,10.7886},
  3651. {2563.3479,2303.3535,17.8222},
  3652. {2545.9104,2349.5059,10.8133},
  3653. {2366.9063,2358.4951,10.8203},
  3654. {2262.2429,2564.9360,10.8203},
  3655. {2501.6235,2773.1101,10.8203},
  3656. {2383.8672,2758.0190,13.1060},
  3657. {2175.9509,2710.7012,10.8203},
  3658. {1949.1349,2762.2837,10.8265},
  3659. {1766.4034,2736.1172,10.8359},
  3660. {1486.9122,2772.7661,10.8203},
  3661. {1439.8540,2615.4277,11.3926},
  3662. {1362.6022,2571.8665,15.1141},
  3663. {1849.6176,2582.9077,10.8203},
  3664. {2033.2667,2257.8237,10.8203},
  3665. {1912.1382,2288.3198,10.8203},
  3666. {1972.9200,2363.7847,23.8516},
  3667. {1890.2573,2446.1943,11.1782},
  3668. {1522.7343,2376.6497,10.8203},
  3669. {1444.7299,2360.7417,10.8203},
  3670. {1405.4734,2169.4221,16.8045},
  3671. {1617.3038,1159.1689,14.2188},
  3672. {1379.1497,989.1495,13.1138},
  3673. {1349.2360,1085.9698,10.8203},
  3674. {1084.2582,1073.6989,10.8359},
  3675. {1117.8186,1408.9008,6.6328},
  3676. {1109.5709,1696.5413,10.8203},
  3677. {989.8010,1880.1495,11.3232},
  3678. {1024.0314,2031.0432,11.2474},
  3679. {982.4949,2160.6301,10.8203},
  3680. {774.1158,1880.3998,8.0957},
  3681. {968.2064,1702.5868,8.8581},
  3682. {1301.4205,1568.8733,10.8203},
  3683. {1622.4720,1815.7813,10.8203},
  3684. {1499.5039,2029.3578,14.7396},
  3685. {1785.4751,2070.1699,10.8706},
  3686. {1764.0997,1686.9297,9.2811},
  3687. {1676.7413,1166.1119,10.8203},
  3688. {1725.5493,968.4559,10.8203},
  3689. {1625.1100,685.9510,10.8203},
  3690. {1680.3375,745.4524,10.8203},
  3691. {1483.9822,689.4680,10.8841},
  3692. {1481.1765,750.9378,29.0853},
  3693. {2136.3694,1088.2932,10.8274},
  3694. {2165.7761,1262.9464,10.8203},
  3695. {2806.9346,892.1949,11.3764},
  3696. {2213.5178,940.8750,10.8203},
  3697. {2604.1526,815.4988,10.8281},
  3698. {2575.2195,715.9464,14.7396},
  3699. {2540.7114,1123.5858,14.2705},
  3700. {2498.4138,1131.9657,14.2705},
  3701. {2510.2927,1549.4790,10.8203},
  3702. {1969.5043,1639.1663,12.2422},
  3703. {2001.6171,1534.1042,27.5888},
  3704. {1935.2338,1557.2640,10.8203},
  3705. {1974.7568,1561.0592,10.3397},
  3706. {2044.1951,1821.0612,11.5655},
  3707. {2103.9448,1979.1014,10.8203},
  3708. {2082.5208,2176.6394,10.8203},
  3709. {2160.4792,2113.1504,18.0782},
  3710. {2178.6035,1968.4901,10.8203},
  3711. {2304.1729,1785.1412,16.4524},
  3712. {2435.2104,1663.0289,15.6398},
  3713. {2260.9387,1398.2898,42.8203},
  3714. {2323.9622,1261.1873,67.4688},
  3715. {1921.8706,963.9921,10.8203},
  3716. {1951.5463,669.3956,10.8203},
  3717. {2099.0942,1683.2894,13.0060},
  3718. {2153.9978,1751.7538,11.0469},
  3719. {1914.0679,2185.9292,11.1250},
  3720. {1908.6382,2106.1858,10.8203},
  3721. {1485.9313,2180.0435,11.0234}//
  3722. };
  3723.  
  3724. static const
  3725. rPickupMDL[ ] = {
  3726. 321, 322, 323, 324, 336,
  3727. 342, 343, 344, 346, 347,
  3728. 348, 349, 350, 351, 352,
  3729. 353, 355, 356, 357, 358,
  3730. 366, 372, 1240, 1242
  3731. };
  3732.  
  3733. new r = random( sizeof( pPickups ) );
  3734.  
  3735. randPickups[ pickupid ] = CreatePickup( rPickupMDL[ random( sizeof( rPickupMDL ) ) ], DEFAULT_PICKUP_TYPE, pPickups[ r ][ 0 ], pPickups[ r ][ 1 ], pPickups[ r ][ 2 ] );
  3736. }
  3737. #endif
  3738.  
  3739. //******************************************************************************
  3740. // Commands
  3741. //******************************************************************************
  3742.  
  3743. #if VERSION_LITE == false
  3744.  
  3745. dcmd_territory( playerid, params[ ] )
  3746. {
  3747. new
  3748. zoneid = pData[ playerid ][ P_GANG_ZONE ];
  3749.  
  3750. if ( zoneid == INVALID_GANG_ZONE )
  3751. return SendError( playerid, "You must be in a gang zone to use this command." );
  3752.  
  3753. new
  3754. szInfoMsg[ 128 ];
  3755.  
  3756. if ( params[ 0 ] == '\0' || !strcmp( params, "about", true, 5 ) )
  3757. {
  3758. new
  3759. iZoneOwner = gZones[ zoneid ][ G_ZONE_OWNER ];
  3760.  
  3761. if ( iZoneOwner == INVALID_GANG_ID )
  3762. szInfoMsg = "None";
  3763.  
  3764. else
  3765. strcpy( szInfoMsg, gData[ iZoneOwner ][ G_NAME ] );
  3766.  
  3767. SendClientMessage( playerid, COLOR_GREEN, "Territory Information:" );
  3768.  
  3769. format (
  3770. szInfoMsg, sizeof( szInfoMsg ), "* Owner -> %s (%d) .. Zone ID -> %d",
  3771. szInfoMsg,
  3772. iZoneOwner,
  3773. zoneid
  3774. );
  3775.  
  3776. SendClientMessage( playerid, COLOR_YELLOW, szInfoMsg );
  3777.  
  3778. return 1;
  3779. }
  3780.  
  3781. else if ( IsPlayerAdmin( playerid ) )
  3782. {
  3783. if ( !strcmp( params, "setowner", true, 8 ) )
  3784. {
  3785. if ( params[ 9 ] == '\0' || !IsNumeric( params[ 9 ] ) )
  3786. return SendError( playerid, "/territory setowner [gang]" );
  3787.  
  3788. new
  3789. newOwner = strval( params[ 9 ] );
  3790.  
  3791. // If timerid for EndGangWar in this zoneid
  3792. // is valid then kill the timer and set it to 0 (invalid).
  3793. if ( gZones[ zoneid ][ G_ZONE_TIMER ] )
  3794. {
  3795. KillTimer( gZones[ zoneid ][ G_ZONE_TIMER ] );
  3796.  
  3797. gZones[ zoneid ][ G_ZONE_TIMER ] = 0;
  3798. }
  3799.  
  3800. // If there is no-one in the winning gang then reset gangzone to defaults.
  3801. if ( !IsValidGang( newOwner ) )
  3802. {
  3803. loopPlayers( pID )
  3804. {
  3805. if ( pData[ pID ][ P_GANG_ZONE ] == zoneid )
  3806. {
  3807. TextDrawHideForPlayer( pID, gZones[ zoneid ][ G_ZONE_TEXT ] );
  3808. TextDrawShowForPlayer( pID, TEXT_NoZoneOwner );
  3809. }
  3810. }
  3811.  
  3812. gZones[ zoneid ][ G_ZONE_OWNER ] = INVALID_GANG_ID;
  3813. gZones[ zoneid ][ G_ZONE_COLOR ] = COLOR_ZONE_DEFAULT;
  3814. gZones[ zoneid ][ G_ZONE_TEXT ] = TEXT_NoZoneOwner;
  3815. }
  3816.  
  3817. else if ( gZones[ zoneid ][ G_ZONE_OWNER ] != newOwner )
  3818. {
  3819. // Set the zone status to the new winners.
  3820.  
  3821. loopPlayers( pID )
  3822. {
  3823. if ( pData[ pID ][ P_GANG_ZONE ] == zoneid )
  3824. {
  3825. TextDrawHideForPlayer( pID, gZones[ zoneid ][ G_ZONE_TEXT ] );
  3826. TextDrawShowForPlayer( pID, gData[ newOwner ][ G_ZONE_TEXT ] );
  3827. }
  3828. }
  3829.  
  3830. gZones[ zoneid ][ G_ZONE_OWNER ] = newOwner;
  3831. gZones[ zoneid ][ G_ZONE_COLOR ] = ( gData[ newOwner ][ G_COLOR ] & 0xFFFFFF00 ) | 0x80;
  3832. gZones[ zoneid ][ G_ZONE_TEXT ] = gData[ newOwner ][ G_ZONE_TEXT ];
  3833. }
  3834.  
  3835. // Loop through all players and check if they're in the gang zone, if they
  3836. // are then hide the current zone text.
  3837.  
  3838. // Stop the flashing of zones now that the war has ended.
  3839. if ( gZones[ zoneid ][ G_ZONE_WAR ] )
  3840. GangZoneStopFlashForAll( zoneid );
  3841.  
  3842. // Show the new gang zone colour for all..
  3843. GangZoneHideForAll( zoneid );
  3844. GangZoneShowForAll( zoneid, gZones[ zoneid ][ G_ZONE_COLOR ] );
  3845.  
  3846. // Officially set the war to off.
  3847. gZones[ zoneid ][ G_ZONE_WAR ] = 0;
  3848.  
  3849. if ( newOwner == INVALID_GANG_ID )
  3850. szInfoMsg = "Unoccupied";
  3851.  
  3852. else
  3853. strcpy( szInfoMsg, gData[ newOwner ][ G_NAME ] );
  3854.  
  3855. format (
  3856. szInfoMsg, sizeof( szInfoMsg ), "* Territory owner set to %s (%d).",
  3857. szInfoMsg,
  3858. newOwner
  3859. );
  3860.  
  3861. SendClientMessage( playerid, COLOR_GREEN, szInfoMsg );
  3862.  
  3863. return 1;
  3864. }
  3865.  
  3866. return SendUsage( playerid, "/territory [about/setowner] [gangid]" );
  3867. }
  3868.  
  3869. return SendUsage( playerid, "/territory [about]" );
  3870. }
  3871. #endif
  3872.  
  3873. #if ADMIN_SPAWN_COMMAND == true
  3874. dcmd_as( playerid, params[ ] )
  3875. {
  3876. new
  3877. spawn = 1,
  3878. iVehicleID = GetPlayerVehicleID( playerid );
  3879.  
  3880. if ( IsNumeric( params ) )
  3881. spawn = strval( params );
  3882.  
  3883. pData[ playerid ][ P_ADMIN_SPAWN ] = 1;
  3884.  
  3885. switch( spawn )
  3886. {
  3887. case 2: SetSpawnInfo( playerid, playerid, 217, 2170.1453, 1677.9929, 20.3906, 90.0000, 24, 999999, 28, 999999, 31, 999999 );
  3888. case 3: SetSpawnInfo( playerid, playerid, 141, 2170.1453, 1677.9929, 20.3906, 90.0000, 24, 999999, 28, 999999, 31, 999999 );
  3889. case 4: SetSpawnInfo( playerid, playerid, GetPlayerSkin( playerid ), 2170.1453, 1677.9929, 20.3906, 90.0000, 24, 999999, 28, 999999, 31, 999999 );
  3890. case 5: SetSpawnInfo( playerid, playerid, GetPlayerSkin( playerid ), 2170.1453, 1677.9929, 20.3906, 90.0000, 24, 999999, 28, 999999, 31, 999999 );
  3891. case 6: SetSpawnInfo( playerid, playerid, 93, 2170.1453, 1677.9929, 20.3906, 90.0000, 24, 999999, 28, 999999, 31, 999999 );
  3892. default: SetSpawnInfo( playerid, playerid, 217, 2170.1453, 1677.9929, 20.3906, 90.0000, 24, 999999, 28, 999999, 31, 999999 );
  3893. }
  3894.  
  3895. if ( spawn != 5 )
  3896. SetPlayerColor( playerid, 0xFFFFFFFF );
  3897.  
  3898. if ( iVehicleID )
  3899. {
  3900. RemovePlayerFromVehicle( playerid );
  3901. SetVehicleToRespawn( iVehicleID );
  3902. }
  3903.  
  3904. SpawnPlayer( playerid );
  3905.  
  3906. return 1;
  3907. }
  3908.  
  3909. #endif
  3910.  
  3911. dcmd_mods( playerid, params[] )
  3912. {
  3913. #pragma unused params
  3914.  
  3915. new
  3916. szString[ 128 ] = "* ",
  3917. szName [ MAX_PLAYER_NAME ],
  3918. iCnt, iModCnt;
  3919.  
  3920. SendClientMessage( playerid, COLOR_RED, "Moderators:" );
  3921.  
  3922. loopPlayers( i )
  3923. {
  3924. if ( pData[ i ][ P_LEVEL ] == _:P_LEVEL_MOD )
  3925. {
  3926. iCnt ++;
  3927. iModCnt ++;
  3928.  
  3929. GetPlayerName( i, szName, MAX_PLAYER_NAME );
  3930. format( szString, sizeof( szString ), "%s%s (%d), ", szString, szName, i );
  3931.  
  3932. if ( iCnt >= 4 )
  3933. {
  3934. SendClientMessage( playerid, COLOR_ORANGE, szString );
  3935.  
  3936. szString= "* ";
  3937. iCnt = 0;
  3938. }
  3939. }
  3940. }
  3941.  
  3942. if ( iCnt )
  3943. SendClientMessage( playerid, COLOR_ORANGE, szString );
  3944.  
  3945. if ( iModCnt != 1 )
  3946. format( szString, sizeof( szString ), "There are %d moderators online.", iModCnt );
  3947. else
  3948. szString = "There is 1 moderator online.";
  3949.  
  3950. SendClientMessage( playerid, COLOR_WHITE, szString );
  3951.  
  3952. return 1;
  3953. }
  3954.  
  3955. dcmd_admins( playerid, params[] )
  3956. {
  3957. #pragma unused params
  3958.  
  3959. new
  3960. szString[ 128 ] = "* ",
  3961. szName [ MAX_PLAYER_NAME ],
  3962. iCnt, iAdminCnt;
  3963.  
  3964. SendClientMessage( playerid, COLOR_RED, "Administrators:" );
  3965.  
  3966. loopPlayers( i )
  3967. {
  3968. if ( pData[ i ][ P_LEVEL ] >= _:P_LEVEL_ADMIN || IsPlayerAdmin( i ) )
  3969. {
  3970. iCnt ++;
  3971. iAdminCnt ++;
  3972.  
  3973. GetPlayerName( i, szName, MAX_PLAYER_NAME );
  3974. format( szString, sizeof( szString ), "%s%s (%d), ", szString, szName, i );
  3975.  
  3976. if ( iCnt >= 4 )
  3977. {
  3978. SendClientMessage( playerid, COLOR_ORANGE, szString );
  3979.  
  3980. szString= "* ";
  3981. iCnt = 0;
  3982. }
  3983. }
  3984. }
  3985.  
  3986. if ( iCnt )
  3987. SendClientMessage( playerid, COLOR_ORANGE, szString );
  3988.  
  3989. if ( iAdminCnt != 1 )
  3990. format( szString, sizeof( szString ), "There are %d administrators online.", iAdminCnt );
  3991. else
  3992. szString = "There is 1 administrator online.";
  3993.  
  3994. SendClientMessage( playerid, COLOR_WHITE, szString );
  3995.  
  3996. return 1;
  3997. }
  3998.  
  3999. stock dcmd_do( playerid, params[ ] )
  4000. {
  4001. if ( params[ 0 ] == '\0' )
  4002. return SendUsage( playerid, "/do [gbank/bank/bounty] [set/add/take] [amount]" );
  4003.  
  4004. if ( pData[ playerid ][ P_LEVEL ] < _:P_LEVEL_ADMIN )
  4005. return SendError( playerid, "You must be an admin to use this command!" );
  4006.  
  4007. new
  4008. iResetID = INVALID_PLAYER_ID;
  4009. iQuickIdx;
  4010.  
  4011. if ( !strcmp( params, "bank", true, 4 ) )
  4012. {
  4013. iQuickIdx = 5;
  4014.  
  4015. if ( !strcmp( params[ iQuickIdx ], "set", true, 3 ) )
  4016. {
  4017. iQuickIdx += 5;
  4018. }
  4019.  
  4020. else if ( !strcmp( params[ iQuickIdx ], "add", true, 3 ) )
  4021. {
  4022. iQuickIdx += 5;
  4023.  
  4024. if ( !strlen( params[ iQuickIdx ] ) || !IsNumeric( params[ iQuickIdx ] ) ){ SendUsage}
  4025. }
  4026.  
  4027. else if ( !strcmp( params[ iQuickIdx ], "take", true, 4 ) )
  4028. {
  4029. iQuickIdx += 6;
  4030. }
  4031. }
  4032.  
  4033. else if ( !strcmp( params, "gbank", true, 5 ) )
  4034. {
  4035. iQuickIdx = 6;
  4036.  
  4037. if ( !strcmp( params[ iQuickIdx ], "set", true, 3 ) )
  4038. {
  4039. }
  4040.  
  4041. else if ( !strcmp( params[ iQuickIdx ], "add", true, 3 ) )
  4042. {
  4043. }
  4044.  
  4045. else if ( !strcmp( params[ iQuickIdx ], "take", true, 4 ) )
  4046. {
  4047. }
  4048. }
  4049.  
  4050. else if ( !strcmp( params, "bounty", true, 6 ) )
  4051. {
  4052. iQuickIdx = 7;
  4053. }
  4054.  
  4055. else
  4056. return SendUsage( playerid, "/do [gbank/bank/bounty] [set/add/take] [amount]" );
  4057. }
  4058.  
  4059. dcmd_drop( playerid, params[ ] )
  4060. {
  4061. new
  4062. dropid;
  4063.  
  4064. if ( !( pData[ playerid ][ P_LEVEL ] >= _:P_LEVEL_SERVER || IsPlayerAdmin( playerid ) ) )
  4065. return SendError( playerid, "You must be at SERVER level or an RCON admin to use this command." );
  4066.  
  4067. if ( !pData[ playerid ][ P_DROP_WARNED ] )
  4068. {
  4069. pData[ playerid ][ P_DROP_WARNED ] = 1;
  4070.  
  4071. SendClientMessage( playerid, COLOR_RED, "WARNING: Dropping an account is irreversible. Type /drop [playerid] again to confirm." );
  4072.  
  4073. return 1;
  4074. }
  4075.  
  4076. if ( params[0] == '\0' || !IsNumeric( params ) )
  4077. return SendUsage( playerid, "/drop [playerid]" );
  4078.  
  4079. dropid = strval( params );
  4080.  
  4081. if ( !IsPlayerConnected( dropid ) || !pData[ dropid ][ P_REGISTERED ] || !pData[ dropid ][ P_LOGGED_IN ] )
  4082. return SendError( playerid, "The account you wish the drop must be registered and logged in to use this command." );
  4083.  
  4084. if ( pData[ dropid ][ P_ACCOUNT_BAN ] )
  4085. return SendError( playerid, "You can't drop a banned account." );
  4086.  
  4087. new
  4088. DB:Database = db_open( SZ_SQLITE_DB ),
  4089. pName[ MAX_PLAYER_NAME ],
  4090. tString[ 128 ];
  4091.  
  4092. printf( "> %d tried to drop %d's account.", playerid, dropid );
  4093.  
  4094. if ( Database )
  4095. {
  4096. GetPlayerName( dropid, pName, MAX_PLAYER_NAME );
  4097.  
  4098. if ( DeleteAccount( Database, pName ) )
  4099. {
  4100. pData[ dropid ][ P_REGISTERED ] = 0;
  4101. pData[ playerid ][ P_DROP_WARNED ] = 0;
  4102.  
  4103. GetPlayerName( playerid, tString, MAX_PLAYER_NAME );
  4104. format( tString, sizeof( tString ), "(AdminMsg) %s (ID:%d) has dropped %s (ID:%d)'s account.", tString, playerid, pName, dropid );
  4105. SendClientMessageToAdmins( COLOR_ORANGE, tString );
  4106. }
  4107. else
  4108. SendError( playerid, "Account deletion failed." );
  4109.  
  4110. db_close( Database );
  4111.  
  4112. return 1;
  4113. }
  4114. else return !print( "[ERROR] NO DATABASE!" );
  4115. }
  4116.  
  4117. dcmd_password( playerid, params[ ] )
  4118. {
  4119. if ( params[ 0 ] == '\0' )
  4120. return SendUsage( playerid, "/password [old_password] [new_password]" );
  4121.  
  4122. if ( !pData[ playerid ][ P_REGISTERED ] && !pData[ playerid ][ P_LOGGED_IN ] )
  4123. return SendError( playerid, "You must be registered and logged in to use this command." );
  4124.  
  4125. new tString [ 128 ],
  4126. pName [ MAX_PLAYER_NAME ],
  4127. idx;
  4128.  
  4129. tString = strtok( params, idx );
  4130.  
  4131. if ( !strlen( params[ idx + 1 ] ) )
  4132. return SendUsage( playerid, "/password [old_password] [new_password]" );
  4133.  
  4134. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  4135.  
  4136. printf( "%s [ID:%d] typed password command.", pName, playerid );
  4137.  
  4138. new
  4139. DB:Database = db_open( SZ_SQLITE_DB );
  4140.  
  4141. if ( Database )
  4142. {
  4143. if ( SetUserPassword( Database, pName, tString, params[ idx + 1 ] ) )
  4144. {
  4145. format( tString, sizeof( tString ), "You have successfully changed your password from %s to %s.", tString, params[ idx + 1 ] );
  4146. SendClientMessage( playerid, COLOR_GREEN, tString );
  4147. }
  4148. else
  4149. {
  4150. format( tString, sizeof( tString ), "ERROR: There was an error changing your password to %s.", params[ idx + 1 ] );
  4151. SendClientMessage( playerid, COLOR_RED, tString );
  4152. SendClientMessage( playerid, COLOR_RED, "Please make sure your old password is correct." );
  4153. }
  4154.  
  4155. db_close( Database );
  4156.  
  4157. return 1;
  4158. }
  4159. else
  4160. return !print( "ERROR: NO DATABASE!" );
  4161.  
  4162. }
  4163.  
  4164. dcmd_email( playerid, params[ ] )
  4165. {
  4166. if ( params[ 0 ] == '\0' )
  4167. return SendUsage( playerid, "/email [new_email]" );
  4168.  
  4169. if ( !pData[ playerid ][ P_REGISTERED ] && !pData[ playerid ][ P_LOGGED_IN ] )
  4170. return SendError( playerid, "You must be registered and logged in to use this command." );
  4171. new
  4172. idx;
  4173.  
  4174.  
  4175. while ( params[ idx ] != 0 )
  4176. {
  4177.  
  4178. if
  4179. (
  4180. isalnum( params[ idx ] ) ||
  4181. params[ idx ] == '_' || params[ idx ] == '[' || params[ idx ] == ']' ||
  4182. params[ idx ] == '-' || params[ idx ] == '+' || params[ idx ] == '.' || params[ idx ] == '@'
  4183. ) idx++;
  4184.  
  4185. else
  4186. return SendError( playerid, "Email can only have the characters: 0-9, A-Z, a-z, [, ], _, -, +, . and @." );
  4187. }
  4188.  
  4189. new
  4190. DB:Database = db_open( SZ_SQLITE_DB ),
  4191. szName [ MAX_PLAYER_NAME ],
  4192. szString[ 128 ];
  4193.  
  4194. GetPlayerName ( playerid, szName, MAX_PLAYER_NAME );
  4195. printf ( "%s [ID:%d] typed change email command (params: %s).", szName, playerid, params );
  4196.  
  4197. if ( Database )
  4198. {
  4199. if ( SetUserEmail( Database, szName, params ) )
  4200. {
  4201. format ( szString, sizeof( szString ), "You have successfully changed your email to %s.", params );
  4202. SendClientMessage ( playerid, COLOR_GREEN,szString );
  4203. }
  4204. else
  4205. {
  4206. format ( szString, sizeof( szString ), "ERROR: There was an error changing your email to %s.", params );
  4207. SendClientMessage ( playerid, COLOR_RED, szString );
  4208. }
  4209.  
  4210. db_close( Database );
  4211.  
  4212. return 1;
  4213. }
  4214. else
  4215. return print( "ERROR: NO DATABASE!" );
  4216. }
  4217.  
  4218. dcmd_nick( playerid, params[ ] )
  4219. {
  4220. if ( params[ 0 ] == '\0' )
  4221. return SendUsage( playerid, "/nick [login/register/password/drop/setname/setlevel]" );
  4222.  
  4223. if ( !strcmp( params, "drop", true, 4 ) )
  4224. return dcmd_drop( playerid, params[ 5 ] );
  4225.  
  4226. if ( !strcmp( params, "login", true, 5 ) )
  4227. return dcmd_login( playerid, params[ 6 ] );
  4228.  
  4229. if ( !strcmp( params, "email", true, 5 ) )
  4230. return dcmd_email( playerid, params[ 6 ] );
  4231.  
  4232. if ( !strcmp( params, "setname", true, 7 ) )
  4233. return dcmd_setname( playerid, params[ 8 ] );
  4234.  
  4235. if ( !strcmp( params, "password", true, 8 ) )
  4236. return dcmd_password( playerid, params[ 9 ] );
  4237.  
  4238. if ( !strcmp( params, "setlevel", true, 8 ) )
  4239. return dcmd_setlevel( playerid, params[ 9 ] );
  4240.  
  4241. return 0;
  4242. }
  4243.  
  4244. dcmd_me( playerid, params[ ] )
  4245. {
  4246. if( params[ 0 ] == '\0' )
  4247. return SendUsage( playerid, "/me [action]" );
  4248. else
  4249. {
  4250. new
  4251. mString[ 128 ];
  4252.  
  4253. GetPlayerName( playerid, mString, MAX_PLAYER_NAME );
  4254. format( mString, sizeof( mString ), "* %s %s", mString, params );
  4255. SendClientMessageToAll( 0xFF44DDFF, mString );
  4256.  
  4257. format( mString, sizeof( mString ), "[me] %d %s", playerid, mString );
  4258. add_log( mString );
  4259.  
  4260. return 1;
  4261. }
  4262. }
  4263.  
  4264. dcmd_setlevel( playerid, params[ ] )
  4265. {
  4266. if ( !IsPlayerAdmin( playerid ) && pData[ playerid ][ P_LEVEL ] < _:P_LEVEL_SERVER )
  4267. return SendError( playerid, "You must be at server level or higher to use this command." );
  4268.  
  4269. if ( params[ 0 ] == '\0' )
  4270. return SendUsage( playerid, "/setlevel [id] [level]" );
  4271.  
  4272. new tName[ MAX_PLAYER_NAME ],
  4273. tString[ 128 ],
  4274. idx;
  4275.  
  4276. printf( "[ID:%d] typed setlevel command.", playerid );
  4277.  
  4278. tName = strtok( params, idx );
  4279.  
  4280. if ( IsNumeric( tName ) )
  4281. {
  4282. new levelid = strval( tName );
  4283.  
  4284. if ( !IsPlayerConnected( levelid ) )
  4285. return SendError( playerid, "That player is not connected!" );
  4286.  
  4287. GetPlayerName( levelid, tName, MAX_PLAYER_NAME );
  4288.  
  4289. if ( !strlen( params[ idx + 1 ] ) || !IsNumeric( params[ idx + 1 ] ) )
  4290. return SendUsage( playerid, "/setlevel [id] [level]" );
  4291.  
  4292. new
  4293. level = strval( params[ idx + 1 ] );
  4294.  
  4295. // If the level entered is greater-than or equal to the commanders current level AND
  4296. // the player is NOT admin.
  4297.  
  4298. if ( ( !IsPlayerAdmin( playerid ) && level >= pData[ playerid ][ P_LEVEL ] ) )
  4299. return SendError( playerid, "You cannot set this players level higher than your own." );
  4300.  
  4301. if ( pData[ playerid ][ P_LEVEL ] <= pData[ levelid ][ P_LEVEL ] && !IsPlayerAdmin( playerid ) )
  4302. return SendError( playerid, "You cannot modify a player level who has a level that is the same or higher level as you." );
  4303.  
  4304. new
  4305. DB:Database = db_open( SZ_SQLITE_DB );
  4306.  
  4307. if ( Database )
  4308. {
  4309. new
  4310. aName[ MAX_PLAYER_NAME ];
  4311.  
  4312. if ( SetUserLevel( Database, tName, level ) )
  4313. {
  4314. GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
  4315.  
  4316. format( tString, sizeof( tString ), "* %s (ID: %d) has set your level to %d.", aName, playerid, level );
  4317. SendClientMessage( levelid, COLOR_YELLOW, tString );
  4318.  
  4319. format( tString, sizeof( tString ), "(AdminMsg) %s (ID: %d) has had their level set to %d by %s (ID: %d).", tName, levelid, level, aName, playerid );
  4320. SendClientMessageToAdmins( COLOR_ORANGE, tString );
  4321.  
  4322. pData[ levelid ][ P_LEVEL ] = level;
  4323. }
  4324. else
  4325. SendError( playerid, "There was an error setting the players level (are they registered?)." );
  4326.  
  4327. db_close( Database );
  4328.  
  4329. return 1;
  4330. }
  4331. else return printf( "[ERROR] NO DATABASE!" );
  4332. }
  4333. else return SendUsage( playerid, "/setlevel [id] [level]" );
  4334. }
  4335.  
  4336. dcmd_setname( playerid, params[ ] )
  4337. {
  4338. if ( !IsPlayerAdmin( playerid ) && pData[ playerid ][ P_LEVEL ] < _:P_LEVEL_SERVER )
  4339. return SendError( playerid, "You must be at admin level or higher to use this." );
  4340.  
  4341. if ( params[ 0 ] == '\0' )
  4342. return SendUsage( playerid, "/setname [id] [new_name]" );
  4343.  
  4344. new
  4345. tName[ MAX_PLAYER_NAME ],
  4346. tString[ 128 ],
  4347. DB:Database,
  4348. idx;
  4349.  
  4350. printf( "[ID:%d] typed setname command.", playerid );
  4351.  
  4352. tName = strtok( params, idx );
  4353.  
  4354. if ( IsNumeric( tName ) )
  4355. {
  4356. new
  4357. nameid = strval( tName ),
  4358. namelen = strlen( params[ idx + 1 ] );
  4359.  
  4360. if ( !IsPlayerConnected( nameid ) )
  4361. return SendError( playerid, "That player is not connected!" );
  4362.  
  4363. GetPlayerName( nameid, tName, MAX_PLAYER_NAME );
  4364.  
  4365. if ( !namelen )
  4366. return SendUsage( playerid, "/setname [id] [new_name]" );
  4367.  
  4368. if ( namelen < 3 || namelen > 16 )
  4369. return SendError( playerid, "The new name must be less than 16 characters and greater than 2." );
  4370.  
  4371. namelen += ( idx + 1 );
  4372.  
  4373. for ( new i = idx + 1; i < namelen; i++ )
  4374. {
  4375. if ( isalnum( params[ i ] ) || params[ i ] == '_' || params[ i ] == '[' || params[ i ] == ']' )
  4376. continue;
  4377. else
  4378. return SendError( playerid, "Name can only have the characters: 0-9, A-Z, a-z, [, ] and _" );
  4379. }
  4380.  
  4381. Database = db_open( SZ_SQLITE_DB );
  4382.  
  4383. if ( Database )
  4384. {
  4385. if ( SetUserName( Database, tName, params[ idx + 1 ] ) )
  4386. {
  4387. new
  4388. aName[ MAX_PLAYER_NAME ];
  4389.  
  4390. GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
  4391. SetPlayerName( nameid, params[ idx + 1 ] );
  4392.  
  4393. format( tString, sizeof( tString ), "(Announcement) %s (ID:%d) has set %s's (ID:%d) name to %s.", aName, playerid, tName, nameid, params[ idx + 1 ] );
  4394. SendClientMessageToAdmins( COLOR_ORANGE, tString );
  4395.  
  4396. format( tString, sizeof( tString ), "* Admin %s (ID:%d) has set your username to %s.", tName, playerid, params[ idx + 1 ] );
  4397. SendClientMessage( nameid, COLOR_ORANGE, tString );
  4398. }
  4399. else SendError( playerid, "This player is not registered or the new name is already registered!" );
  4400.  
  4401. db_close( Database );
  4402.  
  4403. return 1;
  4404. }
  4405.  
  4406. return printf( "[ERROR] NO DATABASE!" );
  4407. }
  4408. else
  4409. return SendUsage( playerid, "/setname [id] [new_name]" );
  4410. /*
  4411. else
  4412. {
  4413. if ( !strlen( params[ idx + 1 ] ) )
  4414. return SendUsage( playerid, "/setname [id/name] [new_name]" );
  4415.  
  4416. Database = db_open( SZ_SQLITE_DB );
  4417.  
  4418. if ( Database )
  4419. {
  4420. if ( SetUserName( Database, tName, params[ idx + 1 ] ) )
  4421. {
  4422. new
  4423. aName[ MAX_PLAYER_NAME ];
  4424.  
  4425. GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
  4426. format( tString, sizeof( tString ), "(AdminMsg) %s (ID: %d) has set %s's name to %s.", tName, params[ idx + 1 ] );
  4427. SendClientMessageToAdmins( COLOR_ORANGE, tString );
  4428. }
  4429. else
  4430. SendError( playerid, "This player is not registered!" );
  4431.  
  4432. db_close( Database );
  4433.  
  4434. return 1;
  4435. }
  4436. else return !printf( "[ERROR] NO DATABASE!" );
  4437. }
  4438. */
  4439. }
  4440.  
  4441. dcmd_login( playerid, params[ ] )
  4442. {
  4443. if ( params[ 0 ] == '\0' )
  4444. return SendUsage( playerid, "/login [password]" );
  4445.  
  4446. if ( !pData[ playerid ][ P_FULLY_CONNECTED ] )
  4447. return SendError( playerid, "You have not fully connected yet. Please login at class selection." );
  4448.  
  4449. new
  4450. DB:Database,
  4451. pName[ MAX_PLAYER_NAME ],
  4452. tmpString[ 128 ];
  4453.  
  4454. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  4455.  
  4456. printf( "%s [ID:%d] typed login command.", pName, playerid );
  4457.  
  4458. if ( pData[ playerid ][ P_LOGGED_IN ] )
  4459. return SendError( playerid, "You are already logged in." );
  4460.  
  4461. if ( !pData[ playerid ][ P_REGISTERED ] )
  4462. return SendError( playerid, "You must register this account before logging in." );
  4463.  
  4464. Database
  4465. = db_open( SZ_SQLITE_DB );
  4466.  
  4467. if ( Database )
  4468. {
  4469. if ( LoginUser( Database, playerid, pName, params ) )
  4470. {
  4471. format( tmpString, sizeof( tmpString ), "You have logged into your account (Level: %d, UserID: %d).", pData[ playerid ][ P_LEVEL ], pData[ playerid ][ P_USERID ] );
  4472. SendClientMessage( playerid, COLOR_GREEN, tmpString );
  4473.  
  4474. format( tmpString, sizeof( tmpString ), "Player %s (ID:%d) has logged in (Level: %d, UserID: %d).", pName, playerid, pData[ playerid ][ P_LEVEL ], pData[ playerid ][ P_USERID ] );
  4475. SendClientMessageToAdmins( COLOR_ORANGE, tmpString );
  4476.  
  4477. if ( pData[ playerid ][ P_SKIN ] != -1 )
  4478. {
  4479. SetSpawnInfo( playerid, playerid, pData[ playerid ][ P_SKIN ], 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );
  4480. SpawnPlayer ( playerid );
  4481. }
  4482. else
  4483. {
  4484. pData[ playerid ][ P_SEND_TO_CLASS_SELECT ] = 1;
  4485.  
  4486. SetSpawnInfo( playerid, playerid, 280, 1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );
  4487. SpawnPlayer ( playerid );
  4488. }
  4489.  
  4490. format ( tmpString, sizeof( tmpString ), "[login] %s %d %d %d", pName, playerid, pData[ playerid ][ P_USERID ], pData[ playerid ][ P_LEVEL ] );
  4491. add_log ( tmpString );
  4492. }
  4493.  
  4494. else if ( pData[ playerid ][ P_LOGIN_ATTEMPTS ] > 5 )
  4495. KickPlayer( Database, playerid, 1000, "Failed to login after 5 attempts." );
  4496.  
  4497. else
  4498. SendError( playerid, "Invalid password or non-registered name." );
  4499.  
  4500. db_close( Database );
  4501.  
  4502. return 1;
  4503. }
  4504. else return print( "[ERROR] NO DATABASE!" );
  4505. }
  4506.  
  4507. dcmd_register( playerid, params[ ] )
  4508. {
  4509. if ( params[ 0 ] == '\0' )
  4510. {
  4511. SendUsage( playerid, "/register [email] [password]" );
  4512. SendClientMessage( playerid, COLOR_YELLOW, "Make sure you enter a valid email for password retrieval." );
  4513. return 1;
  4514. }
  4515.  
  4516. new DB:Database,
  4517. idx,
  4518. pName [ MAX_PLAYER_NAME ],
  4519. pEmail [ 128 ],
  4520. tmpString [ 128 ];
  4521.  
  4522. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  4523.  
  4524. printf( "%s [ID:%d] typed register command.", pName, playerid );
  4525.  
  4526. while ( params[ idx ] == ' ' )
  4527. idx++;
  4528.  
  4529. while ( params[ idx ] != ' ' && params[ idx ] != '\0' )
  4530. {
  4531. if
  4532. (
  4533. isalnum( params[ idx ] ) ||
  4534. params[ idx ] == '_' || params[ idx ] == '[' || params[ idx ] == ']' ||
  4535. params[ idx ] == '-' || params[ idx ] == '+' || params[ idx ] == '.' || params[ idx ] == '@'
  4536. )
  4537. {
  4538. pEmail[ idx ] = params[ idx ];
  4539. idx++;
  4540. }
  4541.  
  4542. else
  4543. return SendError( playerid, "Email can only have the characters: 0-9, A-Z, a-z, [, ], _, -, +, . and @." );
  4544. }
  4545.  
  4546. if ( !strlen( params[ idx + 1 ] ) )
  4547. {
  4548. SendUsage( playerid, "/register [email] [password]" );
  4549. SendClientMessage( playerid, COLOR_YELLOW, "Make sure you enter a valid email for password retrieval." );
  4550.  
  4551. return 1;
  4552. }
  4553.  
  4554. Database = db_open( SZ_SQLITE_DB );
  4555.  
  4556. if ( Database )
  4557. {
  4558. new
  4559. pIP[ 16 ];
  4560.  
  4561. GetPlayerIp( playerid, pIP, 16 );
  4562.  
  4563. if ( IsIPRegistered( Database, pIP ) >= 3 )
  4564. SendError( playerid, "You cannot register from the same IP more than 3 times." );
  4565.  
  4566. else if ( RegisterUser( Database, playerid, pName, params[ idx + 1 ], pEmail ) )
  4567. {
  4568. AC_GivePlayerMoney( playerid, 5000 );
  4569.  
  4570. format( tmpString, sizeof( tmpString ), "You have sucessfully registered the username %s. You gained $5000 for registering.", pName );
  4571. SendClientMessage( playerid, COLOR_GREEN, tmpString );
  4572. format( tmpString, sizeof( tmpString ), "UserID: %d, Level: %d, Email: %s, Password: %s", pData[ playerid ][ P_USERID ], pData[ playerid ][ P_LEVEL ], pEmail, params[ idx+ 1 ] );
  4573. SendClientMessage( playerid, COLOR_YELLOW, tmpString );
  4574. format( tmpString, sizeof( tmpString ), "(AdminMsg) %s (ID:%d) has registered their name [UserID: %d, Level: %d].", pName, playerid, pData[ playerid ][ P_USERID ], pData[ playerid ][ P_LEVEL ] );
  4575. SendClientMessageToAdmins( COLOR_GREEN, tmpString );
  4576. format( tmpString, sizeof( tmpString ), "[register] %s %d %d", pName, playerid, pData[ playerid ][ P_USERID ] );
  4577. add_log( tmpString );
  4578. }
  4579. else
  4580. {
  4581. format( tmpString, sizeof( tmpString ), "ERROR: The username %s is already registered.", pName );
  4582. SendClientMessage( playerid, COLOR_RED, tmpString );
  4583. }
  4584.  
  4585. db_close( Database );
  4586.  
  4587. return 1;
  4588. }
  4589. else
  4590. return print( "[ERROR] NO DATABASE!" );
  4591. }
  4592.  
  4593. dcmd_report( playerid, params[ ] )
  4594. {
  4595. new
  4596. tString[ 128 ],
  4597. idx,
  4598. reportid,
  4599. DB:Database;
  4600.  
  4601. tString = strtok( params, idx );
  4602.  
  4603. if ( tString[ 0 ] == '\0' || !IsNumeric( tString ) || !strlen( params[ idx + 1 ] ) )
  4604. return SendUsage( playerid, "/report [id] [reason]" );
  4605.  
  4606. reportid = strval( tString );
  4607.  
  4608. if ( !IsPlayerConnected( reportid ) )
  4609. return SendError( playerid, "Player is not connected." );
  4610.  
  4611. Database = db_open( SZ_SQLITE_DB );
  4612.  
  4613. if ( Database )
  4614. {
  4615. if ( ReportPlayer( Database, reportid, playerid, params[ idx + 1 ] ) )
  4616. SendClientMessage( playerid, COLOR_ORANGE, "You report has been sent to online moderators/admins." );
  4617. else
  4618. SendError( playerid, "There was an error sending your report. Please try again." );
  4619.  
  4620. db_close( Database );
  4621. }
  4622. else print( "[ERROR] NO DATABASE!" );
  4623.  
  4624. return 1;
  4625. }
  4626.  
  4627. dcmd_unban( playerid, params[ ] )
  4628. {
  4629. new
  4630. tString[ 128 ],
  4631. DB:Database;
  4632.  
  4633. if ( params[ 0 ] == '\0' )
  4634. return SendUsage( playerid, "/unban [name]" );
  4635.  
  4636. Database = db_open( SZ_SQLITE_DB );
  4637.  
  4638. if ( Database )
  4639. {
  4640. GetPlayerName( playerid, tString, MAX_PLAYER_NAME );
  4641.  
  4642. if ( UnbanPlayer( Database, params, tString ) )
  4643. {
  4644. format( tString, sizeof( tString ), "(AdminMsg) %s has unbanned %s.", tString, params );
  4645. SendClientMessageToAdmins( COLOR_ORANGE, tString );
  4646. }
  4647. else
  4648. SendError( playerid, "Player is not registered." );
  4649.  
  4650. db_close( Database );
  4651.  
  4652. return 1;
  4653. }
  4654. else return print( "[ERROR] NO DATABASE!" );
  4655. }
  4656.  
  4657. dcmd_ban( playerid, params[ ] )
  4658. {
  4659. new
  4660. tString[ 128 ],
  4661. idx,
  4662. banid,
  4663. DB:Database;
  4664.  
  4665. tString = strtok( params, idx );
  4666.  
  4667. if ( tString[ 0 ] == '\0' || !IsNumeric( tString ) || !strlen( params[ idx + 1 ] ) )
  4668. return SendUsage( playerid, "/ban [id] [reason]" );
  4669.  
  4670. banid = strval( tString );
  4671.  
  4672. if ( !IsPlayerConnected( banid ) )
  4673.  
  4674. return SendError( playerid, "Player is not connected." );
  4675. if ( pData[ playerid ][ P_LEVEL ] <= pData[ banid ][ P_LEVEL ] && !IsPlayerAdmin( playerid ) )
  4676. return SendError( playerid, "You cannot ban a player who has a level that is the same or higher level than your own." );
  4677.  
  4678. Database = db_open( SZ_SQLITE_DB );
  4679.  
  4680. if ( Database )
  4681. {
  4682. if ( !BanPlayer( Database, banid, playerid, params[ idx + 1 ] ) )
  4683. SendError( playerid, "There was an error banning. Please try again." );
  4684.  
  4685. db_close( Database );
  4686.  
  4687. return 1;
  4688. }
  4689. else return print( "[ERROR] NO DATABASE!" );
  4690. }
  4691.  
  4692. dcmd_kick( playerid, params[ ] )
  4693. {
  4694. new
  4695. tString[ 128 ],
  4696. idx,
  4697. kickid,
  4698. DB:Database;
  4699.  
  4700. tString = strtok( params, idx );
  4701.  
  4702. if ( tString[ 0 ] == '\0' || !IsNumeric( tString ) || !strlen( params[ idx + 1 ] ) )
  4703. return SendUsage( playerid, "/kick [id] [reason]" );
  4704.  
  4705. kickid = strval( tString );
  4706.  
  4707. if ( !IsPlayerConnected( kickid ) )
  4708. return SendError( playerid, "Player is not connected." );
  4709.  
  4710. Database = db_open( SZ_SQLITE_DB );
  4711.  
  4712. if ( Database )
  4713. {
  4714. if ( !KickPlayer( Database, kickid, playerid, params[ idx + 1 ] ) )
  4715. SendError( playerid, "There was an error kicking. Please try again." );
  4716.  
  4717. db_close( Database );
  4718.  
  4719. return 1;
  4720. }
  4721. else return print( "[ERROR] NO DATABASE!" );
  4722. }
  4723.  
  4724. dcmd_strip( playerid, params[ ] )
  4725. {
  4726. #pragma unused params
  4727. return SetPlayerSpecialAction( playerid, SPECIAL_ACTION_DANCE4 );
  4728. }
  4729.  
  4730. dcmd_player( playerid, params[ ] )
  4731. {
  4732. new otherid = playerid, pString[ MAX_CLIENT_MSG ], pName[ MAX_PLAYER_NAME ];
  4733.  
  4734. if ( strlen( params ) && IsNumeric( params ) )
  4735. otherid = strval( params );
  4736. if ( !IsPlayerConnected( otherid ) )
  4737. return SendError( playerid, "Player must be connected!" );
  4738.  
  4739. GetPlayerName( otherid, pName, MAX_PLAYER_NAME );
  4740. format( pString, sizeof( pString ), "(Stats): %s (ID:%d):", pName, otherid );
  4741. SendClientMessage( playerid, COLOR_GREEN, pString );
  4742. format( pString, sizeof( pString ), "(Money): Money -> $%d .. Bounty -> $%d", GetPlayerMoney( otherid ), pData[ otherid ][ P_BOUNTY ] );
  4743. SendClientMessage( playerid, COLOR_YELLOW, pString );
  4744. format( pString, sizeof( pString ), "(Kills/Deaths): Kills -> %d .. Deaths -> %d", pData[ otherid ][ P_KILLS ], pData[ otherid ][ P_DEATHS ] );
  4745.  
  4746. if ( !pData[ otherid ][ P_DEATHS ] )
  4747. format( pString, sizeof( pString ), "%s .. Kill Ratio -> N/A", pString );
  4748. else
  4749. format( pString, sizeof( pString ), "%s .. Kill Ratio -> %.2f", pString, floatdiv( pData[ otherid ][ P_KILLS ], pData[ otherid ][ P_DEATHS ] ) );
  4750.  
  4751. SendClientMessage( playerid, COLOR_YELLOW, pString );
  4752.  
  4753. format( pString, sizeof( pString ), "(Account): Online -> %d hours, %d minutes and %d seconds .. Registered -> %s .. Level -> %d",
  4754. pData[ otherid ][ P_ONLINE_TICKS ] / 3600, ( pData[ otherid ][ P_ONLINE_TICKS ] / 60 ) % 60, ( pData[ otherid ][ P_ONLINE_TICKS ] ) % 60,
  4755. ( pData[ otherid ][ P_REGISTERED ] ? ( "Yes" ) : ( "No" ) ), pData[ otherid ][ P_LEVEL ]
  4756. );
  4757.  
  4758. SendClientMessage( playerid, COLOR_YELLOW, pString );
  4759.  
  4760. if ( IsPlayerInAnyGang( otherid ) )
  4761. {
  4762. format( pString, sizeof( pString ), "(Gang): Name -> %s (%d) .. Position -> %d (%s)", gData[ pData[ otherid ][ P_GANG_ID ] ][ G_NAME ], pData[ otherid ][ P_GANG_ID ], pData[ otherid ][ P_GANG_POS ], pData[ otherid ][ P_GANG_POS ] ? ("Member") : ("Leader") );
  4763. SendClientMessage( playerid, COLOR_CYAN, pString );
  4764. }
  4765.  
  4766. return 1;
  4767.  
  4768. }
  4769.  
  4770. dcmd_stats( playerid, params[ ] )
  4771. return dcmd_player( playerid, params );
  4772.  
  4773. dcmd_help( playerid, params[ ] )
  4774. {
  4775. if ( params[ 0 ] == '\0' || !strcmp( params, "general", true, 7 ) )
  4776. {
  4777. SendClientMessage( playerid, COLOR_GREEN, "" SZ_GAMEMODE_L_NAME " (" SZ_GAMEMODE_S_NAME ") - General Help" );
  4778. SendClientMessage( playerid, COLOR_YELLOW, " " SZ_GAMEMODE_S_NAME " is a custom gamemode based off the ideas of Sintax and jax. It features gangs, properties," );
  4779. SendClientMessage( playerid, COLOR_YELLOW, " deathmatch, banking and other various features." );
  4780. SendClientMessage( playerid, COLOR_YELLOW, " To view other basic topics to get started then type the following commands:" );
  4781. SendClientMessage( playerid, COLOR_YELLOW, " /help [topic], /commands [topic], /objective, /tips, /credits" );
  4782. SendClientMessage( playerid, COLOR_GREEN, " Help Topics:" );
  4783. SendClientMessage( playerid, COLOR_YELLOW, " general, gangs, accounts, weapons, bank, properties, bounties, territories" );
  4784.  
  4785. if ( !random( 256 ) )
  4786. {
  4787. new
  4788. iTalkCnt,
  4789. iConversationID = INVALID_PLAYER_ID;
  4790.  
  4791. loopPlayers( i )
  4792. {
  4793. if ( i != playerid )
  4794. {
  4795. iConversationID = i;
  4796. iTalkCnt = 1;
  4797.  
  4798. break;
  4799. }
  4800. }
  4801.  
  4802. if ( iTalkCnt )
  4803. {
  4804. SendPlayerMessageToAll( playerid, "You punk-ass bitch, punk-ass busta fool!" );
  4805. SendPlayerMessageToAll( iConversationID, "I dunno what you just said, but I bought you some malt liqour to calm you down." );
  4806. SendPlayerMessageToAll( playerid, "You a busta fool. Luckily, your not dead 'coz I'm also a pimp! Including you, I'll pimp anything! You hear me playa?" );
  4807. SendPlayerMessageToAll( iConversationID, "Yes, I hear you, you'll pimp anything. But you know, it's kinda like my dream to sleep with housewives." );
  4808. SendPlayerMessageToAll( playerid, "ARE YOU - DISSIN' - MY HOS, BITCH?" );
  4809. SendPlayerMessageToAll( iConversationID, "Uh, no, no. Your hos are bitches, your hos are bitches. Look please, don't shoot me, homie." );
  4810. }
  4811. }
  4812.  
  4813. return 1;
  4814. }
  4815.  
  4816. if ( !strcmp( params, "bank", true, 4 ) )
  4817. {
  4818. SendClientMessage( playerid, COLOR_GREEN, "Bank Help:" );
  4819. SendClientMessage( playerid, COLOR_YELLOW, " Banks in " SZ_GAMEMODE_S_NAME " serve as an important feature for protecting your money," );
  4820. SendClientMessage( playerid, COLOR_YELLOW, " this is because when you are killed you lose your money, if your money is banked" );
  4821. SendClientMessage( playerid, COLOR_YELLOW, " then it will stay in the bank protected until you withdraw it. If you have an account then you can bank" );
  4822. SendClientMessage( playerid, COLOR_YELLOW, " your cash to an account for another play, read the \"accounts\" help topic for more information on accounts." );
  4823. SendClientMessage( playerid, COLOR_YELLOW, " You can share your banked using a gang bank, read the \"gangs\" topic for more information about gangs." );
  4824. SendClientMessage( playerid, COLOR_GREEN, "Bank Commands:" );
  4825. SendClientMessage( playerid, COLOR_YELLOW, " /bank, /withdraw, /balance, /gbank, /gwithdraw, /gbalance" );
  4826. SendClientMessage( playerid, COLOR_RED, "The bank system also has menu's that you can use instead of commands. You must be inside the 24/7" );
  4827. SendClientMessage( playerid, COLOR_RED, "convenience store checkpoint to use bank commands." );
  4828.  
  4829. return 1;
  4830. }
  4831.  
  4832. if ( !strcmp( params, "gangs", true, 5 ) )
  4833. {
  4834. SendClientMessage( playerid, COLOR_GREEN, "Gangs Help:" );
  4835. SendClientMessage( playerid, COLOR_YELLOW, " " SZ_GAMEMODE_S_NAME " has a gangs system that allows player to gang up with each other and work" );
  4836. SendClientMessage( playerid, COLOR_YELLOW, " together to kill other players and build up cash. You can use gangs to take over" );
  4837. SendClientMessage( playerid, COLOR_YELLOW, " territories, please read the \"territories\" topic in help for more information about territories." );
  4838. SendClientMessage( playerid, COLOR_GREEN, "Gangs Commands:" );
  4839. SendClientMessage( playerid, COLOR_YELLOW, " /gangs, /gang create, /gang join, /gang quit, /gang info, /gang kick," );
  4840. SendClientMessage( playerid, COLOR_YELLOW, " /gang invite, /gang setleader, /gbank, /gwithdraw, /gbalance" );
  4841.  
  4842. return 1;
  4843. }
  4844.  
  4845. if ( !strcmp( params, "weapons", true, 7 ) )
  4846. {
  4847. SendClientMessage( playerid, COLOR_GREEN, "Weapons Help:" );
  4848. SendClientMessage( playerid, COLOR_YELLOW, " Weapons are a vital tool for survival in " SZ_GAMEMODE_S_NAME ", all new players will" );
  4849. SendClientMessage( playerid, COLOR_YELLOW, " start with the standard \"Desert Eagle\". Once a player gains enough money they can" );
  4850. SendClientMessage( playerid, COLOR_YELLOW, " head off to Ammunation and purchase standard weapons OR they can purchase spawn weapons" );
  4851. SendClientMessage( playerid, COLOR_YELLOW, " which they will be given after death." );
  4852. SendClientMessage( playerid, COLOR_GREEN, "Weapons Commands:" );
  4853. SendClientMessage( playerid, COLOR_YELLOW, " /buyweapon, /weaponlist" );
  4854. SendClientMessage( playerid, COLOR_RED, "The weapon system also has menu's that you can use instead of commands. You must be inside the secondary" );
  4855. SendClientMessage( playerid, COLOR_RED, "Ammunation checkpoint to use these commands." );
  4856.  
  4857. return 1;
  4858. }
  4859.  
  4860. if ( !strcmp( params, "bounties", true, 8 ) )
  4861. {
  4862. SendClientMessage( playerid, COLOR_GREEN, "Bounties Help:" );
  4863. SendClientMessage( playerid, COLOR_YELLOW, " Got a player you have a grudge on for something? Want to start some competition?" );
  4864. SendClientMessage( playerid, COLOR_YELLOW, " Place a bounty on a player and get someone or a GROUP of people to hunt the player down" );
  4865. SendClientMessage( playerid, COLOR_YELLOW, " for some hot cash. The player who is marked ORANGE on the radar has the highest bounty" );
  4866. SendClientMessage( playerid, COLOR_YELLOW, " so hunt him down if you're looking for some cash!" );
  4867. SendClientMessage( playerid, COLOR_GREEN, "Weapons Commands:" );
  4868. SendClientMessage( playerid, COLOR_YELLOW, " /bounty, /hitman, /bounties" );
  4869.  
  4870. return 1;
  4871. }
  4872.  
  4873. if ( !strcmp( params, "accounts", true, 8 ) )
  4874. {
  4875. SendClientMessage( playerid, COLOR_GREEN, "Accounts Help:" );
  4876. SendClientMessage( playerid, COLOR_YELLOW, " Accounts can be used to protect your nickname and save various stats for the player" );
  4877. SendClientMessage( playerid, COLOR_YELLOW, " such as bank, kills, deaths, online time, bounty, last skin and admin level." );
  4878. SendClientMessage( playerid, COLOR_GREEN, "Accounts Commands:" );
  4879. SendClientMessage( playerid, COLOR_YELLOW, " /register, /stats, /login, /password, /email, /drop, /setlevel, /setname" );
  4880. SendClientMessage( playerid, COLOR_RED, " Please note that some of these account commands are only available for administrators." );
  4881.  
  4882. return 1;
  4883. }
  4884.  
  4885. if ( !strcmp( params, "properties", true, 10 ) )
  4886. {
  4887. SendClientMessage( playerid, COLOR_GREEN, "Properties Help:" );
  4888. SendClientMessage( playerid, COLOR_YELLOW, " The properties feature in " SZ_GAMEMODE_S_NAME " allows players to gain an income by purchasing" );
  4889. SendClientMessage( playerid, COLOR_YELLOW, " properties found across the map. A property purchased by you is protected until you" );
  4890. SendClientMessage( playerid, COLOR_YELLOW, " receive your first payment, after your first payment another player is able to purchase" );
  4891. SendClientMessage( playerid, COLOR_YELLOW, " the property (you will be refunded the properties current value!)." );
  4892. SendClientMessage( playerid, COLOR_GREEN, "Properties Commands:" );
  4893. SendClientMessage( playerid, COLOR_YELLOW, " /buy, /sell, /properties [1-4]" );
  4894.  
  4895. return 1;
  4896. }
  4897.  
  4898. if ( !strcmp( params, "territories", true, 11 ) )
  4899. {
  4900. SendClientMessage( playerid, COLOR_GREEN, "Territories Help:" );
  4901. SendClientMessage( playerid, COLOR_YELLOW, " Gang territories are placed in certain areas of Las Venturas and are noticeable by coloured patches on the in-game radar." );
  4902. SendClientMessage( playerid, COLOR_YELLOW, " already own the use these gang territories to generate some extra income for your gang. You will get money" );
  4903. SendClientMessage( playerid, COLOR_YELLOW, " upon taking a territory OR territory you can get money for defending the territory from an attack. In order to start an" );
  4904. SendClientMessage( playerid, COLOR_YELLOW, " attack you will need two players (from your gang) in the territory for a period of time, the final score is calculated" );
  4905. SendClientMessage( playerid, COLOR_YELLOW, " based upon gang members, kills, deaths in the territory and a couple of extra points can be gained from other tasks." );
  4906.  
  4907. return 1;
  4908. }
  4909.  
  4910. return 0;
  4911. }
  4912.  
  4913.  
  4914. dcmd_tips( playerid, params[ ] )
  4915. {
  4916. #pragma unused params
  4917.  
  4918. SendClientMessage( playerid, COLOR_GREEN, "" SZ_GAMEMODE_L_NAME " (" SZ_GAMEMODE_S_NAME ") - Tips:" );
  4919. SendClientMessage( playerid, COLOR_YELLOW, " 1.) The best place to hang around for newbies to " SZ_GAMEMODE_S_NAME " would" );
  4920. SendClientMessage( playerid, COLOR_YELLOW, " have to be the pirate ships as it gives you $25 if you stand on them." );
  4921. SendClientMessage( playerid, COLOR_YELLOW, " 2.) Joining a good gang will ensure you have friends to back you" );
  4922. SendClientMessage( playerid, COLOR_YELLOW, " up, you can also share money using gang bank." );
  4923. SendClientMessage( playerid, COLOR_YELLOW, " 3.) Using the bank is important, if you die you will lose all" );
  4924. SendClientMessage( playerid, COLOR_YELLOW, " of the money currently on you - put uneeded money in bank for later." );
  4925. SendClientMessage( playerid, COLOR_ORANGE, " There's several other ways to play the gamemode, devise your own strategy's" );
  4926. SendClientMessage( playerid, COLOR_ORANGE, " and suprise people." );
  4927.  
  4928. return 1;
  4929. }
  4930.  
  4931. dcmd_objective( playerid, params[ ] )
  4932. {
  4933. #pragma unused params
  4934.  
  4935. SendClientMessage( playerid, COLOR_GREEN, "" SZ_GAMEMODE_L_NAME " (" SZ_GAMEMODE_S_NAME ") - Objective:" );
  4936. SendClientMessage( playerid, COLOR_YELLOW, " There's no end game objective in " SZ_GAMEMODE_S_NAME ", everybody can win through" );
  4937. SendClientMessage( playerid, COLOR_YELLOW, " their own challenges. Some challenges you might like to strive for" );
  4938. SendClientMessage( playerid, COLOR_YELLOW, " could be, being the richest on the server, getting the most kills," );
  4939. SendClientMessage( playerid, COLOR_YELLOW, " owning the most properties, owning all of the gang territories, achieve" );
  4940. SendClientMessage( playerid, COLOR_YELLOW, " special kills (e.g. snipering) and/or anything else you can think of." );
  4941.  
  4942. return 1;
  4943. }
  4944.  
  4945. dcmd_credits( playerid, params[ ] )
  4946. {
  4947. #pragma unused params
  4948.  
  4949. SendClientMessage( playerid, COLOR_GREEN, "" SZ_GAMEMODE_L_NAME " (" SZ_GAMEMODE_S_NAME " - Credits:" );
  4950. SendClientMessage( playerid, COLOR_GREEN, "Scripters:" );
  4951. SendClientMessage( playerid, COLOR_YELLOW," adamcs, Brandon, jax, kenny01, LnX, Mike, Sintax, Simon" );
  4952. SendClientMessage( playerid, COLOR_GREEN, "Special thanks:" );
  4953. SendClientMessage( playerid, COLOR_YELLOW," Cam, Ez, Damian, DracoBlue, IDmad, jacob, jinx, littlewhitey, Lop_Dog, Peter," );
  4954. SendClientMessage( playerid, COLOR_YELLOW," Sneaky, Y_Less and also thanks to the following groups, littlewhitey administrators," );
  4955. SendClientMessage( playerid, COLOR_YELLOW," SA:MP developers, SA:MP betateam, scripters, script testers, " );
  4956. SendClientMessage( playerid, COLOR_YELLOW," [CP], [eVo], [KFC], [MOB], [R], [S], [SiN] [SWK], [W]." );
  4957. SendClientMessage( playerid, COLOR_ORANGE,"Thank YOU for playing this gamemode." );
  4958.  
  4959. return 1;
  4960. }
  4961.  
  4962. dcmd_gangs( playerid, params[ ] )
  4963. {
  4964. #pragma unused params
  4965.  
  4966. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  4967. print("Debug: 1");
  4968. lclear(playerid);
  4969. print("Debug: 2");
  4970. lshowmessage(playerid, lgangs[0]);
  4971. print("Debug: 3");
  4972. lshowmessage(playerid, lgangs[1]);
  4973. print("Debug: 4");
  4974. lvisiblemessage[playerid] = 2;
  4975. print("Debug: 5");
  4976. #else
  4977.  
  4978. new
  4979. szGangString[ MAX_CLIENT_MSG ] = "* ",
  4980. iCnt, iGangCnt;
  4981.  
  4982. SendClientMessage( playerid, COLOR_GREEN, "Gangs:" );
  4983.  
  4984. for ( new i = 0; i < MAX_GANGS; i++ )
  4985. {
  4986. if ( gData[ i ][ G_TOTALS ] )
  4987. {
  4988. iCnt ++;
  4989. iGangCnt++;
  4990.  
  4991. format( szGangString, sizeof( szGangString ), "%s%s (%d) - Members %d, ", szGangString, gData[ i ][ G_NAME ], i, gData[ i ][ G_TOTALS ] );
  4992.  
  4993. if ( iCnt >= 3 )
  4994. {
  4995. SendClientMessage( playerid, COLOR_YELLOW, szGangString );
  4996.  
  4997. szGangString= "* ";
  4998. iCnt = 0;
  4999. }
  5000. }
  5001. }
  5002.  
  5003. if ( !iGangCnt )
  5004. SendClientMessage( playerid, COLOR_WHITE, "There are no gangs online." );
  5005.  
  5006. else
  5007. {
  5008. if ( iCnt )
  5009. SendClientMessage( playerid, COLOR_YELLOW, szGangString );
  5010.  
  5011. if ( iGangCnt != 1 )
  5012. format( szGangString, sizeof( szGangString ), "There is %d gangs online.", gTotals );
  5013. else
  5014. szGangString = "There is 1 gang online.";
  5015.  
  5016. SendClientMessage( playerid, COLOR_WHITE, szGangString );
  5017. }
  5018.  
  5019. #endif
  5020. return 1;
  5021. }
  5022.  
  5023. dcmd_gang( playerid, params[ ] )
  5024. {
  5025. new gString[ MAX_CLIENT_MSG ], gangid = pData[ playerid ][ P_GANG_ID ];
  5026.  
  5027. if ( params[ 0 ] == '\0' )
  5028. return SendUsage( playerid, "/gang [CREATE/JOIN/QUIT/INFO/KICK/INVITE/SETLEADER] [PLAYERID/GANG_NAME/GANGID]" );
  5029. else if ( !strcmp( params, "create", true, 6 ) )
  5030. {
  5031. if ( IsPlayerInAnyGang( playerid ) )
  5032. return SendError( playerid, "You are already in a gang." );
  5033. else if ( !strlen( params[ 7 ] ) )
  5034. return SendUsage( playerid, "/gang create [GANG_NAME]" );
  5035. else
  5036. {
  5037. strcpy( gString, params, 0, 7 );
  5038.  
  5039. if ( CreateGang( playerid, gString ) != INVALID_GANG_ID )
  5040. {
  5041. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5042. print("Debug: 1 3237");
  5043. lredraw(2);
  5044. #endif
  5045. return 1;
  5046. }
  5047. else
  5048. return SendError( playerid, "Gang could not be created." );
  5049. }
  5050. }
  5051.  
  5052. else if ( !strcmp( params, "quit", true, 4 ) || !strcmp( params, "leave", true, 5 ) )
  5053. {
  5054. if ( !IsPlayerInAnyGang( playerid ) )
  5055. return SendError( playerid, "You are not in a gang." );
  5056. else
  5057. {
  5058. RemovePlayerFromGang( playerid, GANG_LEAVE_QUIT );
  5059. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5060. lredraw(2);
  5061. #endif
  5062. return 1;
  5063. }
  5064. }
  5065.  
  5066. else if ( !strcmp ( params, "kick", true, 4 ) )
  5067. {
  5068. if ( pData[ playerid ][ P_GANG_POS ] )
  5069. return SendError( playerid, "You must be gang leader to use this command." );
  5070. else if ( !strlen( params[ 5 ] ) || !IsNumeric( params[ 5 ] ) )
  5071. return SendUsage( playerid, "/gang kick [PLAYERID]" );
  5072.  
  5073. new kick = strval( params[ 5 ] );
  5074.  
  5075. if ( !IsPlayerConnected( kick ) )
  5076. return SendError( playerid, "Player is not connected." );
  5077. else if ( pData[ kick ][ P_GANG_ID ] != pData[ playerid ][ P_GANG_ID ] )
  5078. return SendError( playerid, "You can only kick players in your gang." );
  5079. else
  5080. {
  5081. RemovePlayerFromGang( kick, GANG_LEAVE_KICK, playerid );
  5082. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5083. lredraw(2);
  5084. #endif
  5085. return 1;
  5086. }
  5087. }
  5088.  
  5089. else if ( !strcmp( params, "invite", true, 6 ) )
  5090. {
  5091. // if ( pData[ playerid ][ P_GANG_POS ] )
  5092. // return SendError( playerid, "You must be gang leader to use this command." );
  5093.  
  5094. if ( !IsPlayerInAnyGang( playerid ) )
  5095. return SendError( playerid, "You must be in a gang to use this command." );
  5096. else if ( !strlen( params[ 7 ] ) || !IsNumeric( params[ 7 ] ) )
  5097. return SendUsage( playerid, "/gang invite [PLAYERID]" );
  5098.  
  5099. new invite = strval( params[ 7 ] );
  5100.  
  5101. if ( !IsPlayerConnected( invite ) )
  5102. return SendError( playerid, "Player is not connected." );
  5103. else if ( invite == playerid )
  5104. return SendError( playerid, "Inviting yourself?" );
  5105.  
  5106. else
  5107. {
  5108. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  5109. format( gString, sizeof( gString ), "* %s (ID: %d) invited you to join %s (ID: %d). Type /gang join to join.", gString, playerid, gData[ gangid ][ G_NAME ], gangid );
  5110. SendClientMessage( invite, COLOR_ORANGE, gString );
  5111.  
  5112. GetPlayerName( invite, gString, MAX_PLAYER_NAME );
  5113. format( gString, sizeof( gString ), "* Sent a gang invite to %s (ID: %d).", gString, invite );
  5114. SendClientMessage( playerid, COLOR_GREEN, gString );
  5115.  
  5116. pData[ invite ][ P_GANG_INVITE ] = pData[ playerid ][ P_GANG_ID ];
  5117. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5118. lredraw(2);
  5119. #endif
  5120. return 1;
  5121. }
  5122. }
  5123.  
  5124. else if ( !strcmp( params, "info", true, 4 ) )
  5125. {
  5126. new gID = INVALID_GANG_ID;
  5127.  
  5128. if ( !strlen( params[ 5 ] ) )
  5129. {
  5130. if ( !IsPlayerInAnyGang( playerid ) )
  5131. return SendUsage( playerid, "/gang info [GANGID]" );
  5132. else
  5133. gID = pData[ playerid ][ P_GANG_ID ];
  5134. }
  5135.  
  5136. else if ( strlen( params[ 5 ] ) )
  5137. {
  5138. if ( !IsNumeric( params[ 5 ] ) )
  5139. return SendUsage( playerid, "/gang info [GANGID]" );
  5140. else
  5141. gID = strval( params[ 5 ] );
  5142. }
  5143.  
  5144. if ( !IsValidGang( gID ) )
  5145. {
  5146. return SendError( playerid, "Enter a valid gang id." );
  5147. }
  5148.  
  5149. new pName[ MAX_PLAYER_NAME ], counter;
  5150.  
  5151. format( gString, sizeof( gString ), "* Gang Information for %s (ID:%d):", gData[ gID ][ G_NAME ], gID );
  5152. SendClientMessage( playerid, COLOR_GREEN, gString );
  5153. GetPlayerName( gData[ gID ][ G_LEADER ], gString, MAX_PLAYER_NAME );
  5154. format( gString, sizeof( gString ), "* Leader - %s (ID:%d) | Members - %d", gString, gData[ gID ][ G_LEADER ], gData[ gID ][ G_TOTALS ] );
  5155. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5156. format( gString, sizeof( gString ), "* Kills - %d | Deaths - %d", gData[ gID ][ G_KILLS ], gData[ gID ][ G_DEATHS ] );
  5157.  
  5158. if ( !gData[ gID ][ G_DEATHS ] || !gData[ gID ][ G_KILLS ] )
  5159. {
  5160. format( gString, sizeof( gString ), "%s | Kill Ratio - N/A", gString );
  5161. }
  5162.  
  5163. else
  5164. {
  5165. format( gString, sizeof( gString ), "%s | Kill Ratio - %.2f", gString, floatdiv( gData[ gID ][ G_KILLS ], gData[ gID ][ G_DEATHS ] ) );
  5166. }
  5167.  
  5168. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5169. gString = "* ";
  5170.  
  5171. for ( new memberid = 0; memberid < gData[ gID ][ G_TOTALS ]; memberid++ )
  5172. {
  5173. if ( IsPlayerConnected( gData[ gID ][ G_MEMBERS ][ memberid ] ) )
  5174. {
  5175. GetPlayerName( gData[ gID ][ G_MEMBERS ][ memberid ], pName, MAX_PLAYER_NAME );
  5176.  
  5177. if ( counter > 3 )
  5178. {
  5179. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5180. gString = "* ";
  5181. format( gString, sizeof( gString ), "%s%s (%d), ", gString, pName, gData[ gID ][ G_MEMBERS ][ memberid ] );
  5182. counter = 1;
  5183. }
  5184. else
  5185. {
  5186. format( gString, sizeof( gString ), "%s%s (%d), ", gString, pName, gData[ gID ][ G_MEMBERS ][ memberid ] );
  5187. counter++;
  5188. }
  5189. }
  5190. }
  5191.  
  5192. if ( strlen( gString[ 2 ] ) )
  5193. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5194.  
  5195. return 1;
  5196. }
  5197.  
  5198. else if ( !strcmp( params, "join", true, 4 ) )
  5199. {
  5200. if ( pData[ playerid ][ P_GANG_INVITE ] == INVALID_GANG_ID )
  5201. return SendError( playerid, "You have not been invited to a gang." );
  5202. else if ( gData[ pData[ playerid ][ P_GANG_INVITE ] ][ G_TOTALS ] >= MAX_GANG_MEMBERS )
  5203. return SendError( playerid, "This gang is full." );
  5204. else
  5205. {
  5206. if ( IsPlayerInAnyGang( playerid ) )
  5207. RemovePlayerFromGang( playerid, GANG_LEAVE_QUIT );
  5208.  
  5209. SetPlayerGang( playerid, pData[ playerid ][ P_GANG_INVITE ] );
  5210. pData[ playerid ][ P_GANG_INVITE ] = INVALID_GANG_ID;
  5211. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5212. lredraw(2);
  5213. #endif
  5214. return 1;
  5215. }
  5216. }
  5217. /* else if ( !strcmp( params, "alliance", true, 8 ) )
  5218. {
  5219. if ( !IsPlayerInAnyGang( playerid ) )
  5220. return SendError( playerid, "You must be in a gang to use this command." );
  5221. else if ( pData[ playerid ][ P_GANG_POS ] )
  5222. return SendError( playerid, "You must be a gang leader to use this command." );
  5223. else if ( !strlen( params[ 9 ] ) || !IsNumeric( params[ 10 ] ) )
  5224. return SendUsage( playerid, "/gang alliance [gangid]" );
  5225.  
  5226. new allyid = strval( params[ 9 ] );
  5227.  
  5228. if ( !IsValidGang( allyid ) )
  5229. return SendError( playerid, "Who are you trying to ally with!?" );
  5230. else
  5231. {
  5232. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_ALLY ] = allyid;
  5233.  
  5234. format( gString, sizeof( gString ), "* Your gang has allied with %s (ID:%d).", gData[ allyid ][ G_NAME ], allyid );
  5235. SendClientMessageToGang( pData[ playerid ][ P_GANG_ID ], COLOR_ORANGE, gString );
  5236. format( gString, sizeof( gString ), "* %s (ID:%d) has made you their ally.", gData[ pData[ playerid ][ P_GANG_ID ] ][ G_NAME ], pData[ playerid ][ P_GANG_ID ] );
  5237. SendClientMessageToGang( allyid, COLOR_ORANGE, gString );
  5238.  
  5239. return 1;
  5240. }
  5241. }
  5242. */
  5243. else if ( !strcmp( params, "setleader", true, 9 ) )
  5244. {
  5245. if ( !IsPlayerInAnyGang( playerid ) )
  5246. return SendError( playerid, "You must be in a gang to use this command." );
  5247. else if ( pData[ playerid ][ P_GANG_POS ] )
  5248. return SendError( playerid, "You must be the gang leader to use this command." );
  5249. else if ( !strlen( params[ 10 ] ) || !IsNumeric( params[ 10 ] ) )
  5250. return SendUsage( playerid, "/gang setleader [PLAYERID]" );
  5251.  
  5252. new otherid = strval( params[ 10 ] );
  5253.  
  5254. if ( !IsPlayerConnected( otherid ) )
  5255. return SendError( playerid, "Player is not connected." );
  5256. else if ( !IsPlayerInGang( otherid, pData[ playerid ][ P_GANG_ID ] ) )
  5257. return SendError( playerid, "This player is not in your gang!" );
  5258. else
  5259. {
  5260. new
  5261. pName[ MAX_PLAYER_NAME ];
  5262.  
  5263. gData[ gangid ][ G_MEMBERS ][ pData[ otherid ][ P_GANG_POS ] ] = playerid;
  5264. pData[ playerid ][ P_GANG_POS ] = pData[ otherid ][ P_GANG_POS ];
  5265.  
  5266. gData[ gangid ][ G_MEMBERS ][ 0 ] = otherid;
  5267. pData[ otherid ][ P_GANG_POS ] = 0;
  5268.  
  5269. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_LEADER ] = otherid;
  5270. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_COLOR ] = pColors[ otherid ];
  5271.  
  5272. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  5273. GetPlayerName( otherid, gString, MAX_PLAYER_NAME );
  5274.  
  5275. format( gString, sizeof( gString ), "* %s (ID:%d) has set %s (ID:%d) as gang leader.", pName, playerid, gString, otherid );
  5276.  
  5277. if ( playerid != sRhinoOwner && playerid != sHighBountyPlayer )
  5278. SetPlayerColor( playerid, setAlpha( pColors[ playerid ], 0x40 ) );
  5279.  
  5280. for ( new memberid = 0; memberid < gData[ gangid ][ G_TOTALS ]; memberid++ )
  5281. {
  5282. if ( IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ memberid ] ) )
  5283. {
  5284. if ( sRhinoOwner == gData[ gangid ][ G_MEMBERS ][ memberid ] || sHighBountyPlayer == gData[ gangid ][ G_MEMBERS ][ memberid ] )
  5285. {
  5286. // We don't need to set "memberid"'s colour ...
  5287.  
  5288. for ( new omemberid = 0; omemberid < gData[ gangid ][ G_TOTALS ]; omemberid++ )
  5289. {
  5290. if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ omemberid ] ) )
  5291. continue;
  5292.  
  5293. // We need to set "omemberid"'s colour
  5294. if( sRhinoOwner != gData[ gangid ][ G_MEMBERS ][ omemberid ] && sHighBountyPlayer != gData[ gangid ][ G_MEMBERS ][ omemberid ] )
  5295. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gData[ gangid ][ G_MEMBERS ][ omemberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  5296. }
  5297. }
  5298.  
  5299. else
  5300. {
  5301. // We need to set memberid's colour.
  5302. SetPlayerColor( gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0x40 ) );
  5303.  
  5304. for ( new omemberid = 0; omemberid < gData[ gangid ][ G_TOTALS ]; omemberid++ )
  5305. {
  5306. if ( !IsPlayerConnected( gData[ gangid ][ G_MEMBERS ][ omemberid ] ) )
  5307. continue;
  5308.  
  5309. // We don't need to set "j"'s colour.
  5310. if ( sRhinoOwner == gData[ gangid ][ G_MEMBERS ][ omemberid ] || sHighBountyPlayer == gData[ gangid ][ G_MEMBERS ][ omemberid ] )
  5311. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ omemberid ], gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  5312.  
  5313. // We need to set "j"'s and "i"'s colour.
  5314. else
  5315. {
  5316. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ memberid ], gData[ gangid ][ G_MEMBERS ][ omemberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  5317. SetPlayerMarkerForPlayer( gData[ gangid ][ G_MEMBERS ][ omemberid ], gData[ gangid ][ G_MEMBERS ][ memberid ], setAlpha( gData[ gangid ][ G_COLOR ], 0xAA ) );
  5318. }
  5319. }
  5320.  
  5321. SendClientMessage( gData[ gangid ][ G_MEMBERS ][ memberid ], COLOR_GREEN, gString );
  5322. }
  5323.  
  5324. }
  5325. }
  5326.  
  5327. #if VERSION_LITE == false
  5328. for ( new gZ = 0; gZ < sizeof( gZones ); gZ++ )
  5329. {
  5330. if ( gZones[ gZ ][ G_ZONE_OWNER ] == gangid )
  5331. {
  5332. gZones[ gZ ][ G_ZONE_COLOR ] = ( gData[ gangid ][ G_COLOR ] & 0xFFFFFF00 ) | 0x80;
  5333.  
  5334. GangZoneShowForAll( gZones[ gZ ][ G_ZONE_ID ], gZones[ gZ ][ G_ZONE_COLOR ] );
  5335.  
  5336. if ( gZones[ gZ ][ G_ZONE_WAR ] )
  5337. {
  5338. GangZoneFlashForAll( gZones[ gZ ][ G_ZONE_ID ], 0xFF000080 );
  5339. }
  5340. }
  5341. }
  5342. #endif
  5343.  
  5344. return 1;
  5345. }
  5346. }
  5347.  
  5348. return 0;
  5349. }
  5350.  
  5351. dcmd_hitman( playerid, params[ ] )
  5352. {
  5353. new
  5354. pMoney = GetPlayerMoney( playerid ),
  5355. idx,
  5356. tString[ MAX_CLIENT_MSG ];
  5357.  
  5358. tString = strtok( params, idx );
  5359.  
  5360. if ( tString[ 0 ] == '\0' || !strlen( params[ idx + 1 ] ) || !IsNumeric( tString ) || !IsNumeric( params[ idx + 1 ] ) )
  5361. return SendUsage( playerid, "/hitman [PLAYERID] [AMOUNT]" );
  5362.  
  5363. new
  5364. BountyID = strval( tString ),
  5365. tMoney = strval( params[ idx + 1 ] );
  5366.  
  5367. if ( !IsPlayerConnected( BountyID ) )
  5368. return SendError( playerid, "Player is not connected." );
  5369.  
  5370. else if ( pMoney < 1 || ( pMoney - tMoney ) < 0 || tMoney < 1 )
  5371. return SendError( playerid, "Invalid bounty amount." );
  5372. else if ( tMoney > 99999999 || tMoney + pData[ BountyID ][ P_BOUNTY ] > 99999999 )
  5373. return SendError( playerid, "Total bounty on player exceeds $99999999." );
  5374.  
  5375. else
  5376. {
  5377. new
  5378. pName[ MAX_PLAYER_NAME ],
  5379. bName[ MAX_PLAYER_NAME ];
  5380.  
  5381. pData[ BountyID ][ P_BOUNTY ] += tMoney;
  5382.  
  5383. AC_GivePlayerMoney( playerid, -tMoney );
  5384.  
  5385. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  5386. GetPlayerName( BountyID, bName, MAX_PLAYER_NAME );
  5387.  
  5388. format( tString, sizeof( tString ), "* %s put a $%d bounty on %s's head (Total: $%d).", pName, tMoney, bName, pData[ BountyID ][ P_BOUNTY ] );
  5389. SendClientMessageToAll( COLOR_ORANGE, tString );
  5390.  
  5391. format( tString, sizeof( tString ), "* %s (ID:%d) has put a $%d bounty on your head.", pName, playerid, tMoney );
  5392. SendClientMessage( BountyID, COLOR_RED, tString );
  5393.  
  5394. format( tString, MAX_CLIENT_MSG, "[hitman] %s %d %s %d %d %d",
  5395. pName, playerid, bName, BountyID, tMoney, pData[ BountyID ][ P_BOUNTY ]
  5396. );
  5397.  
  5398. add_log( tString );
  5399.  
  5400. if ( sHighBountyPlayer == INVALID_PLAYER_ID || pData[ BountyID ][ P_BOUNTY ] > pData[ sHighBountyPlayer ][ P_BOUNTY ] )
  5401. {
  5402. new
  5403. OldBountyID = sHighBountyPlayer;
  5404.  
  5405. sHighBountyPlayer = BountyID;
  5406.  
  5407. format( tString, sizeof( tString ), "* %s (%d) has the highest bounty ($%d). Look for the ORANGE blip.", bName, sHighBountyPlayer, pData[ sHighBountyPlayer ][ P_BOUNTY ] );
  5408. SendClientMessageToAll( COLOR_ORANGE, tString );
  5409.  
  5410. if ( sHighBountyPlayer != sRhinoOwner )
  5411. SetPlayerColor( sHighBountyPlayer, COLOR_ORANGE );
  5412.  
  5413. if ( OldBountyID != INVALID_PLAYER_ID && OldBountyID != sRhinoOwner )
  5414. {
  5415.  
  5416. if ( !IsPlayerInAnyGang( OldBountyID ) )
  5417. SetPlayerColor( OldBountyID, setAlpha( pColors[ OldBountyID ], 0x40 ) );
  5418.  
  5419. else
  5420. {
  5421. // Set the old bountyid's colour to his normal colour...
  5422.  
  5423. SetPlayerColor( OldBountyID, setAlpha( gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_COLOR ], 0x40 ) );
  5424.  
  5425. for ( new memberid = 0; memberid < gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_TOTALS ]; memberid++ )
  5426. {
  5427. if ( IsPlayerConnected( gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] ) && sRhinoOwner != gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] && sHighBountyPlayer != gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ] )
  5428. {
  5429. // If the players i and playerid are in the same gang then set the marker to the gang colour
  5430. // with an alpha of 0xAA.
  5431.  
  5432. SetPlayerMarkerForPlayer( gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], OldBountyID, setAlpha( gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  5433. SetPlayerMarkerForPlayer( OldBountyID, gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_MEMBERS ][ memberid ], setAlpha( gData[ pData[ OldBountyID ][ P_GANG_ID ] ][ G_COLOR ], 0xAA ) );
  5434. }
  5435. }
  5436. }
  5437. }
  5438. }
  5439.  
  5440. return 1;
  5441. }
  5442. }
  5443.  
  5444. dcmd_bounty( playerid, params[ ] )
  5445. {
  5446. new
  5447. pID = INVALID_PLAYER_ID;
  5448.  
  5449. if ( pData[ playerid ][ P_LEVEL ] >= 2 && !strcmp( params, "set", true, 3 ) )
  5450. {
  5451.  
  5452. /*
  5453. new
  5454. iNewAmount;
  5455.  
  5456. if( params[ 3 ] == '\0' || !IsNumeric( params ) )
  5457. return SendUsage( playerid, "/bounty [playerid] [amount]" );
  5458.  
  5459. pID = strval( params );
  5460.  
  5461. if ( !IsPlayerConnected( pID ) )
  5462. return SendError( playerid, "Player is not connected." );
  5463. */
  5464.  
  5465. return SendClientMessage( playerid, COLOR_RED, "You found an unfinished feature kthx." );
  5466. }
  5467.  
  5468. else
  5469. {
  5470. if( params[ 0 ] == '\0' || !IsNumeric( params ) )
  5471. return SendUsage( playerid, "/bounty [playerid]" );
  5472.  
  5473. pID = strval( params );
  5474.  
  5475. if ( !IsPlayerConnected( pID ) )
  5476. return SendError( playerid, "Player is not connected." );
  5477.  
  5478. new
  5479. tString[ 65 ];
  5480.  
  5481. GetPlayerName( pID, tString, MAX_PLAYER_NAME );
  5482. format( tString, 64, "* %s has a total bounty of $%d", tString, pData[ pID ][ P_BOUNTY ] );
  5483. SendClientMessage( playerid, COLOR_YELLOW, tString );
  5484.  
  5485. return 1;
  5486. }
  5487. }
  5488.  
  5489. dcmd_bounties( playerid, params[ ] )
  5490. {
  5491. #pragma unused params
  5492.  
  5493. new bString[ MAX_CLIENT_MSG ], pName[ MAX_PLAYER_NAME ], counter; bString = "* ";
  5494.  
  5495. SendClientMessage( playerid, COLOR_GREEN, "Bounties:" );
  5496.  
  5497. loopPlayers( i )
  5498. {
  5499. if ( pData[ i ][ P_BOUNTY ] )
  5500. {
  5501. GetPlayerName( i, pName, MAX_PLAYER_NAME );
  5502.  
  5503. if ( counter > 2 )
  5504. {
  5505. SendClientMessage( playerid, COLOR_YELLOW, bString );
  5506. bString = "* ";
  5507. format( bString, sizeof( bString ), "%s%s(%d)($%d), ", bString, pName, i,pData[ i ][ P_BOUNTY ] );
  5508. counter = 1;
  5509. }
  5510.  
  5511. else
  5512. {
  5513. format( bString, sizeof( bString ), "%s%s(%d)($%d), ", bString, pName, i, pData[ i ][ P_BOUNTY ] );
  5514. counter++;
  5515. }
  5516. }
  5517. }
  5518.  
  5519. if ( strlen( bString[ 2 ] ) )
  5520. SendClientMessage( playerid, COLOR_YELLOW, bString );
  5521.  
  5522. return 1;
  5523. }
  5524.  
  5525. dcmd_bank( playerid, params[ ] )
  5526. {
  5527. new
  5528. gString[ MAX_CLIENT_MSG ],
  5529. amount,
  5530. pMoney = GetPlayerMoney( playerid );
  5531.  
  5532. if ( !IsPlayerInCheckpoint( playerid ) || ( pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_S_BANK && pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_L_BANK ) )
  5533. return SendError( playerid, "You must be in a bank to use this command." );
  5534.  
  5535. else if ( params[ 0 ] == '\0' || !IsNumeric( params ) )
  5536. return SendUsage( playerid, "/bank [amount]" );
  5537.  
  5538. amount = strval( params );
  5539.  
  5540. if ( pMoney < 1 || ( pMoney - amount ) < 0 || amount < 1 )
  5541. return SendError( playerid, "Invalid transaction amount." );
  5542.  
  5543. if ( amount > pMoney )
  5544. amount = pMoney;
  5545.  
  5546. if ( pData[ playerid ][ P_BANK ] < PERSONAL_BANK_LIMIT )
  5547. {
  5548. if ( ( amount + pData[ playerid ][ P_BANK ] ) > PERSONAL_BANK_LIMIT )
  5549. amount = ( PERSONAL_BANK_LIMIT - pData[ playerid ][ P_BANK ] );
  5550. }
  5551. else
  5552. return SendError( playerid, "You cannot deposit anymore because your bank is at the maximum limit of $" #PERSONAL_BANK_LIMIT "." );
  5553.  
  5554. pData[ playerid ][ P_BANK ] += amount;
  5555. AC_GivePlayerMoney( playerid, -amount );
  5556.  
  5557. format( gString, sizeof( gString ), "* You deposited $%d, your current balance is $%d.", amount, pData[ playerid ][ P_BANK ] );
  5558. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5559.  
  5560. return 1;
  5561. }
  5562.  
  5563. dcmd_gbank( playerid, params[ ] )
  5564. {
  5565. new gString[ MAX_CLIENT_MSG ], amount, pMoney = GetPlayerMoney( playerid );
  5566.  
  5567. if ( !IsPlayerInAnyGang( playerid ) )
  5568. return SendError( playerid, "You must be in a gang to use this command." );
  5569.  
  5570. if ( !IsPlayerInCheckpoint( playerid ) || ( pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_S_BANK && pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_L_BANK ) )
  5571. return SendError( playerid, "You must be in a bank to use this command." );
  5572.  
  5573. else if ( params[ 0 ] == '\0' || !IsNumeric( params ) )
  5574. return SendUsage( playerid, "/gbank [amount]" );
  5575.  
  5576. amount = strval( params );
  5577.  
  5578. if ( pMoney < 1 || ( pMoney - amount ) < 0 || amount < 1 )
  5579. return SendError( playerid, "Invalid transaction amount." );
  5580.  
  5581. if ( amount > pMoney )
  5582. amount = pMoney;
  5583.  
  5584. if ( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] < GANG_BANK_LIMIT )
  5585. {
  5586. if ( ( amount + gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] ) > GANG_BANK_LIMIT )
  5587. amount = ( GANG_BANK_LIMIT - gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] );
  5588. }
  5589. else
  5590. return SendError( playerid, "You cannot deposit anymore because your bank is at the maximum limit of $" #GANG_BANK_LIMIT "." );
  5591.  
  5592. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] += amount;
  5593. AC_GivePlayerMoney( playerid, -amount );
  5594.  
  5595. format( gString, sizeof( gString ), "* You deposited $%d, your gangs current balance is $%d.", amount, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] );
  5596. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5597.  
  5598. return 1;
  5599. }
  5600.  
  5601. dcmd_withdraw( playerid, params[ ] )
  5602. {
  5603. new amount, gString[ MAX_CLIENT_MSG ];
  5604.  
  5605. if ( !IsPlayerInCheckpoint( playerid ) || ( pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_S_BANK && pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_L_BANK ) )
  5606. return SendError( playerid, "You must be in a bank to use this command." );
  5607.  
  5608. else if ( params[ 0 ] == '\0' || !IsNumeric( params ) )
  5609. return SendUsage( playerid, "/withdraw [amount]" );
  5610.  
  5611. amount = strval( params );
  5612.  
  5613. if ( pData[ playerid ][ P_BANK ] < 1 || ( pData[ playerid ][ P_BANK ] - amount ) < 0 || amount < 1 )
  5614. return SendError( playerid, "Invalid transaction amount." );
  5615.  
  5616. if ( amount > pData[ playerid ][ P_BANK ] )
  5617. amount = pData[ playerid ][ P_BANK ];
  5618.  
  5619. pData[ playerid ][ P_BANK ] -= amount;
  5620. AC_GivePlayerMoney( playerid, amount );
  5621.  
  5622. format( gString, sizeof( gString ), "* You withdrew $%d, your current balance is $%d.", amount, pData[ playerid ][ P_BANK ] );
  5623. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5624.  
  5625. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  5626. format( gString, sizeof( gString ), "* %s has withdrawn $%d.", gString, amount );
  5627. SendClientMessageToAdmins( 0xFF9900AA, gString );
  5628.  
  5629. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  5630. format( gString, sizeof( gString ), "[withdraw] %s %d %d", gString, playerid, amount );
  5631. add_log( gString );
  5632.  
  5633. return 1;
  5634. }
  5635.  
  5636. dcmd_gwithdraw( playerid, params[ ] )
  5637. {
  5638. new amount, gString[ MAX_CLIENT_MSG ];
  5639.  
  5640. if ( !IsPlayerInAnyGang( playerid ) )
  5641. return SendError( playerid, "You must be in a gang to use this command." );
  5642.  
  5643. if ( !IsPlayerInCheckpoint( playerid ) || ( pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_S_BANK && pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_L_BANK ) )
  5644. return SendError( playerid, "You must be in a bank to use this command." );
  5645.  
  5646. else if ( params[ 0 ] == '\0' || !IsNumeric( params ) )
  5647. return SendUsage( playerid, "/gwithdraw [amount]" );
  5648.  
  5649. amount = strval( params );
  5650.  
  5651. if ( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] < 1 || ( gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] - amount ) < 0 || amount < 1 )
  5652. return SendError( playerid, "Invalid transaction amount." );
  5653.  
  5654. if ( amount > gData[ playerid ][ G_BANK ] )
  5655. amount = gData[ playerid ][ G_BANK ];
  5656.  
  5657. gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] -= amount;
  5658. AC_GivePlayerMoney( playerid, amount );
  5659.  
  5660. format( gString, sizeof( gString ), "* You withdrew $%d, your gangs current balance is $%d.", amount, gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] );
  5661. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5662.  
  5663. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  5664. format( gString, sizeof( gString ), "* %s has gang withdrawn $%d.", gString, amount );
  5665. SendClientMessageToAdmins( 0xFF9900AA, gString );
  5666.  
  5667. GetPlayerName( playerid, gString, MAX_PLAYER_NAME );
  5668. format( gString, sizeof( gString ), "[withdraw] %s %d %d", gString, playerid, amount );
  5669. add_log( gString );
  5670.  
  5671. return 1;
  5672. }
  5673.  
  5674. dcmd_balance( playerid, params[ ] )
  5675. {
  5676. #pragma unused params
  5677.  
  5678. new
  5679. gString[ MAX_CLIENT_MSG ];
  5680.  
  5681. if ( !IsPlayerInCheckpoint( playerid ) || ( pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_S_BANK && pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_L_BANK ) )
  5682. return SendError( playerid, "You must be in a bank to use this command." );
  5683.  
  5684. format( gString, sizeof( gString ), "* Your current bank balance is $%d.", pData[ playerid ][ P_BANK ] );
  5685. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5686.  
  5687. return 1;
  5688. }
  5689.  
  5690. dcmd_gbalance( playerid, params[ ] )
  5691. {
  5692. #pragma unused params
  5693.  
  5694. new gString[ MAX_CLIENT_MSG ];
  5695.  
  5696. if ( !IsPlayerInAnyGang( playerid ) )
  5697. return SendError( playerid, "You must be in a gang to use this command." );
  5698.  
  5699. if ( !IsPlayerInCheckpoint( playerid ) || ( pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_S_BANK && pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_L_BANK ) )
  5700. return SendError( playerid, "You must be in a bank to use this command." );
  5701.  
  5702. format( gString, sizeof( gString ), "* Your gangs current bank balance is $%d.", gData[ pData[ playerid ][ P_GANG_ID ] ][ G_BANK ] );
  5703. SendClientMessage( playerid, COLOR_YELLOW, gString );
  5704.  
  5705. return 1;
  5706. }
  5707.  
  5708.  
  5709. dcmd_givecash( playerid, params[ ] )
  5710. {
  5711. new pMoney = GetPlayerMoney( playerid ), idx, tString[ MAX_CLIENT_MSG ], rName[ MAX_PLAYER_NAME ], pName[ MAX_PLAYER_NAME ], ReceiveID, tMoney;
  5712.  
  5713. tString = strtok( params, idx );
  5714.  
  5715. if ( tString[ 0 ] == '\0' || !strlen( params[ idx + 1 ] ) || !IsNumeric( tString ) || !IsNumeric( params[ idx + 1 ] ) )
  5716. return SendUsage( playerid, "/givecash [PLAYERID] [AMOUNT]" );
  5717.  
  5718. ReceiveID = strval( tString );
  5719. tMoney = strval( params[ idx + 1 ] );
  5720.  
  5721. if ( !IsPlayerConnected( ReceiveID ) )
  5722. return SendError( playerid, "This player is not connected." );
  5723.  
  5724. else if ( tMoney > 500000 )
  5725. return SendError( playerid, "You may not give more than $500000 at a time." );
  5726.  
  5727. else if ( pMoney < 0 || ( pMoney - tMoney ) < 0 || tMoney < 1 )
  5728. return SendError( playerid, "Invalid transaction amount." );
  5729.  
  5730. else if ( ReceiveID == playerid )
  5731. return SendError( playerid, "You can't send money to yourself!" );
  5732.  
  5733. else
  5734. {
  5735. AC_GivePlayerMoney( ReceiveID, tMoney );
  5736. AC_GivePlayerMoney( playerid, -tMoney );
  5737.  
  5738. GetPlayerName( playerid, pName, MAX_PLAYER_NAME );
  5739. format( tString, sizeof( tString ), "* %s (%d) has sent you $%d.", pName, playerid, tMoney );
  5740. SendClientMessage( ReceiveID, COLOR_YELLOW, tString );
  5741.  
  5742. GetPlayerName( ReceiveID, rName, MAX_PLAYER_NAME );
  5743. format( tString, sizeof( tString ), "* You have sent $%d to %s (%d).", tMoney, rName, ReceiveID );
  5744. SendClientMessage( playerid, COLOR_YELLOW, tString );
  5745.  
  5746. format( tString, sizeof( tString ), "* %s (%d) has sent %s (%d) $%d.", pName, playerid, rName, ReceiveID, tMoney );
  5747. SendClientMessageToAdmins( 0xFF9900AA, tString );
  5748.  
  5749. format( tString, sizeof( tString ), "[givecash] %s %d %d %s %d", pName, playerid, tMoney, rName, ReceiveID );
  5750. add_log( tString );
  5751.  
  5752. return 1;
  5753. }
  5754. }
  5755.  
  5756. dcmd_buy( playerid, params[ ] )
  5757. {
  5758. #pragma unused params
  5759.  
  5760. new pString[ MAX_CLIENT_MSG ], pMoney = GetPlayerMoney( playerid ), tPropertyID;
  5761.  
  5762. if ( !IsPlayerInCheckpoint( playerid ) || pData[ playerid ][ P_CHECKPOINT_AREA ] < _:CP_ZIP )
  5763. return SendError( playerid, "You must be in a property checkpoint to use this command." );
  5764.  
  5765. tPropertyID = pData[ playerid ][ P_CHECKPOINT_AREA ] - _:CP_ZIP;
  5766.  
  5767. if ( !gPropertyData[ tPropertyID ][ PROPERTY_CAN_BE_BOUGHT ] )
  5768. return SendError( playerid, "This property is not for sale right now. Please come back later." );
  5769.  
  5770. else if ( pMoney < gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] )
  5771. return SendError( playerid, "You do not have enough money to purchase this property." );
  5772.  
  5773. else if ( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] == playerid )
  5774. return SendError( playerid, "You already own this property." );
  5775.  
  5776. else
  5777. {
  5778. if ( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  5779. {
  5780. GetPlayerName( playerid, pString, MAX_PLAYER_NAME );
  5781. format( pString, sizeof( pString ), "* Your property, the %s has been bought out by %s (ID:%d).", gPropertyData[ tPropertyID ][ PROPERTY_NAME ], pString, playerid );
  5782. SendClientMessage( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ], COLOR_ORANGE, pString );
  5783. AC_GivePlayerMoney( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ], gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] );
  5784. }
  5785.  
  5786. gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] = playerid;
  5787. gPropertyData[ tPropertyID ][ PROPERTY_CAN_BE_BOUGHT ] = 0;
  5788. gPropertyData[ tPropertyID ][ PROPERTY_TICKS ] = gPropertyData[ tPropertyID ][ PROPERTY_TIME ];
  5789.  
  5790. AC_GivePlayerMoney( playerid, -gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] );
  5791. format( pString, sizeof( pString ), "* You have purchased %s!", gPropertyData[ tPropertyID ][ PROPERTY_NAME ] );
  5792. SendClientMessage( playerid, COLOR_GREEN, pString );
  5793. }
  5794. //LnX
  5795. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5796. lredraw(1);
  5797. #endif
  5798.  
  5799. return 1;
  5800.  
  5801. }
  5802. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  5803. dcmd_clear( playerid, params[ ] )
  5804. {
  5805. #pragma unused params
  5806.  
  5807. lclear(playerid);
  5808. lvisiblemessage[playerid] = 0;
  5809. return 1;
  5810. }
  5811. #endif
  5812.  
  5813. dcmd_sell( playerid, params[ ] )
  5814. {
  5815. #pragma unused params
  5816.  
  5817. new pString[ MAX_CLIENT_MSG ], tPropertyID;
  5818.  
  5819. if ( !IsPlayerInCheckpoint( playerid ) || pData[ playerid ][ P_CHECKPOINT_AREA ] < _:CP_ZIP )
  5820. return SendError( playerid, "You must be in a property checkpoint to use this command." );
  5821.  
  5822. tPropertyID = pData[ playerid ][ P_CHECKPOINT_AREA ] - _:CP_ZIP;
  5823.  
  5824. if ( gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] != playerid )
  5825. return SendError( playerid, "You can not sell a property you don't own." );
  5826.  
  5827. else
  5828. {
  5829. gPropertyData[ tPropertyID ][ PROPERTY_OWNER ] = INVALID_PLAYER_ID;
  5830. gPropertyData[ tPropertyID ][ PROPERTY_CAN_BE_BOUGHT ] = 1;
  5831.  
  5832. AC_GivePlayerMoney( playerid, gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] );
  5833.  
  5834. format( pString, sizeof( pString ), "* You have sold %s and gained $%d!", gPropertyData[ tPropertyID ][ PROPERTY_NAME ], gPropertyData[ tPropertyID ][ PROPERTY_PRICE ] );
  5835. SendClientMessage( playerid, COLOR_GREEN, pString );
  5836. }
  5837.  
  5838. return 1;
  5839. }
  5840.  
  5841. dcmd_wdisable( playerid, params[ ] )
  5842. {
  5843. #pragma unused params
  5844.  
  5845. SendClientMessage ( playerid, COLOR_WHITE, "- Bad weapons unsynced." );
  5846. SetDisabledWeapons (
  5847. 1, 4, 6, 7, 8, 9,
  5848. 14, 15, 35, 36, 37,
  5849. 38, 39, 41, 43, 44, 45
  5850. );
  5851.  
  5852. return 1;
  5853. }
  5854.  
  5855. dcmd_wenable( playerid,params[ ] )
  5856. {
  5857. #pragma unused params
  5858.  
  5859. SendClientMessage ( playerid, COLOR_WHITE, "- Bad weapons resynced." );
  5860. SetDisabledWeapons ( );
  5861.  
  5862. return 1;
  5863. }
  5864.  
  5865. dcmd_buyweapon( playerid, params[ ] )
  5866. {
  5867. new
  5868. wString[ 65 ],
  5869. idx,
  5870. weaponid,
  5871. pMoney = GetPlayerMoney( playerid ),
  5872. weaponslot,
  5873. wprice;
  5874.  
  5875. wString = strtok( params, idx );
  5876.  
  5877. if ( !strlen( params[ idx + 1 ] ) || wString[ 0 ] == '\0' || !IsNumeric( params[ idx + 1 ] ) || !IsNumeric( wString ) )
  5878. return SendUsage( playerid, "/buyweapon [weapon_number] [weapon_amount]" );
  5879.  
  5880. weaponid = strval( wString );
  5881. idx = strval( params[ idx + 1 ] ); // Ammo
  5882. weaponslot = GetWeaponSlot( weaponid );
  5883. wprice = floatround( floatmul( floatmul( sWeapons[ weaponid ][ WEAPON_PRICE ], SPAWN_PRICE_RATIO ), idx ), floatround_round );
  5884.  
  5885. if ( !IsPlayerInCheckpoint( playerid ) || pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_M_AMMUNATION )
  5886. return SendError( playerid, "You need to be in Ammunation to purchase weapons." );
  5887.  
  5888. if ( ( sWeapons[ weaponid ][ WEAPON_AMMO ] * idx ) > 9999 || ( pData[ playerid ][ P_SPAWN_AMMO ][ weaponslot ] + ( sWeapons[ weaponid ][ WEAPON_AMMO ] * idx) > 9999 ) )
  5889. return SendError( playerid, "The shop refuses to sell you anymore spawnweapons to you (AmmoLimit: 9999)." );
  5890.  
  5891. if ( pMoney < wprice )
  5892. return SendError( playerid, "You don't have enough money to purchase this many weapons." );
  5893.  
  5894. if ( weaponid < 0 || weaponid > sizeof( sWeapons ) - 1 || !sWeapons[ weaponid ][ WEAPON_SPAWN_WEAPON ] || weaponslot == WEAPON_NOSLOT )
  5895. return SendError( playerid, "Invalid weapon id." );
  5896.  
  5897. if ( idx < 1 )
  5898. return SendError( playerid, "Invalid weapon amount." );
  5899.  
  5900. format( wString, sizeof( wString ), "You purchased %d %s's for when you spawn ($%d).", idx, sWeapons[ weaponid ][ WEAPON_NAME ], wprice );
  5901. SendClientMessage( playerid, COLOR_GREEN, wString );
  5902.  
  5903. AC_GivePlayerMoney( playerid, -wprice );
  5904.  
  5905. #if MODE_PROTECTED_WEAPONS != 2
  5906. GivePlayerWeapon( playerid, weaponid, sWeapons[ weaponid ][ WEAPON_AMMO ] * idx );
  5907. #endif
  5908.  
  5909. pData[ playerid ][ P_TEMP_WEAPONS ][ weaponslot ] = weaponid;
  5910. pData[ playerid ][ P_TEMP_AMMO ][ weaponslot ] += ( sWeapons[ weaponid ][ WEAPON_AMMO ] * idx );
  5911.  
  5912. pData[ playerid ][ P_SPAWN_WEAPONS ][ weaponslot ] = weaponid;
  5913. pData[ playerid ][ P_SPAWN_AMMO ][ weaponslot ] += ( sWeapons[ weaponid ][ WEAPON_AMMO ] * idx );
  5914.  
  5915. return 1;
  5916. }
  5917.  
  5918. dcmd_mute( playerid, params[ ] )
  5919. {
  5920. new
  5921. mString[ MAX_CLIENT_MSG ],
  5922. MuteID,
  5923. idx;
  5924.  
  5925. mString = strtok( params, idx );
  5926.  
  5927. if( mString[ 0 ] == '\0' || !IsNumeric( mString ) || !strlen( params[ idx + 1 ] ) )
  5928. return SendUsage( playerid, "/mute [playerid] [reason]" );
  5929.  
  5930. MuteID = strval( mString );
  5931.  
  5932. if ( !IsPlayerConnected( MuteID ) )
  5933. return SendError( playerid, "Player is not connected." );
  5934.  
  5935. else if ( pData[ playerid ][ P_LEVEL ] <= pData[ MuteID ][ P_LEVEL ] && !IsPlayerAdmin( playerid ) )
  5936. return SendError( playerid, "You cannot mute a player whose level is higher or the same level as your own." );
  5937.  
  5938. else if( pData[ MuteID ][ P_MUTE ] )
  5939. return SendError( playerid, "Player is already muted." );
  5940.  
  5941. GetPlayerName( MuteID, mString, MAX_PLAYER_NAME );
  5942. format( mString, sizeof ( mString ), "%s (ID: %d) has been muted for: %s", mString, MuteID, params[ idx + 1 ] );
  5943. SendClientMessageToAll( COLOR_ORANGE, mString );
  5944.  
  5945. pData[ MuteID ][ P_MUTE ] = 1;
  5946.  
  5947. return 1;
  5948. }
  5949.  
  5950. dcmd_unmute( playerid, params[ ] )
  5951. {
  5952. new
  5953. uString[ MAX_CLIENT_MSG ],
  5954. MuteID;
  5955.  
  5956. if( params[ 0 ] == '\0' || !IsNumeric( params ) )
  5957. return SendUsage( playerid, "/unmute [playerid]" );
  5958.  
  5959. MuteID = strval( params );
  5960.  
  5961. if ( !IsPlayerConnected( MuteID ) )
  5962. return SendError( playerid, "Player is not connected." );
  5963.  
  5964. else if( !pData[ MuteID ][ P_MUTE ] )
  5965. return SendError( playerid, "Player is not muted." );
  5966.  
  5967. GetPlayerName( MuteID, uString, MAX_PLAYER_NAME );
  5968. format( uString, sizeof( uString ), "%s (ID: %d) has been unmuted.", uString, MuteID );
  5969. SendClientMessageToAll( COLOR_ORANGE, uString );
  5970.  
  5971. pData[ MuteID ][ P_MUTE ] = 0;
  5972.  
  5973. return 1;
  5974. }
  5975.  
  5976. dcmd_muteall( playerid, params[ ] )
  5977. {
  5978. #pragma unused params
  5979. #pragma unused playerid
  5980.  
  5981. sMute = 1;
  5982. SendClientMessageToAll( COLOR_ORANGE, "All players have been muted" );
  5983.  
  5984. return 1;
  5985. }
  5986.  
  5987. dcmd_unmuteall( playerid, params[ ] )
  5988. {
  5989. #pragma unused params
  5990. #pragma unused playerid
  5991.  
  5992. sMute = 0;
  5993. SendClientMessageToAll( COLOR_ORANGE, "All players have been unmuted" );
  5994.  
  5995. return 1;
  5996. }
  5997.  
  5998. dcmd_mutelist( playerid, params[ ] )
  5999. {
  6000. #pragma unused params
  6001.  
  6002. new str[ 65 ];
  6003. SendClientMessage( playerid, COLOR_ORANGE, "The following player(s) is/are muted:" );
  6004.  
  6005. loopPlayers( i )
  6006. {
  6007. if ( pData[ i ][ P_MUTE ] )
  6008. {
  6009. GetPlayerName( i, str, MAX_PLAYER_NAME );
  6010. format( str, sizeof( str ), "%s (%d)", str, i );
  6011. SendClientMessage(playerid, COLOR_GREEN, str);
  6012. }
  6013. }
  6014.  
  6015. return 1;
  6016. }
  6017.  
  6018. dcmd_weaponlist( playerid, params[ ] )
  6019. {
  6020. #pragma unused params
  6021.  
  6022. new wString[ MAX_CLIENT_MSG ];
  6023.  
  6024. if ( !IsPlayerInCheckpoint( playerid ) || pData[ playerid ][ P_CHECKPOINT_AREA ] != _:CP_M_AMMUNATION )
  6025. return SendError( playerid, "You need to be in Ammunation to see the weapon list." );
  6026.  
  6027. if ( params[ 0 ] == '\0' || params[ 1 ] != '\0' )
  6028. return SendUsage( playerid, "/weaponlist [1-2]" );
  6029.  
  6030. switch ( params[ 0 ] )
  6031. {
  6032. case '2':
  6033. {
  6034. SendClientMessage( playerid, COLOR_GREEN, "Weapon List 2:" );
  6035.  
  6036. for ( new i = 7; i < 14; i++ )
  6037. {
  6038. if ( sWeapon[ i ] )
  6039. {
  6040. format( wString, sizeof( wString ), "* %d - %s - $%d - Ammo: %d", sWeapon[ i ], sWeapons[ sWeapon[ i ] ][ WEAPON_NAME ], floatround( floatmul( sWeapons[ sWeapon[ i ] ][ WEAPON_PRICE ], SPAWN_PRICE_RATIO ), floatround_round ), sWeapons[ sWeapon[ i ] ][ WEAPON_AMMO ] );
  6041. SendClientMessage( playerid, COLOR_YELLOW, wString );
  6042. }
  6043. }
  6044. }
  6045.  
  6046. case '1':
  6047. {
  6048. SendClientMessage( playerid, COLOR_GREEN, "Weapon List 1:" );
  6049.  
  6050. for ( new i = 0; i < 7; i++ )
  6051. {
  6052. if ( sWeapon[ i ] )
  6053. {
  6054. format( wString, sizeof( wString ), "* %d - %s - $%d - Ammo: %d", sWeapon[ i ], sWeapons[ sWeapon[ i ] ][ WEAPON_NAME ], floatround( floatmul( sWeapons[ sWeapon[ i ] ][ WEAPON_PRICE ], SPAWN_PRICE_RATIO ), floatround_round ), sWeapons[ sWeapon[ i ] ][ WEAPON_AMMO ] );
  6055. SendClientMessage( playerid, COLOR_YELLOW, wString );
  6056. }
  6057. }
  6058. }
  6059.  
  6060. default: return SendUsage( playerid, "/weaponlist [1-2]" );
  6061. }
  6062.  
  6063. return 1;
  6064. }
  6065.  
  6066. dcmd_properties( playerid, params[ ] )
  6067. {
  6068.  
  6069.  
  6070. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  6071. #pragma unused params
  6072.  
  6073. lclear(playerid);
  6074. lshowmessage(playerid, lprops[0]);
  6075. lshowmessage(playerid, lprops[1]);
  6076. lshowmessage(playerid, lprops[2]);
  6077. lvisiblemessage[playerid] = 1;
  6078.  
  6079. return 1;
  6080. #else
  6081. new pString[ MAX_CLIENT_MSG ];
  6082.  
  6083. if ( params[ 0 ] == '1' && params[ 1 ] == '\0' )
  6084. {
  6085. SendClientMessage( playerid, COLOR_GREEN, "Properties 1:" );
  6086.  
  6087. for ( new i = 0; i < 7; i++ )
  6088. {
  6089. if ( gPropertyData[ i ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  6090. {
  6091. GetPlayerName( gPropertyData[ i ][ PROPERTY_OWNER ], pString, MAX_PLAYER_NAME );
  6092. format( pString, sizeof( pString ),"* %s is owned by %s", gPropertyData[ i ][ PROPERTY_NAME ], pString );
  6093. SendClientMessage( playerid, COLOR_YELLOW, pString );
  6094. }
  6095. else
  6096. {
  6097. format( pString, sizeof( pString ),"* %s has no owner.", gPropertyData[ i ][ PROPERTY_NAME ] );
  6098. SendClientMessage( playerid, COLOR_ORANGE, pString );
  6099. }
  6100. }
  6101. return 1;
  6102. }
  6103.  
  6104. else if ( params[ 0 ] == '2' && params[ 1 ] == '\0' )
  6105. {
  6106. SendClientMessage( playerid, COLOR_GREEN, "Properties 2:" );
  6107.  
  6108. for ( new i = 7; i < 14; i++ )
  6109. {
  6110. if ( gPropertyData[ i ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  6111. {
  6112. GetPlayerName( gPropertyData[ i ][ PROPERTY_OWNER ], pString, MAX_PLAYER_NAME );
  6113. format( pString, sizeof( pString ),"* %s is owned by %s", gPropertyData[ i ][ PROPERTY_NAME ], pString );
  6114. SendClientMessage( playerid, COLOR_YELLOW, pString );
  6115. }
  6116. else
  6117. {
  6118. format( pString, sizeof( pString ),"* %s has no owner.", gPropertyData[ i ][ PROPERTY_NAME ] );
  6119. SendClientMessage( playerid, COLOR_ORANGE, pString );
  6120. }
  6121. }
  6122. return 1;
  6123. }
  6124. else if ( params[ 0 ] == '3' && params[ 1 ] == '\0' )
  6125. {
  6126. SendClientMessage( playerid, COLOR_GREEN, "Properties 3:" );
  6127.  
  6128. for ( new i = 14; i < 21; i++ )
  6129. {
  6130. if ( gPropertyData[ i ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  6131. {
  6132. GetPlayerName( gPropertyData[ i ][ PROPERTY_OWNER ], pString, MAX_PLAYER_NAME );
  6133. format( pString, sizeof( pString ),"* %s is owned by %s", gPropertyData[ i ][ PROPERTY_NAME ], pString );
  6134. SendClientMessage( playerid, COLOR_YELLOW, pString );
  6135. }
  6136. else
  6137. {
  6138. format( pString, sizeof( pString ),"* %s has no owner.", gPropertyData[ i ][ PROPERTY_NAME ] );
  6139. SendClientMessage( playerid, COLOR_ORANGE, pString );
  6140. }
  6141. }
  6142. return 1;
  6143. }
  6144. else if ( params[ 0 ] == '4' && params[ 1 ] == '\0' )
  6145. {
  6146. SendClientMessage( playerid, COLOR_GREEN, "Properties 4:" );
  6147.  
  6148. for ( new i = 21; i < sizeof( gPropertyData ); i++ )
  6149. {
  6150. if ( gPropertyData[ i ][ PROPERTY_OWNER ] != INVALID_PLAYER_ID )
  6151. {
  6152. GetPlayerName( gPropertyData[ i ][ PROPERTY_OWNER ], pString, MAX_PLAYER_NAME );
  6153. format( pString, sizeof( pString ),"* %s is owned by %s", gPropertyData[ i ][ PROPERTY_NAME ], pString );
  6154. SendClientMessage( playerid, COLOR_YELLOW, pString );
  6155. }
  6156. else
  6157. {
  6158. format( pString, sizeof( pString ),"* %s has no owner.", gPropertyData[ i ][ PROPERTY_NAME ] );
  6159. SendClientMessage( playerid, COLOR_ORANGE, pString );
  6160. }
  6161. }
  6162. return 1;
  6163. }
  6164. else
  6165. return SendUsage( playerid, "/properties [1-4]" );
  6166. #endif
  6167. }
  6168.  
  6169. //==============================================================================
  6170.  
  6171. stock Text:CreateBankText( playerid )
  6172. {
  6173. new
  6174. bString[ 64 ],
  6175. Text: tmpTextDraw;
  6176.  
  6177. format( bString, sizeof( bString ), "~g~Personal: ~w~$%09d", pData[ playerid ][ P_BANK ] );
  6178.  
  6179. if ( pData[ playerid ][ P_BANK_TEXT ] == INVALID_TEXT_DRAW )
  6180. {
  6181. tmpTextDraw = TextDrawCreate( 240.0, 327.5, bString );
  6182.  
  6183. TextDrawFont( tmpTextDraw, 1 );
  6184. TextDrawSetOutline( tmpTextDraw, 1 );
  6185. TextDrawSetProportional( tmpTextDraw, 1 );
  6186. TextDrawAlignment( tmpTextDraw, 3 );
  6187. TextDrawHideForAll( tmpTextDraw );
  6188.  
  6189. return
  6190. tmpTextDraw;
  6191. }
  6192. else
  6193. {
  6194. TextDrawSetString( pData[ playerid ][ P_BANK_TEXT ], bString );
  6195.  
  6196. return
  6197. pData[ playerid ][ P_BANK_TEXT ];
  6198. }
  6199. }
  6200.  
  6201. stock Text:CreateGangBankText( gangid )
  6202. {
  6203. new
  6204. bString [ 64 ],
  6205. Text: tmpTextDraw;
  6206.  
  6207. format( bString, sizeof( bString ), "~g~Gang:~w~ $%09d", gData[ gangid ][ G_BANK ] );
  6208.  
  6209. if ( gData[ gangid ][ G_BANK_TEXT ] == INVALID_TEXT_DRAW )
  6210. {
  6211. tmpTextDraw = TextDrawCreate( 240.0, 337.5, bString );
  6212.  
  6213. TextDrawFont( tmpTextDraw, 1 );
  6214. TextDrawSetOutline( tmpTextDraw, 1 );
  6215. TextDrawSetProportional( tmpTextDraw, 1 );
  6216. TextDrawAlignment( tmpTextDraw, 3 );
  6217. TextDrawHideForAll( tmpTextDraw );
  6218.  
  6219. return
  6220. tmpTextDraw;
  6221. }
  6222. else
  6223. {
  6224. TextDrawSetString( gData[ gangid ][ G_BANK_TEXT ], bString );
  6225.  
  6226. return
  6227. gData[ gangid ][ G_BANK_TEXT ];
  6228. }
  6229.  
  6230.  
  6231. }
  6232.  
  6233. stock Text:CreateTerritoryText( name[ ] )
  6234. {
  6235. new
  6236. tString[ 128 ];
  6237.  
  6238. tString = "~r~";
  6239.  
  6240. for ( new i = 0; name[ i ] != '\0'; i++ )
  6241. {
  6242. if ( isprint( name[ i ] ) && name[ i ] != '~' )
  6243. tString[ ( i + 3 ) ] = name[ i ];
  6244.  
  6245. else
  6246. tString[ ( i + 3 ) ] = ' ';
  6247. }
  6248.  
  6249. strcat( tString, "'s ~s~Territory" );
  6250.  
  6251. new
  6252. Text:tmpTextDraw = TextDrawCreate( 615.0, 400.0, tString );
  6253.  
  6254. TextDrawFont ( tmpTextDraw, 1 );
  6255. TextDrawSetOutline ( tmpTextDraw, 1 );
  6256. TextDrawSetProportional ( tmpTextDraw, 1 );
  6257. TextDrawAlignment ( tmpTextDraw, 3 );
  6258. TextDrawHideForAll ( tmpTextDraw );
  6259.  
  6260. return
  6261. tmpTextDraw;
  6262. }
  6263.  
  6264. stock add_log( text[ ] )
  6265. {
  6266. new
  6267. File:fp = fopen( "echo.txt", io_append ),
  6268. tmp[ 1024 ];
  6269.  
  6270. if ( fp )
  6271. {
  6272. format( tmp, 1024, "%s\n", text );
  6273. fwrite( fp, tmp );
  6274. fclose( fp );
  6275. }
  6276. }
  6277.  
  6278. stock SendMessageToLevelAndHigher( level, color, msg[ ] )
  6279. {
  6280. loopPlayers( i )
  6281. {
  6282. if ( IsPlayerAdmin( i ) || pData[ i ][ P_LEVEL ] >= level )
  6283. SendClientMessage( i, color, msg );
  6284. }
  6285. }
  6286.  
  6287. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  6288. // Territory Functions
  6289.  
  6290. stock AddGangZone( Float:minx, Float:miny, Float:maxx, Float:maxy )
  6291. {
  6292. for ( new i = 0; i < MAX_SCRIPT_ZONES; i++ )
  6293. {
  6294. if( gZones[ i ][ G_ZONE_ID ] == INVALID_GANG_ZONE )
  6295. {
  6296. gZones[ i ][ G_ZONE_TEXT ] = TEXT_NoZoneOwner;
  6297. gZones[ i ][ G_ZONE_ID ] = GangZoneCreate( minx, miny, maxx, maxy );
  6298. gZones[ i ][ G_ZONE_OWNER ] = 255;
  6299. gZones[ i ][ G_ZONE_COLOR ] = COLOR_ZONE_DEFAULT;
  6300. gZones[ i ][ G_ZONE_WAR ] = 0;
  6301. gZones[ i ][ G_ZONE_TIMER ] = 0;
  6302. gZones[ i ][ G_ZONE_MINX ] = minx;
  6303. gZones[ i ][ G_ZONE_MINY ] = miny;
  6304. gZones[ i ][ G_ZONE_MAXX ] = maxx;
  6305. gZones[ i ][ G_ZONE_MAXY ] = maxy;
  6306.  
  6307. return i;
  6308. }
  6309. }
  6310. return INVALID_GANG_ZONE;
  6311. }
  6312.  
  6313. stock DestroyGangZone( zoneid )
  6314. {
  6315. gZones[ i ][ G_ZONE_TEXT ] = INVALID_TEXT_DRAW;
  6316. gZones[ i ][ G_ZONE_ID ] = INVALID_GANG_ZONE;
  6317. gZones[ i ][ G_ZONE_OWNER ] = 255;
  6318. gZones[ i ][ G_ZONE_COLOR ] = COLOR_ZONE_DEFAULT;
  6319. gZones[ i ][ G_ZONE_WAR ] = 0;
  6320. gZones[ i ][ G_ZONE_TIMER ] = 0;
  6321. gZones[ i ][ G_ZONE_MINX ] = 0.0;
  6322. gZones[ i ][ G_ZONE_MINY ] = 0.0;
  6323. gZones[ i ][ G_ZONE_MAXX ] = 0.0;
  6324. gZones[ i ][ G_ZONE_MAXY ] = 0.0;
  6325.  
  6326. return 1;
  6327. }
  6328.  
  6329. stock SetGangZoneColor( zoneid, color )
  6330. {
  6331. GangZoneHideForAll( zoneid );
  6332. GangZoneShowForAll( zoneid, color );
  6333.  
  6334. gZones[ zoneid ][ G_ZONE_COLOR ] = color;
  6335.  
  6336. return 1;
  6337. }
  6338.  
  6339. stock GangZoneShowForAllEx( zone, color )
  6340. {
  6341. loopPlayers( i )
  6342. {
  6343. GangZoneHideForPlayer( i, zone );
  6344. GangZoneShowForPlayer( i, zone, color );
  6345. }
  6346. }
  6347.  
  6348. stock GangZoneHideForAllEx( zone )
  6349. {
  6350. loopPlayers( i )
  6351. GangZoneHideForPlayer( i, zone );
  6352. }
  6353.  
  6354. #if VERSION_LITE == false
  6355. stock StartGangWar( zoneid, tick = 300, time = 60000 )
  6356. {
  6357. GangZoneFlashForAll( zoneid, 0xFF000080 );
  6358.  
  6359. for ( new gID = 0; gID < MAX_GANGS; gID++ )
  6360. {
  6361. if ( gData[ gID ][ G_TOTALS ] )
  6362. {
  6363. zTicks[ gID ][ zoneid ][ 0 ] = tick;
  6364. zDeaths[ gID ][ zoneid ][ 0 ] = zDeaths[ gID ][ zoneid ][ 1 ] = 0;
  6365. }
  6366. }
  6367.  
  6368. gZones[ zoneid ][ G_ZONE_WAR ] = 1;
  6369. gZones[ zoneid ][ G_ZONE_TIMER ]= SetTimerEx( "EndGangWar", TURF_WAR_TIME, 0, "i", zoneid );
  6370.  
  6371. return 1;
  6372. }
  6373.  
  6374.  
  6375. public EndGangWar( zoneid )
  6376. {
  6377. // If timerid for EndGangWar in this zoneid
  6378. // is valid then kill the timer and set it to 0 (invalid).
  6379. if ( gZones[ zoneid ][ G_ZONE_TIMER ] )
  6380. {
  6381. KillTimer( gZones[ zoneid ][ G_ZONE_TIMER ] );
  6382. gZones[ zoneid ][ G_ZONE_TIMER ] = 0;
  6383. }
  6384.  
  6385. // Create a variable for winning gangid and a temporary score of the winner / current checking team.
  6386. new newOwner = gZones[ zoneid ][ G_ZONE_OWNER ], tmpScore[ 2 ];
  6387.  
  6388. for ( new gID = 0; gID < MAX_GANGS; gID++ )
  6389. {
  6390. // If the gang is not valid then continue.
  6391. if ( !IsValidGang( gID ) )
  6392. continue;
  6393.  
  6394. // Current checking team score is equal to:
  6395. // ( Kills in Zone - Deaths in Zone ) + Players in Zone
  6396. tmpScore[ 1 ] = ( zDeaths[ gID ][ zoneid ][ 0 ] - zDeaths[ gID ][ zoneid ][ 1 ] ) + zTicks[ gID ][ zoneid ][ 1 ];
  6397.  
  6398. // If tmpScore for current checking team is greater than the current winner,
  6399. // then set the winner to the this gangid and assign the current score to the winners score.
  6400. if ( tmpScore[ 1 ] > tmpScore[ 0 ] )
  6401. {
  6402. newOwner = gID;
  6403. tmpScore[ 0 ] = tmpScore[ 1 ];
  6404. }
  6405.  
  6406. // Ticks in zone for gang is equal to 0.
  6407. zTicks[ gID ][ zoneid ][ 0 ] = 0;
  6408.  
  6409. // Kills and Deaths in zone is equal to 0.
  6410. zDeaths[ gID ][ zoneid ][ 0 ] = zDeaths[ gID ][ zoneid ][ 1 ] = 0;
  6411. }
  6412.  
  6413. // If there is no-one in the winning gang then reset gangzone to defaults.
  6414. if ( !gData[ newOwner ][ G_TOTALS ] )
  6415. {
  6416. gZones[ zoneid ][ G_ZONE_OWNER ] = INVALID_GANG_ID;
  6417. gZones[ zoneid ][ G_ZONE_COLOR ] = COLOR_ZONE_DEFAULT;
  6418. gZones[ zoneid ][ G_ZONE_TEXT ] = TEXT_NoZoneOwner;
  6419. }
  6420.  
  6421. // Else if the current owner is not the winner OR the winner is an INVALID_GANG_ID.
  6422. else if ( gZones[ zoneid ][ G_ZONE_OWNER ] != newOwner )
  6423. {
  6424. #define WAR_WINNER_MONEY 1000
  6425.  
  6426. new gString[ MAX_CLIENT_MSG ],
  6427. gPrize = ( tmpScore[ 0 ] > 30 ? WAR_WINNER_MONEY * 30 : WAR_WINNER_MONEY * tmpScore[ 0 ] );
  6428.  
  6429. format( gString, sizeof( gString ), "* $%d was deposited into your gangs bank account for taking the turf.", gPrize );
  6430. gData[ newOwner ][ G_BANK ] += gPrize;
  6431.  
  6432. // Loop through all players and check if they're in the gang zone, if they
  6433. // are then hide the current zone text.
  6434. loopPlayers( pID )
  6435. {
  6436. if ( pData[ pID ][ P_GANG_ZONE ] == zoneid )
  6437. {
  6438. TextDrawHideForPlayer( pID, gZones[ zoneid ][ G_ZONE_TEXT ] );
  6439. TextDrawShowForPlayer( pID, gData[ newOwner ][ G_ZONE_TEXT ] );
  6440. }
  6441. if ( IsPlayerInGang( pID, newOwner ) )
  6442. SendClientMessage( pID, COLOR_GREEN, gString );
  6443. }
  6444.  
  6445. // Create a new variable for the old owner.
  6446. new
  6447. oldOwner = gZones[ zoneid ][ G_ZONE_OWNER ];
  6448.  
  6449. // Set the zone status to the new winners.
  6450. gZones[ zoneid ][ G_ZONE_OWNER ] = newOwner;
  6451. gZones[ zoneid ][ G_ZONE_COLOR ] = ( gData[ newOwner ][ G_COLOR ] & 0xFFFFFF00 ) | 0x80;
  6452. gZones[ zoneid ][ G_ZONE_TEXT ] = gData[ newOwner ][ G_ZONE_TEXT ];
  6453.  
  6454. // Show oldOwners that their turf was lost.
  6455. TextDrawShowForGang( oldOwner, TEXT_TurfLost );
  6456.  
  6457. // Show newOwners that they claimed the turf.
  6458. TextDrawShowForGang( newOwner, TEXT_TurfIsYours );
  6459.  
  6460. // Hide text draw for old owners after 10 seconds.
  6461. SetTimerEx( "TextDrawHideForGang", 10000, 0, "ii", oldOwner, _:TEXT_TurfLost );
  6462.  
  6463. // Hide text draw for new owners after 10 seconds.
  6464. SetTimerEx( "TextDrawHideForGang", 10000, 0, "ii", newOwner, _:TEXT_TurfIsYours );
  6465.  
  6466. #undef WAR_WINNER_MONEY
  6467. }
  6468. // Else if new owner is equal to old owner.
  6469. else if ( gZones[ zoneid ][ G_ZONE_OWNER ] == newOwner )
  6470. {
  6471. #define WAR_WINNER_MONEY 500
  6472.  
  6473. new gString[ MAX_CLIENT_MSG ],
  6474. gPrize = ( tmpScore[ 0 ] > 30 ? WAR_WINNER_MONEY * 30 : WAR_WINNER_MONEY * tmpScore[ 0 ] );
  6475.  
  6476. format( gString, sizeof( gString ), "* $%d was deposited into your gangs bank account for defending the turf.", gPrize );
  6477. gData[ newOwner ][ G_BANK ] += gPrize;
  6478.  
  6479. // Show the new gang that they defended the turf sucessfully.
  6480. TextDrawShowForGang( newOwner, TEXT_TurfDefended );
  6481.  
  6482. // Tell the gang that they got some money in their bank.
  6483. SendClientMessageToGang( newOwner, COLOR_GREEN, gString );
  6484.  
  6485. // Hide the text draw for gang after 10 seconds.
  6486. SetTimerEx( "TextDrawHideForGang", 10000, 0, "ii", newOwner, _:TEXT_TurfDefended );
  6487.  
  6488. #undef WAR_WINNER_MONEY
  6489. }
  6490.  
  6491. // Stop the flashing of zones now that the war has ended.
  6492. GangZoneStopFlashForAll( zoneid );
  6493.  
  6494. // Show the new gang zone colour for all..
  6495. GangZoneHideForAll( zoneid );
  6496. GangZoneShowForAll( zoneid, gZones[ zoneid ][ G_ZONE_COLOR ] );
  6497.  
  6498. // Officially set the war to off.
  6499. gZones[ zoneid ][ G_ZONE_WAR ] = 0;
  6500. }
  6501. #endif
  6502.  
  6503. stock IsPlayerStripper( playerid )
  6504. {
  6505. new
  6506. pSkin = GetPlayerSkin( playerid );
  6507.  
  6508. switch ( pSkin ) {
  6509. case 87, 244, 246, 256, 257: return 1;
  6510. }
  6511.  
  6512. return 0;
  6513. }
  6514.  
  6515. stock IsPlayerLawEnforcer( playerid )
  6516. {
  6517. new
  6518. iPlayerSkin = GetPlayerSkin( playerid );
  6519.  
  6520. switch ( iPlayerSkin ) {
  6521. case 163 .. 166, 274 .. 288: return 1;
  6522. }
  6523.  
  6524. return 0;
  6525. }
  6526.  
  6527. stock GivePlayerSpawnWeapon( playerid, weaponid, ammo )
  6528. {
  6529. new
  6530. slot = GetWeaponSlot( weaponid );
  6531.  
  6532. if ( slot == -1 )
  6533. return 0;
  6534.  
  6535. else
  6536. {
  6537. pData[ playerid ][ P_SPAWN_WEAPONS ][ slot ] = weaponid;
  6538. pData[ playerid ][ P_SPAWN_AMMO ][ slot ] += ammo;
  6539.  
  6540. return 1;
  6541. }
  6542. }
  6543.  
  6544. stock SendClientMessageToAdmins( color, msg[ ] )
  6545. {
  6546. for ( new i = 0, k = GetMaxPlayers( ); i < k; i++ )
  6547. {
  6548. if ( IsPlayerConnected( i ) && ( IsPlayerAdmin( i ) || pData[ i ][ P_LEVEL ] >= _:P_LEVEL_ADMIN ) )
  6549. SendClientMessage( i, color, msg );
  6550. }
  6551. }
  6552.  
  6553. stock IsPlayerInAnyStripClub( playerid )
  6554. {
  6555. if ( pData[ playerid ][ P_CHECKPOINT_AREA ] == _:CP_SOUTH_STRIP_CLUB || pData[ playerid ][ P_CHECKPOINT_AREA ] == _:CP_NORTH_STRIP_CLUB )
  6556. return 1;
  6557.  
  6558. return 0;
  6559. }
  6560.  
  6561. #if TEXT_DRAWS_INSTEAD_OF_CLIENT_MESSAGES == true
  6562.  
  6563. //LnX's Bit for funky displaying of text
  6564. //lorenxo<dot>lnx<dot>googlemail<dot>com
  6565. //This displays the output from commands (e.g. /properties) in a more graphical way
  6566. //and dynamically updates them if they change
  6567.  
  6568. stock lkillmessage(Text:text)
  6569. {
  6570. if (text != INVALID_TEXT_DRAW) // textid's include 0. INVALID_TEXT_DRAW (0xFF) is the correct id for invalid text's.
  6571. {
  6572. TextDrawDestroy(text);
  6573. }
  6574. }
  6575.  
  6576. stock Text:lshowmessage(playerid, Text:text)
  6577. {
  6578. TextDrawLetterSize(text,0.2,0.8);
  6579. // TextDrawTextSize(text, 100, 100);
  6580. // TextDrawAlignment(text, 3);
  6581. TextDrawSetShadow(text, 0);
  6582. // TextDrawUseBox(text, true);
  6583. TextDrawSetOutline(text, 1);
  6584. TextDrawSetProportional(text,true);
  6585. TextDrawShowForPlayer(playerid, text);
  6586. }
  6587.  
  6588. stock lredrawall()
  6589. {
  6590. lredraw(1);
  6591. lredraw(2);
  6592. }
  6593.  
  6594. stock lredraw(type)
  6595. {
  6596. if (type == 1)
  6597. {
  6598. for (new i = 0; i < 3; i++)
  6599. {
  6600. TextDrawHideForAll(lprops [i]);
  6601. lkillmessage(lprops [i]);
  6602. }
  6603. lmakeallprops();
  6604. for (new j = 0; j < MAX_PLAYERS; j++)
  6605. {
  6606. if (lvisiblemessage[j] == 1)
  6607. {
  6608. lshowmessage(j, lprops[0]);
  6609. lshowmessage(j, lprops[1]);
  6610. lshowmessage(j, lprops[2]);
  6611. }
  6612. }
  6613. }
  6614. else if (type == 2)
  6615. {
  6616. for (new i = 0; i < 2; i++)
  6617. {
  6618. TextDrawHideForAll(lgangs [i]);
  6619. lkillmessage(lgangs [i]);
  6620. }
  6621. lmakeallgangs();
  6622. for (new j = 0; j < MAX_PLAYERS; j++)
  6623. {
  6624. if (lvisiblemessage[j] == 2)
  6625. {
  6626. lshowmessage(j, lgangs[0]);
  6627. lshowmessage(j, lgangs[1]);
  6628. }
  6629. }
  6630. }
  6631. /*
  6632. else if (type == 3)
  6633. {
  6634. lkillmessage(lweaps);
  6635. lmakeweapons();
  6636. }
  6637. */
  6638. }
  6639.  
  6640. stock lclear(playerid)
  6641. {
  6642. print("clearing...");
  6643. if (lvisiblemessage[playerid] == 1)
  6644. {
  6645. for (new i = 0; i < 3; i++)
  6646. {
  6647. TextDrawHideForPlayer(playerid, lprops[i]);
  6648. }
  6649. }
  6650. else if (lvisiblemessage[playerid] == 2)
  6651. {
  6652. print("...gangs");
  6653. for (new i = 0; i < 2; i++)
  6654. {
  6655. TextDrawHideForPlayer(playerid, lgangs[i]);
  6656. }
  6657. print("cleared :D");
  6658. }
  6659. /*
  6660. else if (lvisiblemessage[playerid] == 3)
  6661. {
  6662. TextDrawHideForPlayer(playerid, lweaps);
  6663. }
  6664. else if (lvisiblemessage[playerid] == 4)
  6665. {
  6666. TextDrawHideForPlayer(playerid, lrules);
  6667. }
  6668. */
  6669.  
  6670. lvisiblemessage[playerid] = 0;
  6671.  
  6672. }
  6673.  
  6674. //Properties 1
  6675. stock Text:lmakeprops1()
  6676. {
  6677. new Text:out;
  6678. new loutput[256] = "Properties : ~n~";
  6679. new lplayersname[MAX_PLAYER_NAME];
  6680. new lplayerid[3];
  6681.  
  6682. for(new i = 0; i < 5; i++)
  6683. {
  6684. if(gPropertyData [i] [PROPERTY_OWNER] != INVALID_PLAYER_ID)
  6685. {
  6686. GetPlayerName(gPropertyData [i] [PROPERTY_OWNER], lplayersname, sizeof(lplayersname));
  6687. strcat(loutput, gPropertyData [i] [PROPERTY_NAME], sizeof(loutput));
  6688. strcat(loutput, " - ", sizeof(loutput));
  6689. strcat(loutput, lplayersname, sizeof(loutput));
  6690. strcat(loutput, "(", sizeof(loutput));
  6691. valstr(lplayerid, gPropertyData [i] [PROPERTY_OWNER], false);
  6692. strcat(loutput, lplayerid, sizeof(loutput));
  6693. strcat(loutput,")~n~", sizeof(loutput));
  6694. }
  6695. else
  6696. {
  6697. strcat(loutput, gPropertyData [i] [PROPERTY_NAME], sizeof(loutput));
  6698. strcat(loutput, " - none", sizeof(loutput));
  6699. strcat(loutput,"~n~", sizeof(loutput));
  6700. }
  6701.  
  6702.  
  6703. }
  6704. out = TextDrawCreate(5.0, 120.0, loutput);
  6705. return(out);
  6706. }
  6707.  
  6708. stock Text:lmakeprops2()
  6709. {
  6710. new Text:out;
  6711. new loutput[256];
  6712. new lplayersname[MAX_PLAYER_NAME];
  6713. new lplayerid[3];
  6714.  
  6715. for(new i = 5; i < 11; i++)
  6716. {
  6717. if(gPropertyData [i] [PROPERTY_OWNER] != INVALID_PLAYER_ID)
  6718. {
  6719. GetPlayerName(gPropertyData [i] [PROPERTY_OWNER], lplayersname, sizeof(lplayersname));
  6720. strcat(loutput, gPropertyData [i] [PROPERTY_NAME], sizeof(loutput));
  6721. strcat(loutput, " - ", sizeof(loutput));
  6722. strcat(loutput, lplayersname, sizeof(loutput));
  6723. strcat(loutput, "(", sizeof(loutput));
  6724. valstr(lplayerid, gPropertyData [i] [PROPERTY_OWNER], false);
  6725. strcat(loutput, lplayerid, sizeof(loutput));
  6726. strcat(loutput,")~n~", sizeof(loutput));
  6727. }
  6728. else
  6729. {
  6730. strcat(loutput, gPropertyData [i] [PROPERTY_NAME], sizeof(loutput));
  6731. strcat(loutput, " - none", sizeof(loutput));
  6732. strcat(loutput,"~n~", sizeof(loutput));
  6733. }
  6734.  
  6735.  
  6736. }
  6737. out = TextDrawCreate(5.0, 163.0, loutput);
  6738. return(out);
  6739. }
  6740.  
  6741. stock Text:lmakeprops3()
  6742. {
  6743. new Text:out;
  6744. new loutput[256];
  6745. new lplayersname[MAX_PLAYER_NAME];
  6746. new lplayerid[3];
  6747.  
  6748. for(new i = 11; i < 15; i++)
  6749. {
  6750. if(gPropertyData [i] [PROPERTY_OWNER] != INVALID_PLAYER_ID)
  6751. {
  6752. GetPlayerName(gPropertyData [i] [PROPERTY_OWNER], lplayersname, sizeof(lplayersname));
  6753. strcat(loutput, gPropertyData [i] [PROPERTY_NAME], sizeof(loutput));
  6754. strcat(loutput, " - ", sizeof(loutput));
  6755. strcat(loutput, lplayersname, sizeof(loutput));
  6756. strcat(loutput, "(", sizeof(loutput));
  6757. valstr(lplayerid, gPropertyData [i] [PROPERTY_OWNER], false);
  6758. strcat(loutput, lplayerid, sizeof(loutput));
  6759. strcat(loutput,")~n~", sizeof(loutput));
  6760. }
  6761. else
  6762. {
  6763. strcat(loutput, gPropertyData [i] [PROPERTY_NAME], sizeof(loutput));
  6764. strcat(loutput, " - none", sizeof(loutput));
  6765. strcat(loutput,"~n~", sizeof(loutput));
  6766. }
  6767. }
  6768. strcat(loutput, "~n~Type /clear to hide", sizeof(loutput));
  6769. out = TextDrawCreate(5.0, 206.0, loutput);
  6770. return(out);
  6771. }
  6772.  
  6773. stock lmakeallprops()
  6774. {
  6775. lprops [0] = lmakeprops1();
  6776. lprops [1] = lmakeprops2();
  6777. lprops [2] = lmakeprops3();
  6778. }
  6779.  
  6780. //Gangs 2
  6781. stock Text:lmakegangs1()
  6782. {
  6783. new Text:out;
  6784. new lgangid[4];
  6785. new loutput[256] = "Gangs :~n~";
  6786. for ( new i = 0; i < 8; i++ )
  6787. {
  6788. if ( gData[ i ][ G_TOTALS ] )
  6789. {
  6790. strcat(loutput, "(", sizeof(loutput));
  6791. valstr(lgangid, i, false);
  6792. strcat(loutput, lgangid, sizeof(loutput));
  6793. strcat(loutput,")", sizeof(loutput));
  6794. strcat(loutput, gData[ i ][ G_NAME ], sizeof(loutput));
  6795. strcat(loutput, " - ", sizeof(loutput));
  6796. valstr(lgangid, gData[ i ][ G_TOTALS ], false);
  6797. strcat(loutput, lgangid, sizeof(loutput));
  6798. strcat(loutput, " members~n~", sizeof(loutput));
  6799. // format( loutput, sizeof(loutput), "%s (%d) - Members %d~n~", gData[ i ][ G_NAME ], i, gData[ i ][ G_TOTALS ] );
  6800. }
  6801. }
  6802. print(loutput);
  6803. out = TextDrawCreate(5.0, 120.0, loutput);
  6804. return(out);
  6805. }
  6806.  
  6807. stock Text:lmakegangs2()
  6808. {
  6809. new Text:out;
  6810. new loutput[256];
  6811. new lgangid[4];
  6812. for ( new i = 8; i < MAX_GANGS; i++ )
  6813. {
  6814. if ( gData[ i ][ G_TOTALS ] )
  6815. {
  6816. strcat(loutput, "(", sizeof(loutput));
  6817. valstr(lgangid, i, false);
  6818. strcat(loutput, lgangid, sizeof(loutput));
  6819. strcat(loutput,")", sizeof(loutput));
  6820. strcat(loutput, gData[ i ][ G_NAME ], sizeof(loutput));
  6821. strcat(loutput, " - ", sizeof(loutput));
  6822. valstr(lgangid, gData[ i ][ G_TOTALS ], false);
  6823. strcat(loutput, lgangid, sizeof(loutput));
  6824. strcat(loutput, " members~n~", sizeof(loutput));
  6825. // format( loutput, sizeof(loutput), "%s (%d) - Members %d~n~", gData[ i ][ G_NAME ], i, gData[ i ][ G_TOTALS ] );
  6826. }
  6827. }
  6828. strcat(loutput, "~n~Type /clear to hide", sizeof(loutput));
  6829. print(loutput);
  6830. out = TextDrawCreate(5.0, 183.0, loutput);
  6831. return(out);
  6832. }
  6833.  
  6834. stock lmakeallgangs()
  6835. {
  6836. print("Debug: Making the Gangs 4578");
  6837. lgangs [0] = lmakegangs1();
  6838. lgangs [1] = lmakegangs2();
  6839. print("Debug: Made the Gangs 4581");
  6840. }
  6841. /*
  6842. //Weapons 3
  6843. public Text:lmakeweapons()
  6844. {
  6845. new loutput[256] = "Weapons : ";
  6846. new temp[6];
  6847. for(new i = 0; i < MAX_WEAPONS; i++)
  6848. {
  6849. strcat(loutput, "~n~", sizeof(loutput));
  6850. valstr(temp, (i+1),true);
  6851. strcat(loutput, temp, sizeof(loutput));
  6852. strcat(loutput, ". ", sizeof(loutput));
  6853. strcat(loutput, weaponNames[i], sizeof(loutput));
  6854. strcat(loutput, " - $", sizeof(loutput));
  6855. valstr(temp, weaponCost[i],true);
  6856. strcat(loutput, temp , sizeof(loutput));
  6857. }
  6858. strcat(loutput, "~n~~n~Type /clear to hide", sizeof(loutput));
  6859. lweaps = TextDrawCreate(5.0, 110.0, loutput);
  6860. }
  6861. */
  6862. //Rules 4 - Don't work, too long
  6863.  
  6864. //End of LnX ;'(
  6865.  
  6866. #endif
  6867.  
  6868. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  6869. End Of GameMode: lva.pwn, littlewhitey Scripting Team
  6870. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
Advertisement
Add Comment
Please, Sign In to add comment