Advertisement
Guest User

Untitled

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