Guest User

samp

a guest
Aug 4th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.01 KB | None | 0 0
  1. // Gamemode by Aleksi //
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf2>
  5. #include <YSI\y_ini>
  6. #include <streamer>
  7.  
  8. // Dialogs
  9. #define DIALOG_REGISTER 1
  10. #define DIALOG_LOGIN 2
  11. #define DIALOG_SUCCESS_1 3
  12. #define DIALOG_SUCCESS_2 4
  13. #define DIALOG_WEAPONS 5
  14.  
  15. #define PATH "/Users/%s.ini"
  16.  
  17. // Color Defines
  18. #define COLOR_BLACK 0x000000AA
  19. #define COLOR_WHITE 0xFFFFFFAA
  20. #define COLOR_BLUE 0x1900FFAA
  21. #define COLOR_GREEN 0x009628AA
  22. #define COLOR_YELLOW 0xEAFF00AA
  23. #define COLOR_PURPLE 0xB0008DAA
  24. #define COLOR_RED 0xC90000AA
  25. #define COLOR_ORANGE 0xFFA530AA
  26. #define COLOR_GREY 0x7D7D7DAA
  27. #define COLOR_PINK 0xFF59CBAA
  28. #define COLOR_LIGHT_BLUE 0x00B3FFAA
  29.  
  30. // Checkpoints
  31. new Checkpoint [MAX_PLAYERS] [3];
  32.  
  33. // Random Messages
  34. new RandomMSG[][] =
  35. {
  36. "Did you know: You can use /cmds to see all working commands!",
  37. "Did you know: You can see your stats by typing /stats",
  38. "Did you know: You can kill yourself by typing /kill"
  39. };
  40. // Key State Change Defines
  41. #define HOLDING(%0) \
  42. ((newkeys & (%0)) == (%0))
  43. #define PRESSED(%0) \
  44. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  45. #define RELEASED(%0) \
  46. (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  47.  
  48. enum pInfo
  49. {
  50. pPass,
  51. pCash,
  52. pAdmin,
  53. pKills,
  54. pDeaths,
  55. pScore,
  56. pCookies,
  57. pOnline
  58. }
  59. new PlayerInfo[MAX_PLAYERS][pInfo];
  60.  
  61. forward LoadUser_data(playerid,name[],value[]);
  62. public LoadUser_data(playerid,name[],value[])
  63. {
  64. INI_Int("Password",PlayerInfo[playerid][pPass]);
  65. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  66. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  67. INI_Int("Kills",PlayerInfo[playerid][pKills]);
  68. INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
  69. INI_Int("Score",PlayerInfo[playerid][pScore]);
  70. INI_Int("Cookies",PlayerInfo[playerid][pCookies]);
  71. return 1;
  72. }
  73.  
  74. stock UserPath(playerid)
  75. {
  76. new string[128],playername[MAX_PLAYER_NAME];
  77. GetPlayerName(playerid,playername,sizeof(playername));
  78. format(string,sizeof(string),PATH,playername);
  79. return string;
  80. }
  81.  
  82. stock udb_hash(buf[])
  83. {
  84. new length=strlen(buf);
  85. new s1 = 1;
  86. new s2 = 0;
  87. new n;
  88. for (n=0; n<length; n++)
  89. {
  90. s1 = (s1 + buf[n]) % 65521;
  91. s2 = (s2 + s1) % 65521;
  92. }
  93. return (s2 << 16) + s1;
  94. }
  95.  
  96. stock Name(playerid)
  97. {
  98. new name[24];
  99. GetPlayerName(playerid, name, 24);
  100. return name;
  101. }
  102.  
  103. stock GivePlayerScore(playerid, score)
  104. {
  105. SetPlayerScore(playerid, GetPlayerScore(playerid)+score);
  106. return 1;
  107. }
  108.  
  109. // Kill Spree
  110. new Spree[MAX_PLAYERS];
  111.  
  112. #if defined FILTERSCRIPT
  113.  
  114. public OnFilterScriptInit()
  115. {
  116. print("\n--------------------------------------");
  117. print(" Finland");
  118. print("--------------------------------------\n");
  119. return 1;
  120. }
  121.  
  122. public OnFilterScriptExit()
  123. {
  124. return 1;
  125. }
  126.  
  127. #else
  128.  
  129. main()
  130. {
  131. print("\n----------------------------------");
  132. print(" Finland");
  133. print("----------------------------------\n");
  134. }
  135.  
  136. #endif
  137.  
  138. public OnGameModeInit()
  139. {
  140. SetGameModeText("Finland");
  141. UsePlayerPedAnims();
  142. SetWeather(11);
  143. SetWorldTime(8);
  144. DisableInteriorEnterExits();
  145. // Skins
  146. AddPlayerClass(287,994.3892,-1297.0919,13.5469,183.3116,31,500,27,100,34,100);
  147. AddPlayerClass(211,994.3892,-1297.0919,13.5469,183.3116,31,500,27,100,34,100);
  148. AddPlayerClass(93,994.3892,-1297.0919,13.5469,183.3116,30,500,25,100,33,100);
  149. AddPlayerClass(293,994.3892,-1297.0919,13.5469,183.3116,30,500,25,100,33,100);
  150. // Vehicles
  151. CreateVehicle(533,980.5126,-1306.3201,13.0919,0.5485,-1,-1,180); // market car 1
  152. CreateVehicle(533,984.0917,-1306.2050,13.0919,1.0113,-1,-1,180); // market car 2
  153. CreateVehicle(541,987.7926,-1305.9928,13.0078,1.2991,-1,-1,180); // market car 3
  154. CreateVehicle(560,991.7049,-1306.3601,13.0876,1.1003,-1,-1,180); // market car 4
  155. CreateVehicle(562,995.9548,-1306.3956,13.0437,1.3754,-1,-1,180); // market car 5
  156. CreateVehicle(603,1000.2352,-1306.5288,13.2246,358.5749,-1,-1,180); // market car 6
  157. CreateVehicle(415,1003.8256,-1306.5809,13.1543,359.9701,-1,-1,180); // market car 7
  158. CreateVehicle(522,1006.6008,-1306.2061,12.9541,359.7311,-1,-1,180); // market car 8
  159. CreateVehicle(560,2473.3149,-1700.9091,13.2255,359.7716,-1,-1,180); // grove car 1
  160. CreateVehicle(560,2510.3298,-1666.1903,13.1939,11.3352,-1,-1,180); // grove car 2
  161. CreateVehicle(559,2505.6357,-1694.5974,13.1817,2.2338,-1,-1,180); // grove car 3
  162. CreateVehicle(562,2500.7349,-1654.5953,13.0754,70.5065,-1,-1,180); // grove car 4
  163. CreateVehicle(579,2481.3772,-1653.0800,13.0150,91.9613,-1,-1,180); // grove car 5
  164. CreateVehicle(470,2443.1770,-1636.2662,13.0450,177.6578,-1,-1,180); // grove car 6
  165. CreateVehicle(445,2403.5950,-1643.6750,13.1717,180.0059,-1,-1,180); // grove car 7
  166. CreateVehicle(541,2360.9526,-1679.8004,13.1709,359.1744,-1,-1,180); // grove car 8
  167. CreateVehicle(434,2489.9648,-1754.5337,13.2300,0.6970,-1,-1,180); // grove car 9
  168. CreateVehicle(411,2485.1660,-1754.6630,13.2559,359.8680,-1,-1,180); // grove car 10
  169. CreateVehicle(402,2445.5305,-1762.5991,13.2972,179.7099,-1,-1,180); // grove car 11
  170. CreateVehicle(424,2390.1782,-1714.2474,13.3235,181.3788,-1,-1,180); // grove car 12
  171. CreateVehicle(451,2319.4082,-1712.2410,13.2559,178.7489,-1,-1,180); // grove car 13
  172. CreateVehicle(444,2312.7129,-1819.8416,13.2560,265.3640,-1,-1,180); // monster
  173. CreateVehicle(558,2095.3772,-1814.2410,13.0422,88.3843,-1,-1,180); // idlewood car 1
  174. CreateVehicle(559,2095.8037,-1819.9091,13.0413,89.5839,-1,-1,180); // idlewood car 2
  175. CreateVehicle(561,2050.0039,-1804.7339,14.5092,268.9632,-1,-1,180); // idlewood car 3
  176. CreateVehicle(565,2119.9236,-1783.5605,13.0462,359.3426,-1,-1,180); // idlewood car 4
  177. CreateVehicle(567,2110.9031,-1783.9275,13.0465,359.9934,-1,-1,180); // idlewood car 5
  178. CreateVehicle(580,2104.1992,-1783.7562,13.0471,359.4215,-1,-1,180); // idlewood car 6
  179. CreateVehicle(585,2062.2102,-1738.9377,13.2056,268.8533,-1,-1,180); // idlewood car 7
  180. CreateVehicle(602,2060.8040,-1694.5649,13.2097,269.1641,-1,-1,180); // idlewood car 8
  181. CreateVehicle(510,2063.5425,-1636.6174,13.2056,268.7675,-1,-1,180); // idlewood car 9
  182. CreateVehicle(506,2086.7178,-1558.5745,12.8832,181.2217,-1,-1,180); // idlewood car 10
  183. CreateVehicle(507,2016.9731,-1707.7720,13.2054,90.0663,-1,-1,180); // idlewood car 11
  184. CreateVehicle(500,2014.4670,-1737.3192,13.2121,91.3799,-1,-1,180); // idlewood car 12
  185. CreateVehicle(496,2019.9344,-1648.7147,13.2118,88.1959,-1,-1,180); // idlewood car 13
  186. CreateVehicle(495,2013.8776,-1596.9523,13.2309,134.1935,-1,-1,180); // idlewood car 14
  187. CreateVehicle(522,1919.6316,-1787.7649,13.1245,88.7143,-1,-1,180); // idlewood car 15
  188. CreateVehicle(492,1774.7311,-1701.6517,13.1624,0.3320,-1,-1,180); // idlewood car 16
  189. CreateVehicle(490,1782.7487,-1701.1257,13.1605,359.6860,-1,-1,180); // idlewood car 17
  190. CreateVehicle(483,1528.6285,-1683.8776,5.5493,269.1144,-1,-1,180); // idlewood car 18
  191. CreateVehicle(475,1583.4260,-1711.5061,5.5492,358.6674,-1,-1,180); // idlewood car 19
  192. CreateVehicle(439,1602.4788,-1687.9166,5.5501,89.4440,-1,-1,180); // idlewood car 20
  193. // Objects
  194.  
  195. // Timers
  196. SetTimer("SendMSG", 300000, true);
  197. return 1;
  198. }
  199.  
  200. public OnGameModeExit()
  201. {
  202. return 1;
  203. }
  204.  
  205. public OnPlayerRequestClass(playerid, classid)
  206. {
  207. SetPlayerPos(playerid, 1457.2354,-1009.4296,61.1703);
  208. SetPlayerCameraPos(playerid, 1458.4819,-1016.2706,61.1703);
  209. SetPlayerCameraLookAt(playerid, 1457.2354,-1009.4296,61.1703);
  210. SetPlayerFacingAngle(playerid, 188.4485);
  211. return 1;
  212. }
  213.  
  214. forward SendMSG();
  215. public SendMSG()
  216. {
  217. new randMSG = random(sizeof(RandomMSG));
  218. SendClientMessageToAll(COLOR_YELLOW, RandomMSG[randMSG]);
  219. }
  220.  
  221. public OnPlayerConnect(playerid)
  222. {
  223. if(fexist(UserPath(playerid)))
  224. {
  225. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  226. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Type your password below to login.","Login","Quit");
  227. }
  228. else
  229. {
  230. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registering...","Type your password below to register a new account.","Register","Quit");
  231. }
  232. new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
  233. GetPlayerName(playerid, pname, sizeof(pname));
  234. format(string, sizeof(string), "%s has joined the server!", pname);
  235. SendClientMessageToAll(COLOR_GREY, string);
  236. // Checkpoints
  237. Checkpoint [playerid] [0] = CreateDynamicCP(1038.1439,-1339.7784,13.7266, 1, 0, 0, 0, 50); // gun shop enter
  238. Checkpoint [playerid] [1] = CreateDynamicCP(285.3838,-40.1943,1001.5156, 1, 0, 1, 0, 50); //gun shop exit
  239. Checkpoint [playerid] [2] = CreateDynamicCP(296.5040,-38.1360,1001.5156, 1, 0, 1, 0, 50);
  240. return 1;
  241. }
  242.  
  243. public OnPlayerDisconnect(playerid, reason)
  244. {
  245. new INI:File = INI_Open(UserPath(playerid));
  246. INI_SetTag(File,"data");
  247. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  248. INI_WriteInt(File,"Score",GetPlayerScore(playerid));
  249. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  250. INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
  251. INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
  252. INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
  253. INI_Close(File);
  254. new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
  255. GetPlayerName(playerid, pname, sizeof(pname));
  256. switch(reason)
  257. {
  258. case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
  259. case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
  260. case 2: format(string, sizeof(string), "%s has left the server. (Kicked/Banned)", pname);
  261. }
  262. SendClientMessageToAll(COLOR_GREY, string);
  263. Spree[playerid] = 0;
  264. return 1;
  265. }
  266.  
  267. public OnPlayerSpawn(playerid)
  268. {
  269. SetPlayerColor(playerid,COLOR_WHITE);
  270. SetPlayerHealth(playerid, 999999);
  271. SendClientMessage(playerid, COLOR_RED, "You are protected agains spawn-killing for 5 seconds.");
  272. SetTimerEx("EndAntiSpawnKill", 5000, false, "i", playerid);
  273. return 1;
  274. }
  275.  
  276. forward EndAntiSpawnKill(playerid);
  277. public EndAntiSpawnKill(playerid)
  278. {
  279. SetPlayerHealth(playerid, 100);
  280. SendClientMessage(playerid, COLOR_RED, "You are no longer protected against spawn-killing.");
  281. return 1;
  282. }
  283.  
  284. public OnPlayerDeath(playerid, killerid, reason)
  285. {
  286. // Kill List
  287. SendDeathMessage(killerid, playerid, reason);
  288. // Kills + Deaths and Spree system
  289. PlayerInfo[killerid][pKills]++;
  290. PlayerInfo[playerid][pDeaths]++;
  291. GivePlayerMoney(killerid, 10000);
  292. GivePlayerScore(killerid, 1);
  293. Spree[killerid]++;
  294. Spree[playerid] = 0;
  295. new string[100];
  296. if(Spree[killerid] == 2)
  297. {
  298. format(string, sizeof(string), "%s is on a killing spree of %d kills. Double kill!", Name(killerid), Spree[killerid]);
  299. SendClientMessageToAll(COLOR_BLUE, string);
  300. SendClientMessage(killerid, COLOR_BLUE, "You are on a killing spree of 2 kills. +2 score and $2000");
  301. GivePlayerScore(killerid, 1);
  302. GivePlayerMoney(killerid, 2000);
  303. }
  304. else if(Spree[killerid] == 3)
  305. {
  306. format(string, sizeof(string), "%s is on a killing spree of %d kills. +3 score", Name(killerid), Spree[killerid]);
  307. SendClientMessageToAll(COLOR_BLUE, string);
  308. SendClientMessage(killerid, COLOR_BLUE, "You are on a killing spree of 3 kills. +3 score and $3000");
  309. GivePlayerScore(killerid, 2);
  310. GivePlayerMoney(killerid, 3000);
  311. }
  312. else if(Spree[killerid] == 5)
  313. {
  314. format(string, sizeof(string), "%s is on a killing spree of %d kills. +5 score", Name(killerid), Spree[killerid]);
  315. SendClientMessageToAll(COLOR_BLUE, string);
  316. SendClientMessage(killerid, COLOR_BLUE, "You are on a killing spree of 5 kills. +5 score and $5000");
  317. GivePlayerScore(killerid, 4);
  318. GivePlayerMoney(killerid, 5000);
  319. }
  320. else if(Spree[killerid] == 10)
  321. {
  322. format(string, sizeof(string), "%s is on a killing spree of %d kills. +10 score", Name(killerid), Spree[killerid]);
  323. SendClientMessageToAll(COLOR_BLUE, string);
  324. SendClientMessage(killerid, COLOR_BLUE, "You are on a killing spree of 10 kills. +10 score and $10000");
  325. GivePlayerScore(killerid, 9);
  326. GivePlayerMoney(killerid, 10000);
  327. Spree[killerid] = 0;
  328. }
  329. return 1;
  330. }
  331.  
  332. public OnVehicleSpawn(vehicleid)
  333. {
  334. return 1;
  335. }
  336.  
  337. public OnVehicleDeath(vehicleid, killerid)
  338. {
  339. return 1;
  340. }
  341.  
  342. public OnPlayerText(playerid, text[])
  343. {
  344. return 1;
  345. }
  346.  
  347. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  348. {
  349. return 1;
  350. }
  351.  
  352. public OnPlayerExitVehicle(playerid, vehicleid)
  353. {
  354. return 1;
  355. }
  356.  
  357. public OnPlayerStateChange(playerid, newstate, oldstate)
  358. {
  359. return 1;
  360. }
  361.  
  362. public OnPlayerEnterCheckpoint(playerid)
  363. {
  364. return 1;
  365. }
  366.  
  367. public OnPlayerLeaveCheckpoint(playerid)
  368. {
  369. return 1;
  370. }
  371.  
  372. public OnPlayerEnterRaceCheckpoint(playerid)
  373. {
  374. return 1;
  375. }
  376.  
  377. public OnPlayerLeaveRaceCheckpoint(playerid)
  378. {
  379. return 1;
  380. }
  381.  
  382. public OnRconCommand(cmd[])
  383. {
  384. return 1;
  385. }
  386.  
  387. public OnPlayerRequestSpawn(playerid)
  388. {
  389. return 1;
  390. }
  391.  
  392. public OnObjectMoved(objectid)
  393. {
  394. return 1;
  395. }
  396.  
  397. public OnPlayerObjectMoved(playerid, objectid)
  398. {
  399. return 1;
  400. }
  401.  
  402. public OnPlayerPickUpPickup(playerid, pickupid)
  403. {
  404. return 1;
  405. }
  406.  
  407. public OnVehicleMod(playerid, vehicleid, componentid)
  408. {
  409. return 1;
  410. }
  411.  
  412. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  413. {
  414. return 1;
  415. }
  416.  
  417. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  418. {
  419. return 1;
  420. }
  421.  
  422. public OnPlayerSelectedMenuRow(playerid, row)
  423. {
  424. return 1;
  425. }
  426.  
  427. public OnPlayerExitedMenu(playerid)
  428. {
  429. return 1;
  430. }
  431.  
  432. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  433. {
  434. return 1;
  435. }
  436.  
  437. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  438. {
  439. if (PRESSED(KEY_FIRE))
  440. {
  441. if(IsPlayerInAnyVehicle(playerid))
  442. {
  443. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  444. }
  445. }
  446. if (RELEASED(KEY_FIRE))
  447. {
  448. if(IsPlayerInAnyVehicle(playerid))
  449. {
  450. RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
  451. }
  452. }
  453. return 1;
  454. }
  455.  
  456. public OnRconLoginAttempt(ip[], password[], success)
  457. {
  458. return 1;
  459. }
  460.  
  461. public OnPlayerUpdate(playerid)
  462. {
  463. return 1;
  464. }
  465.  
  466. public OnPlayerStreamIn(playerid, forplayerid)
  467. {
  468. return 1;
  469. }
  470.  
  471. public OnPlayerStreamOut(playerid, forplayerid)
  472. {
  473. return 1;
  474. }
  475.  
  476. public OnVehicleStreamIn(vehicleid, forplayerid)
  477. {
  478. return 1;
  479. }
  480.  
  481. public OnVehicleStreamOut(vehicleid, forplayerid)
  482. {
  483. return 1;
  484. }
  485.  
  486. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  487. {
  488. switch( dialogid )
  489. {
  490. case DIALOG_REGISTER:
  491. {
  492. if (!response) return Kick(playerid);
  493. if(response)
  494. {
  495. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
  496. new INI:File = INI_Open(UserPath(playerid));
  497. INI_SetTag(File,"data");
  498. INI_WriteInt(File,"Password",udb_hash(inputtext));
  499. INI_WriteInt(File,"Cash",0);
  500. INI_WriteInt(File,"Admin",0);
  501. INI_WriteInt(File,"Kills",0);
  502. INI_WriteInt(File,"Deaths",0);
  503. INI_WriteInt(File,"Score",0);
  504. INI_WriteInt(File,"Cookies",0);
  505. INI_Close(File);
  506. ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","You successfully registered new account. Relog to save your stats!","Ok","");
  507. }
  508. }
  509.  
  510. case DIALOG_LOGIN:
  511. {
  512. if ( !response ) return Kick ( playerid );
  513. if( response )
  514. {
  515. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  516. {
  517. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  518. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  519. SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
  520. ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
  521. }
  522. else
  523. {
  524. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
  525. }
  526. return 1;
  527. }
  528. }
  529. case DIALOG_WEAPONS:
  530. {
  531. if(listitem == 0)
  532. {
  533. GivePlayerWeapon(playerid,31,1000);
  534. GivePlayerMoney(playerid,-5400);
  535. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased M4A1 $5,400");
  536. }
  537. if(listitem == 1)
  538. {
  539. GivePlayerWeapon(playerid,30,1000);
  540. GivePlayerMoney(playerid,-4500);
  541. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased AK47 $4,500");
  542. }
  543. if(listitem == 2)
  544. {
  545. GivePlayerWeapon(playerid,34,1000);
  546. GivePlayerMoney(playerid,-8000);
  547. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Sniper Rifle $8,000");
  548. }
  549. if(listitem == 3)
  550. {
  551. GivePlayerWeapon(playerid,33,1000);
  552. GivePlayerMoney(playerid,-6500);
  553. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Country Rifle $6,500");
  554. }
  555. if(listitem == 4)
  556. {
  557. GivePlayerWeapon(playerid,26,1000);
  558. GivePlayerMoney(playerid,-4000);
  559. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Sawnoff Shotgun $4,000");
  560. }
  561. if(listitem == 5)
  562. {
  563. GivePlayerWeapon(playerid,27,1000);
  564. GivePlayerMoney(playerid,-4900);
  565. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Combat Shotgun $4,900");
  566. }
  567. if(listitem == 6)
  568. {
  569. GivePlayerWeapon(playerid,25,1000);
  570. GivePlayerMoney(playerid,-3200);
  571. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Shotgun $3,200");
  572. }
  573. if(listitem == 7)
  574. {
  575. GivePlayerWeapon(playerid,29,1000);
  576. GivePlayerMoney(playerid,-3500);
  577. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Mp5 $3,500");
  578. }
  579. if(listitem == 8)
  580. {
  581. GivePlayerWeapon(playerid,32,1000);
  582. GivePlayerMoney(playerid,-2900);
  583. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Tec9 $2,900");
  584. }
  585. if(listitem == 9)
  586. {
  587. GivePlayerWeapon(playerid,28,1000);
  588. GivePlayerMoney(playerid,-3700);
  589. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Mini-Uzi $3,700");
  590. }
  591. if(listitem == 10)
  592. {
  593. GivePlayerWeapon(playerid,24,1000);
  594. GivePlayerMoney(playerid,-5300);
  595. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Desert Eagle $5,300");
  596. }
  597. if(listitem == 11)
  598. {
  599. GivePlayerWeapon(playerid,22,1000);
  600. GivePlayerMoney(playerid,-1400);
  601. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Pistol $1,400");
  602. }
  603. if(listitem == 12)
  604. {
  605. GivePlayerWeapon(playerid,23,1000);
  606. GivePlayerMoney(playerid,-1500);
  607. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Silenced Pistol $1,500");
  608. }
  609. if(listitem == 13)
  610. {
  611. GivePlayerWeapon(playerid,8,1);
  612. GivePlayerMoney(playerid,-500);
  613. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Katana $500");
  614. }
  615. if(listitem == 14)
  616. {
  617. GivePlayerWeapon(playerid,9,1);
  618. GivePlayerMoney(playerid,-750);
  619. SendClientMessage(playerid,COLOR_LIGHT_BLUE,"You have purchased Chainsaw $750");
  620. }
  621. }
  622. }
  623. return 1;
  624. }
  625.  
  626. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  627. {
  628. return 1;
  629. }
  630.  
  631. public OnPlayerEnterDynamicCP(playerid, checkpointid)
  632. {
  633. if(checkpointid == Checkpoint [playerid] [0])
  634. {
  635. SetPlayerPos(playerid,288.2349,-38.5503,1001.5156);
  636. SetPlayerInterior(playerid,1);
  637. }
  638. if(checkpointid == Checkpoint [playerid] [1])
  639. {
  640. SetPlayerPos(playerid,1038.4999,-1336.6597,13.7266);
  641. SetPlayerInterior(playerid,0);
  642. }
  643. if(checkpointid == Checkpoint [playerid] [2])
  644. {
  645. ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "M4A1 $5,400\nAK47 $4,500\nSniper Rifle $8,000\nCountry Rifle $6,500\nSawnoff Shotgun $4,000\nCombat Shotgun $4,900\nShotgun $3,200\nMp5 $3,500\nTec9 $2,900\nMini-Uzi $3,700\nDesert Eagle $5,300\nPistol $1,400\nSilenced Pistol $1,500\nKatana $500\nChainsaw $750","Buy","Cancel");
  646. }
  647. return 1;
  648. }
  649.  
  650. CMD:help(playerid, params[])
  651. {
  652. SendClientMessage(playerid, COLOR_YELLOW, "Type /cmds to see all working commands.");
  653. return 1;
  654. }
  655.  
  656. CMD:cmds(playerid, params[])
  657. {
  658. SendClientMessage(playerid, COLOR_YELLOW, "CMDS: /help /cmds /stats /kill /fix");
  659. return 1;
  660. }
  661.  
  662. CMD:stats(playerid,params[])
  663. {
  664. new money = PlayerInfo[playerid][pCash];
  665. new score = PlayerInfo[playerid][pScore];
  666. new kills = PlayerInfo[playerid][pKills];
  667. new deaths = PlayerInfo[playerid][pDeaths];
  668. new cookies = PlayerInfo[playerid][pCookies];
  669. if(!deaths) deaths = 1;
  670. new Float:kd = floatdiv(PlayerInfo[playerid][pKills], deaths);
  671. new string[500];
  672. format(string,sizeof(string),"Money: %d\nScore: %d\nKills: %d\nDeaths: %d\nK/D: %.2f\nCookies: %d",money,score,kills,deaths,kd,cookies);
  673. ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Stats",string,"Ok","");
  674. return 1;
  675. }
  676.  
  677. CMD:kill(playerid,params[])
  678. {
  679. SetPlayerHealth(playerid, 0);
  680. PlayerInfo[playerid][pDeaths]++;
  681. SendClientMessage(playerid, COLOR_RED,"You have commited suicide!");
  682. return 1;
  683. }
  684.  
  685. CMD:fix(playerid,params[])
  686. {
  687. RepairVehicle(GetPlayerVehicleID(playerid));
  688. SetVehicleHealth(playerid,1000);
  689. SendClientMessage(playerid, COLOR_WHITE, "You have fixed your vehicle!");
  690. return 1;
  691. }
Advertisement
Add Comment
Please, Sign In to add comment