Advertisement
Guest User

License

a guest
Mar 21st, 2010
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.34 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <dudb>
  7. #include <dutils>
  8. #include <core>
  9. #include <float>
  10. #include <time>
  11. #include <file>
  12. #include <Dini>
  13.  
  14.  
  15. #define GUN_LICENSE_PRICE 500
  16. #define DRIVING_LICENSE_PRICE 800
  17. #define FLYING_LICENSE_PRICE 2000
  18. #define FIRST_CHECKPOINT 1
  19. #define SECOND_CHECKPOINT 2
  20. #define THIRD_CHECKPOINT 3
  21. #define FORTH_CHECKPOINT 4
  22. #define FIVTH_CHECKPOINT 5
  23. #define SIXTH_CHECKPOINT 6
  24. #define SEVENTH_CHECKPOINT 7
  25. #define EIGHT_CHECKPOINT 8
  26. #define NINTH_CHECKPOINT 9
  27. #define TENTH_CHECKPOINT 10
  28. #define ELEVENTH_CHECKPOINT 11
  29. #define TWELVTH_CHECKPOINT 12
  30. #define THERTYTH_CHECKPOINT 13
  31. #define FORTHYTH_CHECKPOINT 14
  32. #define FIVTYTH_CHECKPOINT 15
  33. #define FIRSTS_CHECKPOINT 16
  34. #define SECONDS_CHECKPOINT 17
  35. #define THIRDS_CHECKPOINT 18
  36. #define FORTHS_CHECKPOINT 19
  37. #define FIVTHS_CHECKPOINT 20
  38. #define SIXTHS_CHECKPOINT 21
  39. #define SEVENTHS_CHECKPOINT 22
  40. #define EIGHTS_CHECKPOINT 23
  41. #define NINTHS_CHECKPOINT 24
  42. #define TENTHS_CHECKPOINT 25
  43. #define ELEVENTHS_CHECKPOINT 26
  44. #define TWELVTHS_CHECKPOINT 27
  45. #define THERTYTHS_CHECKPOINT 28
  46. #define grey 0xCECECEFF
  47. #define yellow 0xFFFF00FF
  48. #define aquablue 0x00FFFFAA
  49. enum Info
  50. {
  51. DrivingLicense,
  52. FlyingLicense,
  53. GunLicense,
  54. DrivingTest,
  55. FlyingTest,
  56. };
  57. new PlayerInfo[MAX_PLAYERS][Info];
  58. new Club1;
  59. new Club2;
  60. new Club3;
  61. new Shamal1;
  62. new Shamal2;
  63. new Shamal3;
  64. new gPlayerDrivingCheckpoints[MAX_PLAYERS];
  65. new gPlayerFlyingCheckpoints[MAX_PLAYERS];
  66. #if defined FILTERSCRIPT
  67. public OnFilterScriptInit()
  68. {
  69. Club1 = AddStaticVehicle(589,-2063.9539,-82.2557,34.8221,180.2107,1,1); // Club
  70. Club2 = AddStaticVehicle(589,-2068.3794,-82.2090,34.8230,179.5051,1,1); // Club
  71. Club3 = AddStaticVehicle(589,-2072.4880,-82.2655,34.8234,180.5852,1,1); // Club
  72. Shamal1 = AddStaticVehicle(519,-1371.1809,-232.4000,15.0783,315.6083,1,1); // Shamal
  73. Shamal2 = AddStaticVehicle(519,-1341.1012,-254.3704,15.0840,321.6337,1,1); // Shamal
  74. Shamal3 = AddStaticVehicle(519,-1206.2556,-146.5825,15.0670,134.1345,1,1); // Shamal
  75.  
  76. print("\n--------------------------------------");
  77. print(" Advance License System by DJ_Justin Loaded With succes.");
  78. print("--------------------------------------\n");
  79. return 1;
  80. }
  81.  
  82. public OnFilterScriptExit()
  83. {
  84. return 1;
  85. }
  86.  
  87. #else
  88.  
  89. main()
  90. {
  91. print("\n----------------------------------");
  92. print(" Advance License System by DJ_Justin UnLoaded With succes.");
  93. print("----------------------------------\n");
  94. }
  95.  
  96. #endif
  97. public OnPlayerConnect(playerid)
  98. {
  99. SetPlayerCheckpoint(playerid,5.0,-2031.7733,-116.9298,1035.1719,3.0); // De checkpoint voor de license
  100. SetPlayerMapIcon(playerid,0,-2026.6221,-99.6382,35.1641,55,0);
  101. new formatZ[256];
  102. format(formatZ,sizeof(formatZ),"%s.Account.txt",PlayerName(playerid));
  103. if(!udb_Exists(formatZ))
  104. {
  105. udb_Create(formatZ,"209010");
  106. }
  107. PlayerInfo[playerid][DrivingLicense] = dUserINT(formatZ).("CarLicense");
  108. PlayerInfo[playerid][FlyingLicense] = dUserINT(formatZ).("FlyLicense");
  109. PlayerInfo[playerid][GunLicense] = dUserINT(formatZ).("GunLicense");
  110. PlayerInfo[playerid][DrivingTest] = 0;PlayerInfo[playerid][FlyingTest] = 0;
  111. return 1;
  112. }
  113.  
  114. public OnPlayerDisconnect(playerid, reason)
  115. {
  116. new formatZ2[256];
  117. format(formatZ2,sizeof(formatZ2),"%s.Account.txt",PlayerName(playerid));
  118. dUserSetINT(formatZ2).("CarLicense",PlayerInfo[playerid][DrivingLicense]);
  119. dUserSetINT(formatZ2).("FlyLicense",PlayerInfo[playerid][FlyingLicense]);
  120. dUserSetINT(formatZ2).("GunLicense",PlayerInfo[playerid][GunLicense]);
  121. PlayerInfo[playerid][DrivingTest] = 0;PlayerInfo[playerid][FlyingTest] = 0;
  122. return 1;
  123. }
  124. stock PlayerName(playerid)
  125. {
  126. new name[255];
  127. GetPlayerName(playerid, name, 255);
  128. return name;
  129. }
  130. public OnPlayerSpawn(playerid)
  131. {
  132. return 1;
  133. }
  134.  
  135. public OnPlayerDeath(playerid, killerid, reason)
  136. {
  137. return 1;
  138. }
  139.  
  140. public OnVehicleSpawn(vehicleid)
  141. {
  142. return 1;
  143. }
  144.  
  145. public OnVehicleDeath(vehicleid, killerid)
  146. {
  147. return 1;
  148. }
  149.  
  150. public OnPlayerText(playerid, text[])
  151. {
  152. return 1;
  153. }
  154.  
  155. public OnPlayerCommandText(playerid, cmdtext[])
  156. {
  157. new pName[MAX_PLAYER_NAME];
  158. GetPlayerName(playerid,pName,sizeof(pName));
  159. new string[248];
  160. if (strcmp("/licenses", cmdtext, true, 10) == 0)
  161. {
  162. if(IsPlayerInRangeOfPoint(playerid,5.0,-2031.7733,-116.9298,1035.1719))
  163. {
  164. new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 500$";
  165. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
  166. return 1;
  167. }
  168. else if(!IsPlayerInRangeOfPoint(playerid,5.0,-2031.7733,-116.9298,1035.1719))
  169. {
  170. SendClientMessage(playerid,grey,"--> This command is only used at the SanFiero School.");
  171. }
  172. return 1;
  173. }
  174. if (strcmp("/sl", cmdtext, true, 10) == 0)
  175. {
  176. SendClientMessage(playerid,grey," Use: /sl [driving/flying/gun].");
  177. return 1;
  178. }
  179. if (strcmp("/sl driving", cmdtext, true, 10) == 0)
  180. {
  181. if(PlayerInfo[playerid][DrivingLicense] == 0)
  182. {
  183. format(string,sizeof(string)," %s doesnt have a valid Driving License",pName);
  184. SendClientMessageToAll(aquablue,string);
  185. }
  186. else if(PlayerInfo[playerid][DrivingLicense] == 1)
  187. {
  188. format(string,sizeof(string)," %s shows a legit Driving License.",pName);
  189. SendClientMessageToAll(aquablue,string);
  190. }
  191. return 1;
  192. }
  193. if (strcmp("/sl flying", cmdtext, true, 10) == 0)
  194. {
  195. if(PlayerInfo[playerid][FlyingLicense] == 0)
  196. {
  197. format(string,sizeof(string)," %s doesn't have a valid Flying License",pName);
  198. SendClientMessageToAll(aquablue,string);
  199. }
  200. else if(PlayerInfo[playerid][FlyingLicense] == 1)
  201. {
  202. format(string,sizeof(string)," %s shows a legit Flying License.",pName);
  203. SendClientMessageToAll(aquablue,string);
  204. }
  205. }
  206. if (strcmp("/sl gun", cmdtext, true, 10) == 0)
  207. {
  208. if(PlayerInfo[playerid][GunLicense] == 0)
  209. {
  210. format(string,sizeof(string)," %s doesn't have a valid Gun License",pName);
  211. SendClientMessageToAll(aquablue,string);
  212. }
  213. else if(PlayerInfo[playerid][GunLicense] == 1)
  214. {
  215. format(string,sizeof(string)," %s shows a legit Gun License.",pName);
  216. SendClientMessageToAll(aquablue,string);
  217. }
  218. }
  219. return 0;
  220. }
  221.  
  222. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  223. {
  224. return 1;
  225. }
  226.  
  227. public OnPlayerExitVehicle(playerid, vehicleid)
  228. {
  229. if(vehicleid == Club1 && PlayerInfo[playerid][DrivingTest] == 1)
  230. {
  231. GameTextForPlayer(playerid," ~y~ Test ~r~ Failed ~n~ ~w~ Because you have left the car.~n~ Visit the license center to try again.",4000,3);
  232. new testcar;
  233. testcar = GetPlayerVehicleID(playerid);
  234. RemovePlayerFromVehicle(playerid);
  235. SetVehicleToRespawn(testcar);
  236. PlayerInfo[playerid][DrivingTest] = 0;
  237. DisablePlayerRaceCheckpoint(playerid);
  238. }
  239. else if(vehicleid == Club2 && PlayerInfo[playerid][DrivingTest] == 1)
  240. {
  241. GameTextForPlayer(playerid," ~y~ Test ~r~ Failed ~n~ ~w~ Because you have left the car.~n~ Visit the license center to try again.",4000,3);
  242. new testcar;
  243. testcar = GetPlayerVehicleID(playerid);
  244. RemovePlayerFromVehicle(playerid);
  245. SetVehicleToRespawn(testcar);
  246. PlayerInfo[playerid][DrivingTest] = 0;
  247. DisablePlayerRaceCheckpoint(playerid);
  248. }
  249. else if(vehicleid == Club3 && PlayerInfo[playerid][DrivingTest] == 1)
  250. {
  251. GameTextForPlayer(playerid," ~y~ Test ~r~ Failed ~n~ ~w~ Because you have left the car.~n~ Visit the license center to try again.",4000,3);
  252. new testcar;
  253. testcar = GetPlayerVehicleID(playerid);
  254. RemovePlayerFromVehicle(playerid);
  255. SetVehicleToRespawn(testcar);
  256. PlayerInfo[playerid][DrivingTest] = 0;
  257. DisablePlayerRaceCheckpoint(playerid);
  258. }
  259. else if(vehicleid == Shamal1 && PlayerInfo[playerid][FlyingTest] == 1)
  260. {
  261. GameTextForPlayer(playerid," ~y~ Test ~r~ Failed ~n~ ~w~ Because you have left the plane.~n~ Visit the license center to try again.",4000,3);
  262. new testcar;
  263. testcar = GetPlayerVehicleID(playerid);
  264. RemovePlayerFromVehicle(playerid);
  265. SetVehicleToRespawn(testcar);
  266. PlayerInfo[playerid][FlyingTest] = 0;
  267. DisablePlayerRaceCheckpoint(playerid);
  268. }
  269. else if(vehicleid == Shamal2 && PlayerInfo[playerid][FlyingTest] == 1)
  270. {
  271. GameTextForPlayer(playerid," ~y~ Test ~r~ Failed ~n~ ~w~ Because you have left the plane.~n~ Visit the license center to try again.",4000,3);
  272. new testcar;
  273. testcar = GetPlayerVehicleID(playerid);
  274. RemovePlayerFromVehicle(playerid);
  275. SetVehicleToRespawn(testcar);
  276. PlayerInfo[playerid][FlyingTest] = 0;
  277. DisablePlayerRaceCheckpoint(playerid);
  278. }
  279. else if(vehicleid == Shamal3 && PlayerInfo[playerid][FlyingTest] == 1)
  280. {
  281. GameTextForPlayer(playerid," ~y~ Test ~r~ Failed ~n~ ~w~ Because you have left the plane.~n~ Visit the license center to try again.",4000,3);
  282. new testcar;
  283. testcar = GetPlayerVehicleID(playerid);
  284. RemovePlayerFromVehicle(playerid);
  285. SetVehicleToRespawn(testcar);
  286. PlayerInfo[playerid][FlyingTest] = 0;
  287. DisablePlayerRaceCheckpoint(playerid);
  288. }
  289. return 1;
  290. }
  291.  
  292. public OnPlayerStateChange(playerid, newstate, oldstate)
  293. {
  294. new vehicleid = GetPlayerVehicleID(playerid);
  295. if(vehicleid == Club1)
  296. {
  297. if(PlayerInfo[playerid][DrivingTest] == 0)
  298. {
  299. RemovePlayerFromVehicle(playerid);
  300. SendClientMessage(playerid,grey," You don't have the keys from this!");
  301. }
  302. else if(PlayerInfo[playerid][DrivingTest] == 1)
  303. {
  304. SetPlayerRaceCheckpoint(playerid,0,-2046.1495,-72.4681,34.8926,-2007.3123,-73.4380,34.8973,4.0);
  305. GameTextForPlayer(playerid," ~y~ Follow the ~r~ Checkpoints.~n~~y~ Don't ~r~ Damange ~y~ The Car.",4000,4);
  306. gPlayerDrivingCheckpoints[playerid] = FIRST_CHECKPOINT;
  307. }
  308. }
  309. else if(vehicleid == Club2)
  310. {
  311. if(PlayerInfo[playerid][DrivingTest] == 0)
  312. {
  313. RemovePlayerFromVehicle(playerid);
  314. SendClientMessage(playerid,grey," You don't have the keys from this!");
  315. }
  316. else if(PlayerInfo[playerid][DrivingTest] == 1)
  317. {
  318. SetPlayerRaceCheckpoint(playerid,0,-2046.1495,-72.4681,34.8926,-2007.3123,-73.4380,34.8973,4.0);
  319. GameTextForPlayer(playerid," ~y~ Follow the ~r~ Checkpoints.~n~~y~ Don't ~r~ Damange ~y~ The Car.",4000,4);
  320. gPlayerDrivingCheckpoints[playerid] = FIRST_CHECKPOINT;
  321. }
  322. }
  323. else if(vehicleid == Club3)
  324. {
  325. if(PlayerInfo[playerid][DrivingTest] == 0)
  326. {
  327. RemovePlayerFromVehicle(playerid);
  328. SendClientMessage(playerid,grey," You don't have the keys from this!");
  329. }
  330. else if(PlayerInfo[playerid][DrivingTest] == 1)
  331. {
  332. SetPlayerRaceCheckpoint(playerid,0,-2046.1495,-72.4681,34.8926,-2007.3123,-73.4380,34.8973,4.0);
  333. GameTextForPlayer(playerid," ~y~ Follow the ~r~ Checkpoints.~n~~y~ Don't ~r~ Damange ~y~ The Car.",4000,4);
  334. gPlayerDrivingCheckpoints[playerid] = FIRST_CHECKPOINT;
  335. }
  336. }
  337. else if(vehicleid == Shamal1)
  338. {
  339. if(PlayerInfo[playerid][FlyingTest] == 0)
  340. {
  341. RemovePlayerFromVehicle(playerid);
  342. SendClientMessage(playerid,grey," You don't have the keys from this!");
  343. }
  344. else if(PlayerInfo[playerid][FlyingTest] == 1)
  345. {
  346. SetPlayerRaceCheckpoint(playerid,3,-1628.0454,-134.6547,15.0706,-1444.2026,53.7472,22.4049,7.0);
  347. GameTextForPlayer(playerid," ~y~ Follow the ~r~ Checkpoints.~n~~y~ Don't ~r~ Damange ~y~ The Plane.",4000,4);
  348. gPlayerFlyingCheckpoints[playerid] = FIRSTS_CHECKPOINT;
  349. }
  350. }
  351. else if(vehicleid == Shamal2)
  352. {
  353. if(PlayerInfo[playerid][FlyingTest] == 0)
  354. {
  355. RemovePlayerFromVehicle(playerid);
  356. SendClientMessage(playerid,grey," You don't have the keys from this!");
  357. }
  358. else if(PlayerInfo[playerid][FlyingTest] == 1)
  359. {
  360. SetPlayerRaceCheckpoint(playerid,3,-1628.0454,-134.6547,15.0706,-1444.2026,53.7472,22.4049,7.0);
  361. GameTextForPlayer(playerid," ~y~ Follow the ~r~ Checkpoints.~n~~y~ Don't ~r~ Damange ~y~ The Plane.",4000,4);
  362. gPlayerFlyingCheckpoints[playerid] = FIRSTS_CHECKPOINT;
  363. }
  364. }
  365. else if(vehicleid == Shamal3)
  366. {
  367. if(PlayerInfo[playerid][FlyingTest] == 0)
  368. {
  369. RemovePlayerFromVehicle(playerid);
  370. SendClientMessage(playerid,grey," You don't have the keys from this!");
  371. }
  372. else if(PlayerInfo[playerid][FlyingTest] == 1)
  373. {
  374. SetPlayerRaceCheckpoint(playerid,3,-1628.0454,-134.6547,15.0706,-1444.2026,53.7472,22.4049,7.0);
  375. GameTextForPlayer(playerid," ~y~ Follow the ~r~ Checkpoints.~n~~y~ Don't ~r~ Damange ~y~ The Plane.",4000,4);
  376. gPlayerFlyingCheckpoints[playerid] = FIRSTS_CHECKPOINT;
  377. }
  378. }
  379. return 1;
  380. }
  381.  
  382. public OnPlayerEnterCheckpoint(playerid)
  383. {
  384. if(IsPlayerInRangeOfPoint(playerid,5.0,-2031.7733,-116.9298,1035.1719))
  385. {
  386. new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 500$";
  387. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
  388. return 1;
  389. }
  390. else if(!IsPlayerInRangeOfPoint(playerid,5.0,-2031.7733,-116.9298,1035.1719))
  391. {
  392. SendClientMessage(playerid,grey,"--> This command is only used at the SanFiero School.");
  393. }
  394. return 1;
  395. }
  396.  
  397. public OnPlayerLeaveCheckpoint(playerid)
  398. {
  399. return 1;
  400. }
  401.  
  402. public OnPlayerEnterRaceCheckpoint(playerid)
  403. {
  404. new vehicleid = GetPlayerVehicleID(playerid);
  405. new string[248];
  406. if(PlayerInfo[playerid][DrivingTest] == 1)
  407. {
  408. switch (gPlayerDrivingCheckpoints[playerid])
  409. {
  410. case FIRST_CHECKPOINT:
  411. {
  412. SetPlayerRaceCheckpoint(playerid,0,-2007.3123,-73.4380,34.8973,-2004.6874,11.4355,33.0038,4.0);
  413. gPlayerDrivingCheckpoints[playerid] = SECOND_CHECKPOINT;
  414. }
  415. case SECOND_CHECKPOINT:
  416. {
  417. SetPlayerRaceCheckpoint(playerid,0,-2004.6874,11.4355,33.0038,-2004.5037,200.9804,27.2662,4.0);
  418. gPlayerDrivingCheckpoints[playerid] = THIRD_CHECKPOINT;
  419. }
  420. case THIRD_CHECKPOINT:
  421. {
  422. SetPlayerRaceCheckpoint(playerid,0,-2004.5037,200.9804,27.2662,-1999.3391,373.2607,34.7428,4.0);
  423. gPlayerDrivingCheckpoints[playerid] = FORTH_CHECKPOINT;
  424. }
  425. case FORTH_CHECKPOINT:
  426. {
  427. SetPlayerRaceCheckpoint(playerid,0,-1999.3391,373.2607,34.7428,-1999.9409,503.2410,34.7427,4.0);
  428. gPlayerDrivingCheckpoints[playerid] = FIVTH_CHECKPOINT;
  429. }
  430. case FIVTH_CHECKPOINT:
  431. {
  432. SetPlayerRaceCheckpoint(playerid,0,-1999.9409,503.2410,34.7427,-2036.7159,506.7357,34.7392,4.0);
  433. gPlayerDrivingCheckpoints[playerid] = SIXTH_CHECKPOINT;
  434. }
  435. case SIXTH_CHECKPOINT:
  436. {
  437. SetPlayerRaceCheckpoint(playerid,0,-2036.7159,506.7357,34.7392,-2161.7175,508.6079,34.7427,4.0);
  438. gPlayerDrivingCheckpoints[playerid] = SEVENTH_CHECKPOINT;
  439. }
  440. case SEVENTH_CHECKPOINT:
  441. {
  442. SetPlayerRaceCheckpoint(playerid,0,-2161.7175,508.6079,34.7427,-2225.7688,510.7361,34.7486,4.0);
  443. gPlayerDrivingCheckpoints[playerid] = EIGHT_CHECKPOINT;
  444. }
  445. case EIGHT_CHECKPOINT:
  446. {
  447. SetPlayerRaceCheckpoint(playerid,0,-2225.7688,510.7361,34.7486,-2229.8179,457.5234,34.7393,4.0);
  448. gPlayerDrivingCheckpoints[playerid] = NINTH_CHECKPOINT;
  449. }
  450. case NINTH_CHECKPOINT:
  451. {
  452. SetPlayerRaceCheckpoint(playerid,0,-2229.8179,457.5234,34.7393,-2281.7944,393.8773,34.5240,4.0);
  453. gPlayerDrivingCheckpoints[playerid] = TENTH_CHECKPOINT;
  454. }
  455. case TENTH_CHECKPOINT:
  456. {
  457. SetPlayerRaceCheckpoint(playerid,0,-2281.7944,393.8773,34.5240,-2254.8110,320.7537,34.8988,4.0);
  458. gPlayerDrivingCheckpoints[playerid] = ELEVENTH_CHECKPOINT;
  459. }
  460. case ELEVENTH_CHECKPOINT:
  461. {
  462. SetPlayerRaceCheckpoint(playerid,0,-2255.3540,205.3027,34.8991,-2261.0242,-70.2846,34.8990,4.0);
  463. gPlayerDrivingCheckpoints[playerid] = TWELVTH_CHECKPOINT;
  464. }
  465. case TWELVTH_CHECKPOINT:
  466. {
  467. SetPlayerRaceCheckpoint(playerid,0,-2261.0242,-70.2846,34.8990,-2209.7490,-72.7662,34.8990,4.0);
  468. gPlayerDrivingCheckpoints[playerid] = THERTYTH_CHECKPOINT;
  469. }
  470. case THERTYTH_CHECKPOINT:
  471. {
  472. SetPlayerRaceCheckpoint(playerid,0,-2209.7490,-72.7662,34.8990,-2047.0022,-90.0552,34.8949,4.0);
  473. gPlayerDrivingCheckpoints[playerid] = FORTHYTH_CHECKPOINT;
  474. }
  475. case FORTHYTH_CHECKPOINT:
  476. {
  477. SetPlayerRaceCheckpoint(playerid,1,-2047.0022,-90.0552,34.8949,-2047.5490,-87.0332,35.1641,4.0);
  478. gPlayerDrivingCheckpoints[playerid] = FIVTYTH_CHECKPOINT;
  479. }
  480. case FIVTYTH_CHECKPOINT:
  481. {
  482. if(vehicleid == Club1 || vehicleid == Club2 || vehicleid == Club3)
  483. {
  484. new Float:Health;
  485. new testcar;
  486. testcar = GetPlayerVehicleID(playerid);
  487. GetVehicleHealth(testcar,Health);
  488. if(Health < 1000.0)
  489. {
  490. format(string,sizeof(string)," You have fail the test because you have damange the car. Visit the License Center to do it again.");
  491. SendClientMessage(playerid,yellow,string);
  492. DisablePlayerRaceCheckpoint(playerid);
  493. GameTextForPlayer(playerid," ~w~Test Completed. Check your results.",3000,3);
  494. RemovePlayerFromVehicle(playerid);
  495. SetVehicleToRespawn(testcar);
  496. PlayerInfo[playerid][DrivingTest] = 0;
  497. return 1;
  498. }
  499. else if(Health >= 999.0)
  500. {
  501. DisablePlayerRaceCheckpoint(playerid);
  502. GameTextForPlayer(playerid," ~w~Test Completed. Check your results.",3000,3);
  503. format(string,sizeof(string)," You have pass the Test. Here is your legit driving license. Use /sl to show it.");
  504. SendClientMessage(playerid,yellow,string);
  505. PlayerInfo[playerid][DrivingLicense] = 1;
  506. RemovePlayerFromVehicle(playerid);
  507. SetVehicleToRespawn(testcar);
  508. PlayerInfo[playerid][DrivingTest] = 0;
  509. return 1;
  510. }
  511. }
  512. }
  513. }
  514. }
  515. else if(PlayerInfo[playerid][FlyingTest] == 1)
  516. {
  517. switch (gPlayerFlyingCheckpoints[playerid])
  518. {
  519. case FIRSTS_CHECKPOINT:
  520. {
  521. SetPlayerRaceCheckpoint(playerid,3,-1444.2026,53.7472,22.4049,-1133.9303,333.3353,59.9484,7.0);
  522. gPlayerDrivingCheckpoints[playerid] = SECONDS_CHECKPOINT;
  523. }
  524. case SECONDS_CHECKPOINT:
  525. {
  526. SetPlayerRaceCheckpoint(playerid,3,-1133.9303,333.3353,61.9484,-784.5469,437.4159,70.0663,7.0);
  527. gPlayerDrivingCheckpoints[playerid] = THIRDS_CHECKPOINT;
  528. }
  529. case THIRDS_CHECKPOINT:
  530. {
  531. SetPlayerRaceCheckpoint(playerid,3,-784.5469,437.4159,70.0663,-441.9236,571.4546,86.6628,7.0);
  532. gPlayerDrivingCheckpoints[playerid] = FORTHS_CHECKPOINT;
  533. }
  534. case FORTHS_CHECKPOINT:
  535. {
  536. SetPlayerRaceCheckpoint(playerid,3,-441.9236,571.4546,86.6628,-94.3545,814.2031,83.5022,7.0);
  537. gPlayerDrivingCheckpoints[playerid] = FIVTHS_CHECKPOINT;
  538. }
  539. case FIVTHS_CHECKPOINT:
  540. {
  541. SetPlayerRaceCheckpoint(playerid,3,-94.3545,814.2031,83.5022,206.8825,1103.8097,79.5797,7.0);
  542. gPlayerDrivingCheckpoints[playerid] = SIXTHS_CHECKPOINT;
  543. }
  544. case SIXTHS_CHECKPOINT:
  545. {
  546. SetPlayerRaceCheckpoint(playerid,3,206.8825,1103.8097,79.5797,360.8752,1433.6638,84.1947,7.0);
  547. gPlayerDrivingCheckpoints[playerid] = SEVENTHS_CHECKPOINT;
  548. }
  549. case SEVENTHS_CHECKPOINT:
  550. {
  551. SetPlayerRaceCheckpoint(playerid,3,237.0898,1716.8671,99.5659,-248.8507,1823.7936,109.7424,7.0);
  552. gPlayerDrivingCheckpoints[playerid] = EIGHTS_CHECKPOINT;
  553. }
  554. case EIGHTS_CHECKPOINT:
  555. {
  556. SetPlayerRaceCheckpoint(playerid,3,-248.8507,1823.7936,109.7424,-575.5409,1712.1396,132.7493,7.0);
  557. gPlayerDrivingCheckpoints[playerid] = NINTHS_CHECKPOINT;
  558. }
  559. case NINTHS_CHECKPOINT:
  560. {
  561. SetPlayerRaceCheckpoint(playerid,3,-575.5409,1712.1396,132.7493,-864.1115,1465.8033,93.3561,7.0);
  562. gPlayerDrivingCheckpoints[playerid] = TENTHS_CHECKPOINT;
  563. }
  564. case TENTHS_CHECKPOINT:
  565. {
  566. SetPlayerRaceCheckpoint(playerid,3,-864.1115,1465.8033,93.3561,-947.1935,1092.1521,79.0029,7.0);
  567. gPlayerDrivingCheckpoints[playerid] = ELEVENTHS_CHECKPOINT;
  568. }
  569. case ELEVENTHS_CHECKPOINT:
  570. {
  571. SetPlayerRaceCheckpoint(playerid,3,-947.1935,1092.1521,79.0029,-1172.3732,333.8894,47.6421,7.0);
  572. gPlayerDrivingCheckpoints[playerid] = TWELVTHS_CHECKPOINT;
  573. }
  574. case TWELVTHS_CHECKPOINT:
  575. {
  576. SetPlayerRaceCheckpoint(playerid,4,-1172.3732,333.8894,47.6421,-1533.0518,-36.5082,15.1076,7.0);
  577. gPlayerDrivingCheckpoints[playerid] = THERTYTH_CHECKPOINT;
  578. }
  579. case THERTYTHS_CHECKPOINT:
  580. {
  581. if(vehicleid == Shamal1 || vehicleid == Shamal2 || vehicleid == Shamal3)
  582. {
  583. new Float:Health;
  584. new testcar;
  585. testcar = GetPlayerVehicleID(playerid);
  586. GetVehicleHealth(testcar,Health);
  587. if(Health < 1000.0)
  588. {
  589. format(string,sizeof(string)," You have fail the test because you have damange the plane. Visit the License Center to do it again.");
  590. SendClientMessage(playerid,yellow,string);
  591. DisablePlayerRaceCheckpoint(playerid);
  592. GameTextForPlayer(playerid," ~w~Test Completed. Check your results.",3000,3);
  593. RemovePlayerFromVehicle(playerid);
  594. SetVehicleToRespawn(testcar);
  595. PlayerInfo[playerid][FlyingTest] = 0;
  596. return 1;
  597. }
  598. else if(Health >= 999.0)
  599. {
  600. DisablePlayerRaceCheckpoint(playerid);
  601. GameTextForPlayer(playerid," ~w~Test Completed. Check your results.",3000,3);
  602. format(string,sizeof(string)," You have pass the Test. Here is your legit Flying license. Use /sl to show it.");
  603. SendClientMessage(playerid,yellow,string);
  604. PlayerInfo[playerid][FlyingLicense] = 1;
  605. RemovePlayerFromVehicle(playerid);
  606. SetVehicleToRespawn(testcar);
  607. PlayerInfo[playerid][FlyingTest] = 0;
  608. return 1;
  609. }
  610. }
  611. }
  612. }
  613. }
  614. return 1;
  615. }
  616.  
  617. public OnPlayerLeaveRaceCheckpoint(playerid)
  618. {
  619. return 1;
  620. }
  621.  
  622. public OnRconCommand(cmd[])
  623. {
  624. return 1;
  625. }
  626.  
  627. public OnPlayerRequestSpawn(playerid)
  628. {
  629. return 1;
  630. }
  631.  
  632. public OnObjectMoved(objectid)
  633. {
  634. return 1;
  635. }
  636.  
  637. public OnPlayerObjectMoved(playerid, objectid)
  638. {
  639. return 1;
  640. }
  641.  
  642. public OnPlayerPickUpPickup(playerid, pickupid)
  643. {
  644. return 1;
  645. }
  646.  
  647. public OnVehicleMod(playerid, vehicleid, componentid)
  648. {
  649. return 1;
  650. }
  651.  
  652. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  653. {
  654. return 1;
  655. }
  656.  
  657. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  658. {
  659. return 1;
  660. }
  661.  
  662. public OnPlayerSelectedMenuRow(playerid, row)
  663. {
  664. return 1;
  665. }
  666.  
  667. public OnPlayerExitedMenu(playerid)
  668. {
  669. return 1;
  670. }
  671.  
  672. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  673. {
  674. return 1;
  675. }
  676.  
  677. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  678. {
  679. return 1;
  680. }
  681.  
  682. public OnRconLoginAttempt(ip[], password[], success)
  683. {
  684. return 1;
  685. }
  686.  
  687. public OnPlayerUpdate(playerid)
  688. {
  689. return 1;
  690. }
  691.  
  692. public OnPlayerStreamIn(playerid, forplayerid)
  693. {
  694. return 1;
  695. }
  696.  
  697. public OnPlayerStreamOut(playerid, forplayerid)
  698. {
  699. return 1;
  700. }
  701.  
  702. public OnVehicleStreamIn(vehicleid, forplayerid)
  703. {
  704. return 1;
  705. }
  706.  
  707. public OnVehicleStreamOut(vehicleid, forplayerid)
  708. {
  709. return 1;
  710. }
  711.  
  712. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  713. {
  714. if(dialogid == 1)
  715. {
  716. if(response)
  717. {
  718. if(listitem == 0)
  719. {
  720. if(GetPlayerMoney(playerid) < DRIVING_LICENSE_PRICE)
  721. {
  722. SendClientMessage(playerid,yellow," You don't have enough money.");
  723. new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 1200$";
  724. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
  725. }
  726. else if(GetPlayerMoney(playerid) >= DRIVING_LICENSE_PRICE)
  727. {
  728. GivePlayerMoney(playerid,-DRIVING_LICENSE_PRICE);
  729. SendClientMessage(playerid,yellow," Hint: Get a car from the park to start the test.");
  730. PlayerInfo[playerid][DrivingTest] = 1;
  731. }
  732. }
  733. else if(listitem == 1)
  734. {
  735. if(GetPlayerMoney(playerid) < FLYING_LICENSE_PRICE)
  736. {
  737. SendClientMessage(playerid,yellow," You don't have enough money.");
  738. new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 1200$";
  739. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
  740. }
  741. else if(GetPlayerMoney(playerid) >= FLYING_LICENSE_PRICE)
  742. {
  743. GivePlayerMoney(playerid,-FLYING_LICENSE_PRICE);
  744. SendClientMessage(playerid,yellow," Hint: Get a shamal from the San Fiero Airport to start the test.");
  745. PlayerInfo[playerid][FlyingTest] = 1;
  746. }
  747. }
  748. else if(listitem == 2)
  749. {
  750. if(GetPlayerMoney(playerid) < GUN_LICENSE_PRICE)
  751. {
  752. SendClientMessage(playerid,yellow," You don't have enough money.");
  753. new dtests[] = "1\tDriving License - 800$\n2\tFlying License - 2000$\n3\tGun License - 1200$";
  754. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Licenses, Chose One:",dtests,"Test","Exit");
  755. }
  756. else if(GetPlayerMoney(playerid) >= GUN_LICENSE_PRICE)
  757. {
  758. GivePlayerMoney(playerid,-FLYING_LICENSE_PRICE);
  759. SendClientMessage(playerid,yellow," You have bought the gun license.Type /sl to show it!");
  760. PlayerInfo[playerid][GunLicense] = 1;
  761. }
  762. }
  763. }
  764. }
  765. return 1;
  766. }
  767.  
  768. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  769. {
  770. return 1;
  771. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement