Advertisement
Guest User

Jobs

a guest
Jun 21st, 2016
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 102.61 KB | None | 0 0
  1. /*
  2. All jobs(besides side-jobs for now at least) go here
  3. PVars here:
  4. JobTime(int) - Job contract time
  5. JobPickupCooldown(int) - time since last pickup
  6. TrashRoute(int) - Route ID of route you are on
  7. TrashRouteIndex(int) - Index of your last completed route
  8. */
  9.  
  10. #define MAX_JOB_NAME 32
  11. #define JOB_EXPIRE_TIME 3600
  12. #define JOB_PICKUP_COOLDOWN 15
  13. #define TAXI_CHARGE_TIME 15
  14. #define MECH_OFFER_COOLDOWN 30 //seconds you must wait before offering someone another refill
  15.  
  16.  
  17. enum EJobInfo {
  18. EJobName[MAX_JOB_NAME],
  19. Float:EJobPickupX,
  20. Float:EJobPickupY,
  21. Float:EJobPickupZ,
  22. EJobPickupInt,
  23. EJobPickupVW,
  24. EJobPickupID,
  25. Text3D:EJobText,
  26. Float:EJobSpotX,
  27. Float:EJobSpotY,
  28. Float:EJobSpotZ,
  29. EJob_Illegal,
  30. };
  31. //todo: mechanic, lawyer, trucker?
  32.  
  33. new JobPickups[][EJobInfo] = {
  34. {"Trash Cleaner",359.68, 180.25, 1008.38, 3, 1, 0, Text3D:0,2322.636474, -2077.395263, 13.321226, 0},
  35. {"Drug Dealer",2143.82, -1674.08, 15.09,0 ,0 ,0 , Text3D:0,2168.98, -1679.85, -15.09, 1},
  36. {"Arms Dealer",2666.66, -1108.06, 69.39,0 ,0 ,0 , Text3D:0,2666.66, -1108.06, 69.39, 1},
  37. {"Taxi Driver", 359.47, 184.91, 1008.38, 3, 1, 0 ,Text3D:0, 1763.25, -1900.96, 13.56, 0},
  38. {"Mercenary", 757.99, 5.37, 1000.70, 5,0, 0, Text3D:0,2232.48, -1726.69, 13.55, 1},
  39. {"Mechanic",358.99, 167.42, 1008.38, 3, 1, 0, Text3D:0, 1637.53, -1103.15, 23.91, 0},
  40. {"Smuggler",2196.027832, -2236.349121, 13.546875, 0, 0, 0, Text3D:0,2187.762695, -2273.814208, 13.546875,1},
  41. {"Lawyer",358.99, 163.11, 1008.38, 3, 1, 0, Text3D:0,358.62, 163.11, 1008.38,0},
  42. {"Pizza Man",2100.7856, -1804.1826, 13.5546, 0, 0, 0, Text3D:0,2100.7856, -1804.1826, 13.5546,0},
  43. {"Crafter",1900.399780, -1769.010864, 13.557812, 0, 0, 0, Text3D:0,1900.399780, -1769.010864, 13.557812,1}
  44. };
  45.  
  46. enum ETrashPathRouteInfo {
  47. Float:ETrashPointX,
  48. Float:ETrashPointY,
  49. Float:ETrashPointZ,
  50. ETrashPointName[32],
  51. ETrashRouteIndex,
  52. };
  53.  
  54. enum ETrashRouteInfo {
  55. ETrashPathName[32],
  56. ETrashPathReward,
  57. }
  58.  
  59. new TrashRoutePaths[][ETrashPathRouteInfo] = {
  60. //ROUTE 1
  61. {2691.063476,-2051.785400,13.184736,"WillowField",0},
  62. {2870.521484,-1690.922363,10.587408,"East Beach",0},
  63. {2659.175781,-1655.355590,10.403504,"LS Stadium",0},
  64. {2470.913330,-1441.509521,24.324380,"East Los Santos",0},
  65. {2164.099365,-1382.546142,23.533029,"Jefferson",0},
  66. {2109.733154,-1679.819946,13.078238,"Idlewood",0},
  67. {2170.679443,-1895.969116,13.075672,"WillowField",0},
  68. {2292.956298,-2095.010009,13.017915,"Route End",0},
  69. //ROUTE 2
  70. {2216.190185,-1988.616699,13.040861,"Willowfield",1},
  71. {1926.863403,-1930.061645,13.088657,"El Corona",1},
  72. {1754.740112,-1818.431030,13.089556,"Unity Station",1},
  73. {1531.803222,-1699.604003,13.087725,"LSPD",1},
  74. {1327.480468,-1570.967895,13.066282,"Commerce",1},
  75. {1359.933349,-1160.671630,23.377698,"Market",1},
  76. {1750.039672,-1166.117309,23.338724,"Downtown LS",1},
  77. {1846.061157,-1419.971923,13.095695,"Glen Park",1},
  78. {1819.081665,-1677.358276,13.086851,"Alhambra",1},
  79. {1872.731811,-1934.315917,13.087196,"El Corona",1},
  80. {2083.479248,-1909.324951,13.085927,"Willowfield",1},
  81. {2290.508300,-2092.346679,13.023062,"Route End",1},
  82. //ROUTE 3
  83. {2579.897705,-2380.190429,13.271441,"Ocean Docks",2},
  84. {2759.141113,-2460.304199,13.230901,"Ocean Docks",2},
  85. {2481.328369,-2578.465576,13.202222,"Ocean Docks",2},
  86. {2227.451416,-2511.699218,13.073944,"LS international",2},
  87. {1993.087402,-2670.601806,9.175144,"LS international",2},
  88. {1425.037109,-2666.486572,13.081760,"LS international",2},
  89. {1360.127563,-2498.104248,11.276537,"LS international",2},
  90. {1156.496093,-2397.232666,10.565136,"Verdant Bluffs",2},
  91. {970.303161,-1779.998046,13.803142,"Verona Beach",2},
  92. {599.539733,-1722.524780,13.409934,"Santa Maria Beach",2},
  93. {169.744522,-1575.317504,12.383356,"Rodeo",2},
  94. {425.769714,-1344.217895,14.585289,"Rodeo",2},
  95. {852.563293,-1023.404968,27.375007,"Vinewood",2},
  96. {1389.450927,-944.808898,33.931022,"Vinewood",2},
  97. {1879.583740,-1019.491210,35.827777,"Glen Park",2},
  98. {2173.109375,-1203.408203,23.629276,"Jefferson",2},
  99. {2199.435302,-1386.091918,23.535583,"Jefferson",2},
  100. {2213.217285,-1720.550903,13.061816,"Idlewood",2},
  101. {2291.020507,-2092.607421,13.025842,"Route End",2}
  102. };
  103.  
  104. new TrashRoutes[][ETrashRouteInfo] = {
  105. {"Route 1", 1500},
  106. {"Route 2", 2000},
  107. {"Route 3", 3500}
  108. };
  109.  
  110. enum ERouteInfo {
  111. Float:EIRX,
  112. Float:EIRY,
  113. Float:EIRZ,
  114. };
  115. new SmugglerRoutes[][ERouteInfo] = {
  116. {1772.720703, -2033.463745, 13.505705 },
  117. {1088.4084, -1233.2270, 15.820067},
  118. {979.586853, -1262.702514, 16.064537},
  119. {-181.542510, -229.433868, 1.421875},
  120. {-486.772399, -504.286651, 25.517845},
  121. {-550.643310, -189.008956, 78.406250},
  122. {-1679.117797, 25.621912, 3.554687},
  123. {-2115.599609, -5.170641, 35.320312},
  124. {-2127.572509, -213.948745, 35.320312},
  125. {797.450378, -610.869201, 16.335937},
  126. {-2529.896240, 2362.714843, 4.986008},
  127. {-2632.307617, 1373.401611, 7.111227},
  128. {-2220.531982, -125.551269, 35.320312}
  129. };
  130.  
  131. enum EGunJobPrices {
  132. EGunJobName[10],
  133. EGunJobWeaponID,
  134. EGunJobAMats,
  135. EGunJobBMats,
  136. EGunJobCMats,
  137. EGunJobLevel,
  138. EGunJobLevelUp, //0 Doesn't level up, 1 to level up per sale
  139. };
  140.  
  141.  
  142. enum ESkillInfo {
  143. ESkill_Name[32],
  144. ESkill_PVarName[32],
  145. ESkill_Level1Points,
  146. ESkill_Level2Points,
  147. ESkill_Level3Points,
  148. ESkill_Level4Points,
  149. ESkill_Level5Points,
  150. ESkill_Job, //if the skill is associated with a job
  151. ESkill_LevelUpStr[128],
  152. };
  153. new Skills[][ESkillInfo] = {{"Gun Skill","gunskill",50,100,200,300,500,EJobType_Arms_Dealer, "You have to sell %d more guns to reach the next level!"},
  154. {"Drug Skill","drugskill",50,100,200,300,500,EJobType_Drug_Dealer, "You have to sell %d more drugs to reach the next level!"},
  155. {"Mercenary Skill","mercskill",50,100,200,300,500,EJobType_Mercenary, "%d"},
  156. {"Lock Picking Skill","lockskill",50,100,200,300,500,-1, "You need to jack %d more cars to reach the next level!"},
  157. {"Mechanic Skill","mechskill",50,100,200,300,500,EJobType_Mechanic, "Service %d more cars"},
  158. //{"Fishing Skill","fishskill",50,100,200,300,500,-1, "Catch %d more fish"},
  159. {"Boxing Skill","boxskill",50,100,200,300,500,-1, "Win %d more fights"},
  160. {"Lawyer Skill","lawyerskill",50,100,200,300,500,EJobType_Lawyer, "Free %d more people"},
  161. {"Crafter Skill","crafterskill",50,100,200,300,500,EJobType_Crafter, "Craft %d more items"}
  162. };
  163.  
  164. new GunJobPrices[][EGunJobPrices] = {{"9mm",22,3000,2500,3000,1,1},
  165. {"sdpistol",3500,3000,3500,0,2,1},
  166. {"bat",5,2500,1500,1500,0,1},
  167. {"mace",41,900,200,0,2,1},
  168. {"fire",42,800,200,0,2,1},
  169. {"knuckles",1,800,0,0,0,1},
  170. {"shovel",6,800,0,0,0,1},
  171. {"flowers",14,800,0,0,0,0},
  172. {"eagle",24,3500,3000,3500,3,1},
  173. {"uzi",28,4000,2500,4000,3,1},
  174. {"tec9",32,4000,2500,4000,3,1},
  175. {"mp5",29,7000,5500,7000,3,1},
  176. {"shotgun",25,5500,3500,4000,2,1},
  177. {"spas12",27,11000,11000,11000,5,1},
  178. {"ak47",30,10000,9500,10000,4,1},
  179. {"m4",31,11000,11000,11000,3,1},
  180. {"rifle",33,10000,10000,9000,2,1},
  181. {"sniper",34,16000,16000,16000,2,1},
  182. {"club",2,600,0,0,1,1},
  183. {"golf",2,600,0,0,1,1},
  184. {"cue",7,600,0,0,1,1}
  185. };
  186.  
  187. enum {
  188. EJobs_JobOffer = EJob_Base + 1,
  189. EJobs_TrashDialog = EJobs_JobOffer + 10,
  190. EJobs_GunSellDialog,
  191. EJobs_DrugSellDialog,
  192. EJobs_SkillsDialog,
  193. EJobs_SkillInfoDialog,
  194. EJobs_RefillOffer,
  195. EJobs_RepairOffer,
  196. EJobs_TuneMenu,
  197. EJobs_SpotMenu,
  198. EJobs_SetSkillLevelMenu,
  199. EJobs_SetSkillLevel,
  200. EJobs_SellVest,
  201. EJobs_LawyerFree,
  202. };
  203.  
  204. enum EBuyableComponentInfo {
  205. ECompInfoDispName[64],
  206. ECompInfoID,
  207. ECompPrice,
  208. }
  209. new BuyableComponents[][EBuyableComponentInfo] = {{"2x Nitro",1009,500}
  210. , {"5x Nitro",1008,1500}
  211. , {"10x Nitro",1010,2000}
  212. , {"Shadow Rims",1073,500}
  213. , {"Mega Rims",1074,700}
  214. , {"Rimshine Rims",1075,800}
  215. , {"Wire Rims",1076,1000}
  216. , {"Classic Rims",1077,1200}
  217. , {"Twist Rims",1078,1400}
  218. , {"Cutter Rims",1079,1700}
  219. , {"Switch Rims",1080,1900}
  220. , {"Grove Rims",1081,2000}
  221. , {"Import Rims",1082,2800}
  222. , {"Dollar Rims",1083,3000}
  223. , {"Trance Rims",1084,3400}
  224. , {"Atomic Rims",1085,3800}
  225. , {"Hydraulics",1087,1000}
  226. };
  227.  
  228. new lastpayday;
  229. jobsOnGameModeInit() {
  230. for(new i=0;i<sizeof(JobPickups);i++) {
  231. JobPickups[i][EJobText] = CreateDynamic3DTextLabel(JobPickups[i][EJobName], 0x2BFF00AA, JobPickups[i][EJobPickupX], JobPickups[i][EJobPickupY], JobPickups[i][EJobPickupZ]+1.5, 100.0,INVALID_PLAYER_ID, INVALID_VEHICLE_ID,0,JobPickups[i][EJobPickupVW], JobPickups[i][EJobPickupInt]);
  232. JobPickups[i][EJobPickupID] = CreateDynamicPickup(1239, 16, JobPickups[i][EJobPickupX], JobPickups[i][EJobPickupY], JobPickups[i][EJobPickupZ], JobPickups[i][EJobPickupVW], JobPickups[i][EJobPickupInt]);
  233. }
  234. new Hour, Minute, Second;
  235. new timenow = gettime(Hour,Minute, Second);
  236. timenow -= (Minute*60)-Second;
  237. lastpayday = timenow;
  238. //new minsleft = 60-Minute; //minutes left until next pay day
  239. //new timeleft = ((minsleft * 60)-Second) * 1000;
  240. //printf("payday in: %d %d\n",minsleft,timeleft);
  241. //paydaytimer = SetTimerEx("Payday",timeleft,false,"d",1);
  242. }
  243. new payhour = -1;
  244. checkPayday() {
  245. new Hour, Minute, Second;
  246. gettime(Hour,Minute, Second);
  247. new timenow = gettime();
  248. if(Hour != payhour) {
  249. if(timenow > lastpayday+3600 && (Minute > 0 && Minute < 5)) {
  250. payhour = Hour;
  251. lastpayday = gettime();
  252. Payday();
  253. }
  254. }
  255. }
  256. Payday() {
  257. new Hour, Minute, Second;
  258. gettime(Hour,Minute, Second);
  259. //printf("payday timer called at %02d:%02d:%02d\n",Hour,Minute, Second);
  260. SetWorldTime(Hour);
  261. new string[128];
  262.  
  263. turfsOnPayDay();
  264. plantsOnPayday();
  265. //swapWeather();
  266. foreach(Player, i) {
  267. if(!IsPlayerConnectEx(i)) {
  268. continue;
  269. }
  270. new logintime = GetPVarInt(i, "CharLoginTime");
  271. if(gettime() - logintime < 600) {
  272. SendClientMessage(i, X11_TOMATO_2, "You haven't been playing long enough to earn a paycheck(10 minutes)!");
  273. continue;
  274. }
  275. new level = GetPVarInt(i, "Level");
  276. new paycheck = GetPVarInt(i, "Payday");
  277. paycheck += 1000;
  278. if(level >= 10) {
  279. paycheck += 1000 + (level * 500);
  280. } else {
  281. paycheck += 500 + (level * 500);
  282. }
  283. new account = GetPVarInt(i, "Bank");
  284. //Everything is calculated, display it all
  285. SendClientMessage(i, COLOR_GREENISHGOLD, "|___ BANK STATEMENT ___|");
  286. format(string, sizeof(string), " Paycheck: $%s", getNumberString(paycheck));
  287. SendClientMessage(i, COLOR_GREEN, string);
  288. format(string, sizeof(string), " Balance: $%s", getNumberString(account));
  289. SendClientMessage(i, COLOR_GREEN, string);
  290. if(server_taxrate != 0) {
  291. new Float:tax = server_taxrate*0.01;
  292. new rtax = floatround(tax*paycheck);
  293. format(string, sizeof(string), " Tax: %d percent ($%s)", server_taxrate,getNumberString(rtax));
  294. SendClientMessage(i, COLOR_GREEN, string);
  295. account -= rtax;
  296. }
  297. new ticketprice = GetPVarInt(i, "TicketTotal");
  298. if(ticketprice > 0) {
  299. new tprice = floatround(ticketprice/5.0);
  300. format(string, sizeof(string), " Unpaid Ticket Fine: -$%s",getNumberString(tprice));
  301. SendClientMessage(i, COLOR_GREEN, string);
  302. account -= tprice;
  303. }
  304. //SendClientMessage(i, COLOR_GREEN, string);
  305. //format(string, sizeof(string), " Rent: -$%s", getNumberString(rent));
  306. new housetax = getHouseTax(i);
  307. if(housetax > 5000) housetax = 5000;
  308. format(string, sizeof(string), " Property Tax: -$%s", getNumberString(housetax));
  309. SendClientMessage(i, COLOR_GREEN, string);
  310. new rprice = getRentPrice(i);
  311. if(rprice != 0) {
  312. format(string, sizeof(string), " Rent: -$%s", getNumberString(rprice));
  313. SendClientMessage(i, COLOR_GREEN, string);
  314. account -= rprice;
  315. }
  316. new uflags = GetPVarInt(i, "UserFlags");
  317. if(uflags & EUFHasCarInsurance) {
  318. new insuranceprice = getInsurancePaydayPrice(i);
  319. format(string, sizeof(string), " Vehicle Insurance: -$%s", getNumberString(insuranceprice));
  320. SendClientMessage(i, COLOR_GREEN, string);
  321. account -= insuranceprice;
  322. }
  323. if(uflags & EUFHasHealthInsurance) {
  324. new hprice = getHealthInsurancePrice(i);
  325. format(string, sizeof(string), " Health Insurance: -$%s", getNumberString(hprice));
  326. SendClientMessage(i, COLOR_GREEN, string);
  327. account -= hprice;
  328. }
  329. new rentcarprice = GetTotalRentCarPrice(i);
  330. if(rentcarprice != 0) {
  331. format(string, sizeof(string), " Car Rentals: -$%s",getNumberString(rentcarprice));
  332. SendClientMessage(i, COLOR_GREEN, string);
  333. account -= rentcarprice;
  334. }
  335. paycheck += getFactionPay(i);
  336. account -= housetax;
  337. SetPVarInt(i, "Bank", account);
  338. /* Double Bonus START */
  339. if(server_doublebonus != 0) {
  340. SetPVarInt(i, "RespectPoints", GetPVarInt(i, "RespectPoints")+2);
  341. } else {
  342. SetPVarInt(i, "RespectPoints", GetPVarInt(i, "RespectPoints")+1);
  343. }
  344. /* Double Bonus END */
  345. new ctime = GetPVarInt(i, "ConnectTime");
  346. if(++ctime == 50) {
  347. new dps = GetPVarInt(i, "DonatePoints");
  348. dps += 50;
  349. SetPVarInt(i, "DonatePoints",dps);
  350. GiveMoneyEx(i, 10000);
  351. dps = GetPVarInt(i, "Cookies");
  352. dps++;
  353. SetPVarInt(i, "Cookies", dps);
  354. format(string, sizeof(string), "* %s has reached 50 playing hours, and recieved $10,000, 50 donator points,and a cookie!",GetPlayerNameEx(i, ENameType_CharName));
  355. SendGlobalAdminMessage(X11_YELLOW,string);
  356. SendClientMessage(i, COLOR_LIGHTGREEN, "* You have reached 50 playing hours, and have recieved $10,000, 10 donator points, and a cookie! Congratulations!");
  357. SetPlayerColor(i, getNameTagColour(i));
  358. }
  359.  
  360. if(numPlayersOnServer() < 40) {
  361. new bonus = floatround(paycheck*0.25);
  362. format(string, sizeof(string), "(( Low Player Bonus: $%s ))", getNumberString(bonus));
  363. SendClientMessage(i, COLOR_GREEN, string);
  364. paycheck += bonus;
  365. }
  366. /*
  367. if(numPlayersOnServer() > 80) {
  368. new bonus = floatround(paycheck*0.50);
  369. format(string, sizeof(string), "(( High Player Bonus: $%s ))", getNumberString(bonus));
  370. SendClientMessage(i, COLOR_GREEN, string);
  371. paycheck += bonus;
  372. }
  373. */
  374. SetPVarInt(i, "ConnectTime", ctime);
  375. format(string, sizeof(string), " New Balance: $%s ($%s)", getNumberString(account),getNumberString(account+paycheck));
  376. //doBankSettlement(i);
  377. SendClientMessage(i, COLOR_GREEN, string);
  378. SendClientMessage(i, COLOR_GREENISHGOLD, "|---------------------------------|");
  379. SendClientMessage(i, COLOR_LIGHTGREEN, "(( Do /signcheck to get your paycheck ))");
  380. /* Double Bonus START */
  381. if(server_doublebonus != 0) {
  382. SetPVarInt(i, "PayCheque", paycheck*2);
  383. } else {
  384. SetPVarInt(i, "PayCheque", paycheck);
  385. }
  386. /* Double Bonus END */
  387. DeletePVar(i, "Payday");
  388. GameTextForPlayer(i, "~g~Pay Day", 5000, 1);
  389. }
  390. playLotto();
  391. }
  392. getFactionPay(playerid)
  393. {
  394. new amount;
  395. new faction = GetPVarInt(playerid, "Faction");
  396. new rank = GetPVarInt(playerid, "Rank");
  397. new msg[128];
  398. if(faction == 1) {
  399. amount = rank*500;
  400. format(msg, sizeof(msg), " LSPD Paycheck: $%s",getNumberString(amount));
  401. SendClientMessage(playerid, COLOR_GREEN, msg);
  402. } else if(faction == 2) {
  403. amount = rank*1100;
  404. format(msg, sizeof(msg), " FBI Paycheck: $%s",getNumberString(amount));
  405. SendClientMessage(playerid, COLOR_GREEN, msg);
  406. } else if(faction == 4) {
  407. amount = rank*1350;
  408. format(msg, sizeof(msg), " SAN News Paycheck: $%s",getNumberString(amount));
  409. SendClientMessage(playerid, COLOR_GREEN, msg);
  410. } else if(faction == 3) {
  411. amount = rank*1100;
  412. format(msg, sizeof(msg), " Government Paycheck: $%s",getNumberString(amount));
  413. SendClientMessage(playerid, COLOR_GREEN, msg);
  414. } else if(faction == 6) {
  415. amount = rank*1350;
  416. format(msg, sizeof(msg), " EMS Paycheck: $%s",getNumberString(amount));
  417. SendClientMessage(playerid, COLOR_GREEN, msg);
  418. } else if(faction == 7) {
  419. amount = rank*500;
  420. format(msg, sizeof(msg), " SADPS Paycheck: $%s",getNumberString(amount));
  421. SendClientMessage(playerid, COLOR_GREEN, msg);
  422. } else if(faction == 8) {
  423. amount = rank*500;
  424. format(msg, sizeof(msg), " LS City Traffic Police Paycheck: $%s",getNumberString(amount));
  425. SendClientMessage(playerid, COLOR_GREEN, msg);
  426. }
  427. return amount;
  428. }
  429. YCMD:signcheck(playerid, params[], help) {
  430. new check = GetPVarInt(playerid, "PayCheque");
  431. if(check == 0) {
  432. SendClientMessage(playerid, X11_TOMATO_2, "You have already signed your check!");
  433. return 1;
  434. }
  435. new msg[128];
  436. new account = GetPVarInt(playerid, "Bank");
  437. account += check;
  438. format(msg, sizeof(msg), "* You earned $%s",getNumberString(check));
  439. SendClientMessage(playerid, COLOR_LIGHTGREEN, msg);
  440. SetPVarInt(playerid, "Bank", account);
  441. DeletePVar(playerid, "PayCheque");
  442. return 1;
  443. }
  444. jobsOnPickupPickup(playerid, pickupid) {
  445. new title[128];
  446. new fid = GetPVarInt(playerid, "Family");
  447. dialogstr[0] = 0;
  448. for(new i=0;i<sizeof(JobPickups);i++) {
  449. if(JobPickups[i][EJobPickupID] == pickupid)
  450. {
  451. if(JobPickups[1][EJobPickupID] == pickupid || JobPickups[2][EJobPickupID] == pickupid)
  452. {
  453. if(fid == 0) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You need to be in a family to select this Job!");
  454. }
  455. format(dialogstr,sizeof(dialogstr),"{FFFFFF}Would you like to join the %s Job? Press \"{FF0000}Accept{FFFFFF}\" to accept, or \"{FF0000}Reject{FFFFFF}\" to reject",JobPickups[i][EJobName]);
  456. format(title,sizeof(title),"{00BFFF}%s Job Offer",JobPickups[i][EJobName]);
  457. new remaining = CanTakeJob(playerid);
  458. if(remaining != 0)
  459. {
  460. format(title, sizeof(title), "You must wait {FF6347}%d{FFFFFF} minute(s) for your job contract to finish!", remaining/60);
  461. SendClientMessage(playerid, X11_WHITE, title);
  462. return 0;
  463. }
  464. SetPVarInt(playerid, "JobOffer", i);
  465. ShowPlayerDialog(playerid, _:EJobs_JobOffer, DIALOG_STYLE_MSGBOX, title, dialogstr, "Accept", "Reject");
  466. movePlayerBack(playerid, 3.0);
  467. }
  468. }
  469. return 1;
  470. }
  471. jobsOnPlayerDisconnect(playerid, reason) {
  472. #pragma unused reason
  473. onJobAbort(playerid);
  474. if(GetPVarType(playerid, "TaxiDriver") != PLAYER_VARTYPE_NONE) {
  475. onTaxiPassengerAbort(playerid);
  476. }
  477. }
  478. OnPlayerEnterTaxi(playerid, driver) {
  479. SetPVarInt(playerid, "TaxiDriver", driver);
  480. SetPVarInt(driver, "TaxiPassenger", playerid);
  481. //new timer = SetTimerEx("TaxiTimer",TAXI_CHARGE_TIME,true, "dd", driver, playerid);
  482. //SetPVarInt(playerid, "TaxiTimer", timer);
  483. //TaxiTimer(driver, playerid);
  484. }
  485. doTaxiCharges() {
  486. new msg[128];
  487. foreach(Player, i) {
  488. if(IsPlayerConnectEx(i)) {
  489. if(GetPVarType(i, "TaxiDriver") != PLAYER_VARTYPE_NONE) {
  490. new driver = GetPVarInt(i, "TaxiDriver");
  491. if(!IsPlayerConnectEx(driver)) {
  492. DeletePVar(i, "TaxiDriver");
  493. continue;
  494. }
  495. if(!IsPlayerInAnyVehicle(i)) {
  496. DeletePVar(i, "TaxiDriver");
  497. continue;
  498. }
  499. new cost = GetPVarInt(driver, "TaxiFare");
  500. if(cost == 0) {
  501. DeletePVar(i, "TaxiDriver");
  502. continue;
  503. }
  504. if(GetPVarType(i, "TaxiDriver") != PLAYER_VARTYPE_NONE) {
  505. if(GetMoneyEx(i) >= cost) {
  506. new pay = GetPVarInt(driver, "Payday");
  507. pay += cost;
  508. SetPVarInt(driver, "Payday",pay);
  509. GiveMoneyEx(i, -cost);
  510. format(msg, sizeof(msg), "You paid $%s to the Taxi Driver",getNumberString(cost));
  511. SendClientMessage(i, TEAM_GROVE_COLOR, msg);
  512. format(msg, sizeof(msg), "You earned an additional $%s on your paycheck!",getNumberString(cost));
  513. SendClientMessage(driver, TEAM_GROVE_COLOR, msg);
  514. } else {
  515. SendClientMessage(i, X11_TOMATO_2, "You are being thrown out since you don't have enough money");
  516. RemovePlayerFromVehicle(i);
  517. DeletePVar(i, "TaxiDriver");
  518. }
  519. }
  520. }
  521. }
  522. }
  523. }
  524. /*
  525. forward TaxiTimer(driver, passenger);
  526. public TaxiTimer(driver, passenger) {
  527. new pay = GetPVarInt(driver, "Payday");
  528. new cost = GetPVarInt(driver, "TaxiFare");
  529. if(cost == 0) {
  530. if(GetPVarType(passenger, "TaxiTimer") != PLAYER_VARTYPE_NONE) {
  531. KillTimer(GetPVarInt(passenger, "TaxiTimer"));
  532. DeletePVar(passenger, "TaxiTimer");
  533. }
  534. }
  535. new msg[128];
  536. if(GetMoneyEx(passenger) >= cost) {
  537. pay += cost;
  538. SetPVarInt(driver, "Payday", pay);
  539. GiveMoneyEx(passenger, -cost);
  540. format(msg, sizeof(msg), "You paid $%d to the Taxi Driver",cost);
  541. SendClientMessage(passenger, TEAM_GROVE_COLOR, msg);
  542. format(msg, sizeof(msg), "You earned an additional $%d on your paycheck!",cost);
  543. SendClientMessage(driver, TEAM_GROVE_COLOR, msg);
  544. } else {
  545. SendClientMessage(passenger, X11_TOMATO_2, "You are being thrown out since you don't have enough money");
  546. RemovePlayerFromVehicle(passenger);
  547. }
  548. return 1;
  549. }
  550. */
  551. jobOnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  552. #pragma unused inputtext
  553. new msg[128];
  554. switch(dialogid) {
  555. case EJobs_JobOffer: {
  556. if(response) {
  557. new jobid = GetPVarInt(playerid, "JobOffer");
  558. SetPlayerJob(playerid, jobid/*, JobPickups[jobid][EJob_Illegal]==0?0:1*/);
  559. }
  560. DeletePVar(playerid, "JobOffer");
  561. }
  562. case EJobs_TrashDialog: {
  563. if(response) {
  564. startRoute(playerid, listitem);
  565. }
  566. }
  567. case EJobs_GunSellDialog: {
  568. new gunseller = GetPVarInt(playerid, "GunSeller");
  569. new gunprice = GetPVarInt(playerid, "GunPrice");
  570. new gunid = GetPVarInt(playerid, "GunSellID");
  571. if(response) {
  572. if(GetMoneyEx(playerid) < gunprice) {
  573. SendClientMessage(playerid, X11_RED3, "You don't have enough money for this weapon.");
  574. SendClientMessage(gunseller, X11_RED3, "This player doesn't have enough money for the gun!");
  575. } else {
  576. new Float:X,Float:Y,Float:Z;
  577. GetPlayerPos(gunseller, X, Y, Z);
  578. if(IsPlayerInRangeOfPoint(playerid,3.0,X, Y, Z)) {
  579. if(canAffordGun(gunseller, gunid)) {
  580. GiveMoneyEx(playerid, -gunprice);
  581. GiveMoneyEx(gunseller, gunprice);
  582. removeGunMaterials(gunseller, gunid);
  583. GivePlayerWeaponEx(playerid, gunid, -1);
  584. SendClientMessage(playerid, X11_RED3, "You have bought the weapon!");
  585. SendClientMessage(gunseller, COLOR_LIGHTGREEN, "The player accepted the gun deal");
  586. new string[128];
  587. new weaponname[32];
  588. GetWeaponNameEx(gunid, weaponname, sizeof(weaponname));
  589. format(string, sizeof(string), "* %s makes a %s and hands it to %s.", GetPlayerNameEx(gunseller, ENameType_RPName), weaponname, GetPlayerNameEx(playerid, ENameType_RPName));
  590. ProxMessage(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  591. increaseJobPoints(gunseller);
  592. }
  593. } else {
  594. SendClientMessage(playerid, X11_RED3, "You are too far away from the gun seller now.");
  595. }
  596. }
  597. } else {
  598. SendClientMessage(playerid, X11_RED3, "You rejected the gun deal");
  599. SendClientMessage(gunseller, X11_RED3, "Your gun offer has been rejected");
  600. }
  601. DeletePVar(playerid, "GunSeller");
  602. DeletePVar(playerid, "GunPrice");
  603. DeletePVar(playerid, "GunSellID");
  604. }
  605. case EJobs_DrugSellDialog: {
  606. new Float:X,Float:Y,Float:Z;
  607. new drugseller = GetPVarInt(playerid, "DrugSeller");
  608. new drugprice = GetPVarInt(playerid, "DrugPrice");
  609. new amount = GetPVarInt(playerid, "DrugAmount");
  610.  
  611. new drugname[32];
  612. GetPVarString(playerid, "DrugType", drugname, sizeof(drugname));
  613.  
  614. DeletePVar(playerid, "DrugSeller");
  615. DeletePVar(playerid, "DrugPrice");
  616. DeletePVar(playerid, "DrugAmount");
  617.  
  618. DeletePVar(playerid, "DrugType");
  619.  
  620. GetPlayerPos(drugseller, X, Y, Z);
  621. if(response) {
  622. if(IsPlayerInRangeOfPoint(playerid,3.0,X, Y, Z)) {
  623. if(GetMoneyEx(playerid) < drugprice) {
  624. SendClientMessage(playerid, X11_WHITE, "You don't have enough money!");
  625. SendClientMessage(drugseller, X11_RED_3, "The player doesn't have enough money");
  626. return 1;
  627. }
  628.  
  629. } else {
  630. SendClientMessage(playerid, X11_RED3, "You are too far away from the drug seller now.");
  631. return 1;
  632. }
  633.  
  634. GiveMoneyEx(playerid, -drugprice);
  635. GiveMoneyEx(drugseller, drugprice);
  636.  
  637. new total_drugs = GetPVarInt(drugseller, drugname);
  638. if(total_drugs < amount) {
  639. SendClientMessage(playerid, X11_TOMATO_2, "* The dealer does not have enough drugs.");
  640. SendClientMessage(drugseller, X11_TOMATO_2, "* You do not have enough drugs.");
  641. return 1;
  642. }
  643. total_drugs -= amount;
  644. SetPVarInt(drugseller, drugname, total_drugs);
  645.  
  646. total_drugs = GetPVarInt(playerid, drugname);
  647. total_drugs += amount;
  648. SetPVarInt(playerid, drugname, total_drugs);
  649.  
  650.  
  651. increaseJobPoints(drugseller);
  652.  
  653. SendClientMessage(playerid, COLOR_GREEN, "* Drug Transaction complete");
  654. SendClientMessage(drugseller, COLOR_GREEN, "* Drug Transaction complete");
  655.  
  656. format(tempstr, sizeof(tempstr), "* %s hands some %s to %s.",GetPlayerNameEx(drugseller, ENameType_RPName), drugname,GetPlayerNameEx(playerid, ENameType_RPName));
  657. ProxMessage(30.0, playerid, tempstr, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  658.  
  659. } else {
  660. SendClientMessage(playerid, X11_RED3, "The drug deal has been rejected.");
  661. SendClientMessage(drugseller, X11_RED3, "The drug deal has been rejected.");
  662. }
  663. }
  664. case EJobs_SkillsDialog: {
  665. if(!response) return 0;
  666. showJobSkills(playerid, listitem);
  667. }
  668. case EJobs_SkillInfoDialog: {
  669.  
  670. }
  671. case EJobs_RefillOffer: {
  672. new mech = GetPVarInt(playerid, "RefillMech");
  673. new price = GetPVarInt(playerid, "RefillPrice");
  674. DeletePVar(playerid, "RefillMech");
  675. DeletePVar(playerid, "RefillPrice");
  676. new Float:X, Float:Y, Float:Z;
  677. GetPlayerPos(mech, X, Y, Z);
  678. if(!response) {
  679. SendClientMessage(mech, X11_TOMATO_2, "The player rejected the refill offer!");
  680. } else {
  681. if(GetMoneyEx(playerid) < price) {
  682. SendClientMessage(playerid, X11_TOMATO_2, "Not enough money!");
  683. return 1;
  684. }
  685. if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) {
  686. SendClientMessage(playerid, X11_TOMATO_2, "The mechanic is too far away");
  687. return 1;
  688. }
  689. new carid = GetPlayerVehicleID(playerid);
  690. if(carid == 0) {
  691. SendClientMessage(playerid, COLOR_LIGHTGREEN, "You must be in a car");
  692. return 1;
  693. }
  694. format(tempstr, sizeof(tempstr), "* %s fuels the vehicle.", GetPlayerNameEx(mech, ENameType_RPName));
  695. ProxMessage(30.0, playerid, tempstr, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  696. SetPVarInt(mech, "GasCans", GetPVarInt(mech, "GasCans") -1);
  697. new oldfuel = VehicleInfo[carid][EVFuel];
  698. oldfuel += 15;
  699. if(oldfuel > 100) {
  700. format(tempstr, sizeof(tempstr), "* Some fuel spills down the side.");
  701. ProxMessage(30.0, playerid, tempstr, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  702. oldfuel = 100;
  703. }
  704. VehicleInfo[carid][EVFuel] = oldfuel;
  705. CheckGas();
  706. GiveMoneyEx(playerid, -price);
  707. GiveMoneyEx(mech, price);
  708. //GiveMoneyEx(mech, -(oldfuel*2));
  709. increaseJobPoints(mech);
  710. //format(msg, sizeof(msg), "* The fuel costed you $%s!",getNumberString((oldfuel*2)));
  711. //SendClientMessage(mech, COLOR_LIGHTGREEN, msg);
  712. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Vehicle Refilled");
  713. SendClientMessage(mech, COLOR_LIGHTGREEN, "* Vehicle Refilled");
  714. }
  715. }
  716. case EJobs_RepairOffer: {
  717. new mech = GetPVarInt(playerid, "RepairMech");
  718. new price = GetPVarInt(playerid, "RepairPrice");
  719. DeletePVar(playerid, "RepairMech");
  720. DeletePVar(playerid, "RepairPrice");
  721. new Float:X, Float:Y, Float:Z;
  722. GetPlayerPos(mech, X, Y, Z);
  723. if(!response) {
  724. SendClientMessage(mech, X11_TOMATO_2, "The player rejected the repair offer!");
  725. } else {
  726. if(GetMoneyEx(playerid) < price) {
  727. SendClientMessage(playerid, X11_TOMATO_2, "Not enough money!");
  728. return 1;
  729. }
  730. if(!IsPlayerInRangeOfPoint(playerid, 15.0, X, Y, Z)) {
  731. SendClientMessage(playerid, X11_TOMATO_2, "The mechanic is too far away");
  732. return 1;
  733. }
  734. new carid = GetPlayerVehicleID(playerid);
  735. if(carid == 0) {
  736. SendClientMessage(playerid, COLOR_LIGHTGREEN, "You must be in a car");
  737. return 1;
  738. }
  739. increaseJobPoints(mech);
  740. RepairVehicle(carid);
  741. GiveMoneyEx(playerid, -price);
  742. setVehicleTotaled(carid, 0);
  743. if(mech != playerid) {
  744. price -= getVehRepairCost(carid);
  745. GiveMoneyEx(mech, price);
  746. }
  747. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Vehicle Repaired");
  748. SendClientMessage(mech, COLOR_LIGHTGREEN, "* Vehicle Repaired");
  749. }
  750. }
  751. case EJobs_TuneMenu: {
  752. if(!response) return 0;
  753. if(GetMoneyEx(playerid) < BuyableComponents[listitem][ECompPrice]) {
  754. SendClientMessage(playerid, X11_TOMATO_2, "You do not have enough money!");
  755. return 1;
  756. }
  757. new vehicleid = GetPlayerVehicleID(playerid);
  758. new vehicleide = GetVehicleModel(vehicleid);
  759. new componentid = BuyableComponents[listitem][ECompInfoID];
  760. new modok = islegalcarmod(vehicleide, componentid);
  761. if(!modok) {
  762. SendClientMessage(playerid, X11_TOMATO_2, "You cannot use this mod on this car!");
  763. }
  764. AddVehicleComponent(vehicleid, componentid);
  765. GiveMoneyEx(playerid, -BuyableComponents[listitem][ECompPrice]);
  766. format(msg, sizeof(msg), "* You bought a %s for $%s",BuyableComponents[listitem][ECompInfoDispName], getNumberString(BuyableComponents[listitem][ECompPrice]));
  767. SendClientMessage(playerid, COLOR_LIGHTGREEN, msg);
  768. if(GetPVarInt(playerid, "Job") == EJobType_Mechanic) {
  769. increaseJobPoints(playerid);
  770. }
  771. }
  772. case EJobs_SpotMenu: {
  773. if(!response) return 0;
  774. SetPlayerCheckpoint(playerid, JobPickups[listitem][EJobSpotX], JobPickups[listitem][EJobSpotY], JobPickups[listitem][EJobSpotZ], 3.0);
  775. SetTimerEx("RemoveCheckpoint", 25000, false, "d", playerid);
  776.  
  777. }
  778. case EJobs_SetSkillLevelMenu: {
  779. if(!response) return 0;
  780. SetPVarInt(playerid, "SetSkillIndex", listitem);
  781. tempstr[0] = 0;
  782. dialogstr[0] = 0;
  783. for(new i=0;i<5;i++) {
  784. format(tempstr, sizeof(tempstr), "Level %d\n",i+1);
  785. strcat(dialogstr, tempstr, sizeof(dialogstr));
  786. }
  787. ShowPlayerDialog(playerid, EJobs_SetSkillLevel, DIALOG_STYLE_LIST, "Set Skill Level",dialogstr,"Set", "Cancel");
  788. }
  789. case EJobs_SetSkillLevel: {
  790. if(!response) return 0;
  791. new skill = GetPVarInt(playerid, "SetSkillIndex");
  792. new target = GetPVarInt(playerid, "SetSkillTarget");
  793. DeletePVar(playerid, "SetSkillIndex");
  794. DeletePVar(playerid, "SetSkillTarget");
  795. format(msg, sizeof(msg), "* An admin set your %s level to %d",Skills[skill][ESkill_Name],listitem+1);
  796. SendClientMessage(target, X11_YELLOW, msg);
  797. format(msg, sizeof(msg), "* You set %s's %s level to %d",GetPlayerNameEx(target, ENameType_CharName),Skills[skill][ESkill_Name],listitem+1);
  798. SendClientMessage(playerid, X11_YELLOW, msg);
  799. new tagoffset = _:ESkill_Level1Points+listitem;
  800. new skilllevel = Skills[skill][ESkillInfo:tagoffset];
  801. if(listitem == 0) {
  802. skilllevel = 0;
  803. } else {
  804. skilllevel = Skills[skill][ESkillInfo:(tagoffset-1)]+1;
  805. }
  806. setSkillPoints(target, skill, skilllevel);
  807. }
  808. case EJobs_SellVest: {
  809. new Float:amount = GetPVarFloat(playerid, "VestAmount");
  810. new user = GetPVarInt(playerid, "VestSeller");
  811. new price = GetPVarInt(playerid, "VestPrice");
  812. DeletePVar(playerid, "VestAmount");
  813. DeletePVar(playerid, "VestSeller");
  814. DeletePVar(playerid, "VestPrice");
  815. new isoffer = GetPVarInt(user, "VestOfferer") == playerid;
  816. if(isoffer) {
  817. DeletePVar(user, "VestOfferer");
  818. } else {
  819. if(GetPVarInt(user, "VestOfferer") != playerid) {
  820. SendClientMessage(playerid, X11_TOMATO_2, "This person is no longer offering you a vest");
  821. return 1;
  822. }
  823. }
  824. if(!response) {
  825. SendClientMessage(user, X11_TOMATO_2, "The vest offer has been rejected");
  826. } else {
  827. if(GetMoneyEx(playerid) < price) {
  828. SendClientMessage(playerid, X11_TOMATO_2, "You don't have enough money");
  829. SendClientMessage(user, X11_TOMATO_2, "The user didn't have enough money");
  830. return 1;
  831. }
  832. new matsprice = GetPVarInt(user, "VestMatsPrice");
  833. new matstotal = GetPVarInt(user, "MatsC");
  834. DeletePVar(user, "VestMatsPrice");
  835. if(matsprice > matstotal) {
  836. SendClientMessage(playerid, X11_TOMATO_2, "* The seller didn't have enough materials");
  837. SendClientMessage(user, X11_TOMATO_2, "* You don't have enough materials now!");
  838. return 1;
  839. }
  840. matstotal -= matsprice;
  841. SetPVarInt(user, "MatsC", matstotal);
  842. GiveMoneyEx(playerid, -price);
  843. GiveMoneyEx(user, price);
  844. new Float:total;
  845. GetPlayerArmour(playerid,total);
  846. amount += total;
  847. if(total > MAX_ARMOUR) {
  848. total = MAX_ARMOUR;
  849. }
  850. SetPlayerArmourEx(playerid, amount);
  851. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You have now bought a vest!");
  852. SendClientMessage(user, COLOR_LIGHTBLUE, "* The user bought a vest from you!");
  853. increaseJobPoints(user);
  854. }
  855. }
  856. case EJobs_LawyerFree: {
  857. new user = GetPVarInt(playerid, "LawyerID");
  858. new price = GetPVarInt(playerid, "LawyerPrice");
  859. new Float: X, Float: Y, Float: Z;
  860. DeletePVar(playerid, "LawyerID");
  861. DeletePVar(playerid, "LawyerPrice");
  862. new isoffer = GetPVarInt(user, "FreedomOfferer") == playerid;
  863. if(isoffer) {
  864. DeletePVar(user, "FreedomOfferer");
  865. } else {
  866. SendClientMessage(playerid, X11_TOMATO_2, "This person is no longer offering you a set out on bail.");
  867. return 1;
  868. }
  869. if(!response) {
  870. SendClientMessage(user, X11_TOMATO_2, "The bail offer has been rejected");
  871. } else {
  872. if(GetMoneyEx(playerid) < price) {
  873. SendClientMessage(playerid, X11_TOMATO_2, "You don't have enough money");
  874. SendClientMessage(user, X11_TOMATO_2, "The user didn't have enough money");
  875. return 1;
  876. }
  877. GetPlayerPos(user, X, Y, Z);
  878. if(!IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) {
  879. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from the lawyer!");
  880. return 1;
  881. }
  882. if(GetPVarInt(playerid, "Bail") == PLAYER_VARTYPE_NONE) {
  883. SendClientMessage(playerid, X11_TOMATO_2, "You don't have a bail.");
  884. SendClientMessage(user, X11_TOMATO_2, "The person you're trying to set free isn't on bail.");
  885. return 1;
  886. }
  887. if(GetPVarType(playerid, "ReleaseTime") != PLAYER_VARTYPE_NONE) {
  888. GetPlayerPos(user, X, Y, Z);
  889. SetPlayerPos(playerid, X, Y, Z);
  890. DeletePVar(playerid, "ReleaseTime");
  891. DeletePVar(playerid, "Bail");
  892. TogglePlayerControllableEx(playerid, 1);
  893. increaseJobPoints(user);
  894. GiveMoneyEx(playerid, -price);
  895. GiveMoneyEx(user, price);
  896. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are now free on bail, follow the lawyer to the way out!");
  897. SendClientMessage(user, COLOR_LIGHTBLUE, "* The person paid the bail!");
  898. } else {
  899. SendClientMessage(playerid, X11_TOMATO_2, "This person is not in jail.");
  900. }
  901. }
  902. }
  903. }
  904. return 1;
  905. }
  906. YCMD:payday(playerid, params[], help) {
  907. if(help) {
  908. SendClientMessage(playerid, X11_WHITE, "Starts a payday");
  909. return 1;
  910. }
  911. Payday();
  912. return 1;
  913. }
  914. YCMD:jobids(playerid, params[], help) {
  915. new msg[128];
  916. for(new i=0;i<GetNumJobs();i++) {
  917. format(msg,sizeof(msg),"{FFFFFF}Job ID: {FF0000}%d %s",i,JobPickups[i][EJobName]);
  918. SendClientMessage(playerid, COLOR_GREY, msg);
  919. }
  920. return 1;
  921. }
  922. YCMD:refill(playerid, params[], help) {
  923. if(help) {
  924. SendClientMessage(playerid, X11_WHITE, "Used for refilling your car");
  925. return 1;
  926. }
  927. new job = GetPVarInt(playerid, "Job");
  928. if(job != EJobType_Mechanic) {
  929. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  930. return 1;
  931. }
  932. new user, price;
  933. new time = GetPVarInt(playerid, "MechanicCooldown");
  934. new timenow = gettime();
  935. new msg[128];
  936. if(MECH_OFFER_COOLDOWN-(timenow-time) > 0) {
  937. format(msg, sizeof(msg), "You must wait %d seconds before making another offer",MECH_OFFER_COOLDOWN-(timenow-time));
  938. SendClientMessage(playerid, X11_TOMATO_2, msg);
  939. return 1;
  940. }
  941. if(GetPVarInt(playerid, "GasCans") < 1) {
  942. SendClientMessage(playerid, X11_TOMATO_2, "You don't have any gas cans!");
  943. HintMessage(playerid, COLOR_LIGHTGREEN, "You can buy one at any 24/7");
  944. return 1;
  945. }
  946. if(!sscanf(params, "k<playerLookup>d", user, price)) {
  947. if(!IsPlayerConnectEx(user)) {
  948. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  949. return 1;
  950. }
  951. new Float:X, Float:Y, Float:Z;
  952. GetPlayerPos(user, X, Y, Z);
  953. if(!IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) {
  954. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from this person!");
  955. return 1;
  956. }
  957. if(!IsPlayerInAnyVehicle(user)) {
  958. SendClientMessage(playerid, X11_TOMATO_2, "This person is not in a vehicle!");
  959. return 1;
  960. }
  961. if(price < 1 || price > 999999) {
  962. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Price");
  963. return 1;
  964. }
  965. SetPVarInt(playerid, "MechanicCooldown", gettime());
  966. sendRefillOffer(playerid, user, price);
  967. } else {
  968. SendClientMessage(playerid, X11_WHITE, "USAGE: /refill [playerid/name] [price]");
  969. }
  970. return 1;
  971. }
  972. getVehRepairCost(carid) {
  973. new Float:health;
  974. GetVehicleHealth(carid,health);
  975. return floatround((1000-health)*2);
  976. }
  977. YCMD:repair(playerid, params[], help) {
  978. if(help) {
  979. SendClientMessage(playerid, X11_WHITE, "Used for refilling your car");
  980. return 1;
  981. }
  982. new job = GetPVarInt(playerid, "Job");
  983. if(job != EJobType_Mechanic) {
  984. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  985. return 1;
  986. }
  987. new user, price, engine, lights, alarm, doors, bonnet, boot, objective;
  988. new time = GetPVarInt(playerid, "MechanicCooldown");
  989. new timenow = gettime();
  990. new msg[128];
  991. if(MECH_OFFER_COOLDOWN-(timenow-time) > 0) {
  992. format(msg, sizeof(msg), "You must wait %d seconds before making another offer",MECH_OFFER_COOLDOWN-(timenow-time));
  993. SendClientMessage(playerid, X11_TOMATO_2, msg);
  994. return 1;
  995. }
  996. if(!sscanf(params, "k<playerLookup>D(1500)", user, price)) {
  997. if(!IsPlayerConnectEx(user)) {
  998. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  999. return 1;
  1000. }
  1001. new Float:X, Float:Y, Float:Z;
  1002. GetPlayerPos(user, X, Y, Z);
  1003. if(!IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) {
  1004. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from this person!");
  1005. return 1;
  1006. }
  1007. if(!IsPlayerInAnyVehicle(user)) {
  1008. SendClientMessage(playerid, X11_TOMATO_2, "This person is not in a vehicle!");
  1009. return 1;
  1010. }
  1011. new rprice = getVehRepairCost(GetPlayerVehicleID(user));
  1012. if(GetMoneyEx(playerid) < rprice) {
  1013. format(msg, sizeof(msg), "You must have $%d to do this!",rprice);
  1014. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1015. return 1;
  1016. }
  1017. if(price < 500 || price > 10000) {
  1018. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Price. The Price cannot either be below $500 or higher than $10000.");
  1019. return 1;
  1020. }
  1021. new carid = GetPlayerVehicleID(user);
  1022. GetVehicleParamsEx(carid, engine, lights, alarm, doors, bonnet, boot, objective);
  1023.  
  1024. if(engine != 0 && IsACar(GetVehicleModel(carid))) {
  1025. SendClientMessage(playerid, X11_TOMATO_2, "The vehicle engine must be off in order to repair it!");
  1026. return 1;
  1027. }
  1028. SetPVarInt(playerid, "MechanicCooldown", gettime());
  1029. sendRepairOffer(playerid, user, price);
  1030. } else {
  1031. SendClientMessage(playerid, X11_WHITE, "USAGE: /repair [playerid/name] [price]");
  1032. }
  1033. return 1;
  1034. }
  1035.  
  1036. YCMD:tow(playerid, params[], help) {
  1037. new carid = GetPlayerVehicleID(playerid);
  1038. new model = GetVehicleModel(carid);
  1039. if(help) {
  1040. SendClientMessage(playerid, X11_WHITE, "Tow a vehicle");
  1041. return 1;
  1042. }
  1043. if(!IsPlayerInAnyVehicle(playerid)) {
  1044. SendClientMessage(playerid, X11_TOMATO_2, "You aren't in a car");
  1045. return 1;
  1046. }
  1047. if(model != 525) {
  1048. SendClientMessage(playerid, X11_TOMATO_2, "You must be in a tow truck!");
  1049. return 1;
  1050. }
  1051. new job = GetPVarInt(playerid, "Job");
  1052. if(job != EJobType_Mechanic && !(IsAnLEO(playerid) || !IsOnDuty(playerid))) {
  1053. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  1054. return 1;
  1055. } else {
  1056. if(getJobLevel(playerid) < 3) {
  1057. SendClientMessage(playerid, X11_TOMATO_2, "You must be a level 3 mechanic!");
  1058. return 1;
  1059. }
  1060. }
  1061. new car = GetClosestVehicle(playerid);
  1062. if(DistanceBetweenPlayerAndVeh(playerid, car) < 7.0 && GetVehicleModel(car) >= 400)
  1063. {
  1064. if(IsTrailerAttachedToVehicle(carid))
  1065. {
  1066. DetachTrailerFromVehicle(carid);
  1067. SendClientMessage(playerid,COLOR_LIGHTGREEN,"* Car untowed!");
  1068. } else {
  1069. AttachTrailerToVehicle(car, carid);
  1070. SendClientMessage(playerid,COLOR_LIGHTGREEN,"* Car towed!");
  1071. }
  1072. } else {
  1073. SendClientMessage(playerid, X11_TOMATO_2, "No vehicle is close enough!");
  1074. }
  1075. return 1;
  1076. }
  1077. YCMD:tunecolour(playerid, params[], help) {
  1078. if(help) {
  1079. SendClientMessage(playerid, X11_WHITE, "Changes a vehicles colour");
  1080. return 1;
  1081. }
  1082. new c1, c2;
  1083. new job = GetPVarInt(playerid, "Job");
  1084. new EAdminFlags:aflags = EAdminFlags:GetPVarInt(playerid, "AdminFlags");
  1085. if(~aflags & EAdminFlags_VehicleAdmin) {
  1086. if(job != EJobType_Mechanic) {
  1087. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  1088. return 1;
  1089. }
  1090. }
  1091. if(!sscanf(params, "dd", c1, c2)) {
  1092. if(!IsPlayerInAnyVehicle(playerid)) {
  1093. SendClientMessage(playerid, X11_TOMATO_2, "You must be in a vehicle!");
  1094. return 1;
  1095. }
  1096. if(~aflags & EAdminFlags_VehicleAdmin) {
  1097. if(GetMoneyEx(playerid) < 150) {
  1098. SendClientMessage(playerid, X11_TOMATO_2, "You don't have $150!");
  1099. return 1;
  1100. }
  1101. if(getJobLevel(playerid) < 2) {
  1102. SendClientMessage(playerid, X11_TOMATO_2, "You must be a level 2 mechanic!");
  1103. return 1;
  1104. }
  1105. GiveMoneyEx(playerid, -150);
  1106. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* The respray costed you $150");
  1107. }
  1108. new carid = GetPlayerVehicleID(playerid);
  1109. setVehicleColour(carid, c1, c2);
  1110. } else {
  1111. SendClientMessage(playerid, X11_WHITE, "USAGE: /tunecolour [colour1] [colour2]");
  1112. SendClientMessage(playerid, X11_WHITE, "To see colour IDs go here: http://wiki.sa-mp.com/wiki/Color_ID");
  1113. }
  1114. return 1;
  1115. }
  1116. YCMD:tunepaintjob(playerid, params[], help) {
  1117. if(help) {
  1118. SendClientMessage(playerid, X11_WHITE, "Changes a vehicles colour");
  1119. return 1;
  1120. }
  1121. new job = GetPVarInt(playerid, "Job");
  1122. new EAdminFlags:aflags = EAdminFlags:GetPVarInt(playerid, "AdminFlags");
  1123. if(~aflags & EAdminFlags_VehicleAdmin) {
  1124. if(job != EJobType_Mechanic) {
  1125. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  1126. return 1;
  1127. }
  1128. }
  1129. new paintjob;
  1130. if(!sscanf(params, "d", paintjob)) {
  1131. if(!IsPlayerInAnyVehicle(playerid)) {
  1132. SendClientMessage(playerid, X11_TOMATO_2, "You must be in a vehicle!");
  1133. return 1;
  1134. }
  1135. if(~aflags & EAdminFlags_VehicleAdmin) {
  1136. if(GetMoneyEx(playerid) < 1000) {
  1137. SendClientMessage(playerid, X11_TOMATO_2, "You don't have $1000!");
  1138. return 1;
  1139. }
  1140. if(getJobLevel(playerid) < 3) {
  1141. SendClientMessage(playerid, X11_TOMATO_2, "You must be a level 3 mechanic!");
  1142. return 1;
  1143. }
  1144. GiveMoneyEx(playerid, -1000);
  1145. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* The paintjob costed you $1000");
  1146. }
  1147. new carid = GetPlayerVehicleID(playerid);
  1148. setVehiclePaintjob(carid, paintjob);
  1149. } else {
  1150. SendClientMessage(playerid, X11_WHITE, "USAGE: /tunecolour [colour1] [colour2]");
  1151. SendClientMessage(playerid, X11_WHITE, "To see colour IDs go here: http://wiki.sa-mp.com/wiki/Color_ID");
  1152. }
  1153. return 1;
  1154. }
  1155. YCMD:tunecar(playerid, params[], help) {
  1156. new job = GetPVarInt(playerid, "Job");
  1157. new EAdminFlags:aflags = EAdminFlags:GetPVarInt(playerid, "AdminFlags");
  1158. if(~aflags & EAdminFlags_VehicleAdmin) {
  1159. if(job != EJobType_Mechanic) {
  1160. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  1161. return 1;
  1162. }
  1163. }
  1164. if(help) {
  1165. SendClientMessage(playerid, X11_TOMATO_2, "Used for modifying a vehicle");
  1166. return 1;
  1167. }
  1168. if(!IsPlayerInAnyVehicle(playerid)) {
  1169. SendClientMessage(playerid, X11_TOMATO_2, "You must be in a vehicle!");
  1170. return 1;
  1171. }
  1172. if(~aflags & EAdminFlags_VehicleAdmin) {
  1173. if(getJobLevel(playerid) < 4) {
  1174. SendClientMessage(playerid, X11_TOMATO_2, "You must be a level 4 mechanic!");
  1175. return 1;
  1176. }
  1177. }
  1178. showTuneCarMenu(playerid);
  1179. return 1;
  1180. }
  1181. showTuneCarMenu(playerid){
  1182. dialogstr[0] = 0;
  1183. tempstr[0] = 0;
  1184. for(new i=0;i<sizeof(BuyableComponents);i++) {
  1185. format(tempstr,sizeof(tempstr),"%s $%s\n",BuyableComponents[i][ECompInfoDispName],getNumberString(BuyableComponents[i][ECompPrice]));
  1186. strcat(dialogstr,tempstr,sizeof(dialogstr));
  1187. }
  1188. ShowPlayerDialog(playerid, EJobs_TuneMenu, DIALOG_STYLE_LIST, "Tune Menu", dialogstr, "Buy", "Cancel");
  1189. }
  1190. sendRefillOffer(playerid, target, price) {
  1191. new msg[128];
  1192. format(msg, sizeof(msg), "{FFFFFF}%s wants to refill your vehicle for {FF0000}$%s",GetPlayerNameEx(playerid, ENameType_RPName), getNumberString(price));
  1193. SetPVarInt(target, "RefillPrice",price);
  1194. SetPVarInt(target, "RefillMech", playerid);
  1195. ShowPlayerDialog(target, EJobs_RefillOffer, DIALOG_STYLE_MSGBOX, "{00BF00}Refill Offer", msg, "Accept", "Reject");
  1196. }
  1197. sendRepairOffer(playerid, target, price) {
  1198. new msg[128];
  1199. format(msg, sizeof(msg), "{FFFFFF}%s wants to repair your vehicle for {FF0000}$%s",GetPlayerNameEx(playerid, ENameType_RPName), getNumberString(price));
  1200. SetPVarInt(target, "RepairPrice",price);
  1201. SetPVarInt(target, "RepairMech", playerid);
  1202. ShowPlayerDialog(target, EJobs_RepairOffer, DIALOG_STYLE_MSGBOX, "{00BFFF}Repair Offer", msg, "Accept", "Reject");
  1203. }
  1204. YCMD:jobspots(playerid, params[], help) {
  1205. tempstr[0] = 0;
  1206. dialogstr[0] = 0;
  1207. for(new i=0;i<sizeof(JobPickups);i++) {
  1208. format(tempstr, sizeof(tempstr), "%s\n",JobPickups[i][EJobName]);
  1209. strcat(dialogstr, tempstr, sizeof(dialogstr));
  1210. }
  1211. ShowPlayerDialog(playerid, EJobs_SpotMenu, DIALOG_STYLE_LIST, "{00BFFF}Job Spots", dialogstr, "Find", "Cancel");
  1212. return 1;
  1213. }
  1214. YCMD:jobcar(playerid, params[], help) {
  1215. if(help) {
  1216. SendClientMessage(playerid, X11_WHITE, "Spawns a job car");
  1217. return 1;
  1218. }
  1219. new job = GetPVarInt(playerid, "Job");
  1220. if(job < 0) {
  1221. SendClientMessage(playerid, X11_RED3, "You must have a job to spawn a job car!");
  1222. return 1;
  1223. }
  1224. new Float:X, Float:Y, Float:Z, Float:Angle;
  1225. new carid;
  1226. GetPlayerPos(playerid, X, Y, Z);
  1227. GetPlayerFacingAngle(playerid, Angle);
  1228. if(IsPlayerInAnyVehicle(playerid)) {
  1229. SendClientMessage(playerid, X11_WHITE, "You must not be in a car for this.");
  1230. return 1;
  1231. }
  1232. if(!IsPlayerInRangeOfPoint(playerid, 50.0, JobPickups[job][EJobSpotX],JobPickups[job][EJobSpotY],JobPickups[job][EJobSpotZ])) {
  1233. SendClientMessage(playerid, X11_WHITE, "You must be near the job spot in order to spawn this. Do /jobspots to see all the job spots");
  1234. return 1;
  1235. }
  1236. if(GetPVarType(playerid, "JobCar") != PLAYER_VARTYPE_NONE) {
  1237. SendClientMessage(playerid, X11_TOMATO_2, "You have a job car already.");
  1238. return 1;
  1239. }
  1240. switch(job) {
  1241. case EJobType_TrashCleaner: { //trash job
  1242. carid = CreateJobCar(574, 1, 1, X, Y, Z, Angle, "", job);
  1243. PutPlayerInVehicleEx(playerid, carid, 0);
  1244. }
  1245. case EJobType_TaxiDriver: {
  1246. carid = CreateJobCar(420, 6, 6, X, Y, Z, Angle, "", job);
  1247. PutPlayerInVehicleEx(playerid, carid, 0);
  1248. }
  1249. case EJobType_Mechanic: {
  1250. carid = CreateJobCar(525, 1, 0, X, Y, Z, Angle, "", job);
  1251. PutPlayerInVehicleEx(playerid, carid, 0);
  1252. }
  1253. case EJobType_Smuggler: {
  1254. carid = CreateJobCar(499, -1, -1, X, Y, Z, Angle, "", job);
  1255. PutPlayerInVehicleEx(playerid, carid, 0);
  1256. }
  1257. default: {
  1258. SendClientMessage(playerid, X11_RED3, "This job doesn't have a job car.");
  1259. }
  1260. }
  1261. if(carid != 0) {
  1262. SetPVarInt(playerid, "JobCar", carid);
  1263. }
  1264. return 1;
  1265. }
  1266. YCMD:quitjob(playerid, params[], help) {
  1267. if(help) {
  1268. SendClientMessage(playerid, X11_WHITE, "Quits your job");
  1269. return 1;
  1270. }
  1271. new msg[128];
  1272. new remaining = CanTakeJob(playerid);
  1273. if(remaining != 0) {
  1274. format(msg, sizeof(msg), "You must wait {FF6347}%d{FFFFFF} minute(s) for your job contract to finish!", remaining/60);
  1275. SendClientMessage(playerid, X11_WHITE, msg);
  1276. return 1;
  1277. }
  1278. SetPlayerJob(playerid, -1, 1);
  1279. SendClientMessage(playerid, X11_LIGHTBLUE, "* You fulfilled your 1 hour contract and quit your job.");
  1280. return 1;
  1281. }
  1282.  
  1283. canAffordGun(playerid, gunid) {
  1284. new amats = GetPVarInt(playerid,"MatsA");
  1285. new bmats = GetPVarInt(playerid,"MatsB");
  1286. new cmats = GetPVarInt(playerid,"MatsC");
  1287. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1288. if(GunJobPrices[i][EGunJobWeaponID] == gunid) {
  1289. if(GunJobPrices[i][EGunJobAMats] > amats) return 0;
  1290. if(GunJobPrices[i][EGunJobBMats] > bmats) return 0;
  1291. if(GunJobPrices[i][EGunJobCMats] > cmats) return 0;
  1292. }
  1293. }
  1294. return 1;
  1295. }
  1296.  
  1297. hasGunLevel(playerid, gunid) {
  1298. new index = findJobSkillIndex(EJobType_Arms_Dealer);
  1299. new glevel;
  1300. if(index != -1) {
  1301. glevel = getSkillLevel(playerid, index);
  1302. }
  1303. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1304. if(GunJobPrices[i][EGunJobWeaponID] == gunid) {
  1305. if(glevel >= GunJobPrices[i][EGunJobLevel]) return 1;
  1306. }
  1307. }
  1308. return 0;
  1309. }
  1310. removeGunMaterials(playerid, gunid) {
  1311. new amats = GetPVarInt(playerid,"MatsA");
  1312. new bmats = GetPVarInt(playerid,"MatsB");
  1313. new cmats = GetPVarInt(playerid,"MatsC");
  1314. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1315. if(GunJobPrices[i][EGunJobWeaponID] == gunid) {
  1316. amats -= GunJobPrices[i][EGunJobAMats];
  1317. bmats -= GunJobPrices[i][EGunJobBMats];
  1318. cmats -= GunJobPrices[i][EGunJobCMats];
  1319. }
  1320. }
  1321. SetPVarInt(playerid, "MatsA", amats);
  1322. SetPVarInt(playerid, "MatsB", bmats);
  1323. SetPVarInt(playerid, "MatsC", cmats);
  1324. return 1;
  1325. }
  1326. giveGunMaterials(playerid, gunid) {
  1327. new amats = GetPVarInt(playerid,"MatsA");
  1328. new bmats = GetPVarInt(playerid,"MatsB");
  1329. new cmats = GetPVarInt(playerid,"MatsC");
  1330. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1331. if(GunJobPrices[i][EGunJobWeaponID] == gunid) {
  1332. amats += GunJobPrices[i][EGunJobAMats];
  1333. bmats += GunJobPrices[i][EGunJobBMats];
  1334. cmats += GunJobPrices[i][EGunJobCMats];
  1335. }
  1336. }
  1337. SetPVarInt(playerid, "MatsA", amats);
  1338. SetPVarInt(playerid, "MatsB", bmats);
  1339. SetPVarInt(playerid, "MatsC", cmats);
  1340. return 1;
  1341. }
  1342. YCMD:sellgun(playerid, params[], help) {
  1343. if(help) {
  1344. SendClientMessage(playerid, X11_WHITE, "Offer a player a weapon to sell");
  1345. return 1;
  1346. }
  1347. if(IsGunBanned(playerid)) {
  1348. SendClientMessage(playerid, X11_TOMATO_2, "You are weapon banned!");
  1349. return 1;
  1350. }
  1351. new playa, gun[32], price;
  1352. new job = GetPVarInt(playerid, "Job");
  1353. if(job != EJobType_Arms_Dealer) {
  1354. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Gun Dealer");
  1355. return 1;
  1356. }
  1357. if(!sscanf(params, "k<playerLookup>s[32]d", playa, gun, price)) {
  1358. if(!IsPlayerConnectEx(playa)) {
  1359. SendClientMessage(playerid, X11_TOMATO_2, "Error: User not found");
  1360. return 1;
  1361. }
  1362. if(playa == playerid) {
  1363. SendClientMessage(playerid, X11_TOMATO_2, "You cannot sell guns yourself, use /makegun instead.");
  1364. return 1;
  1365. }
  1366. if(IsGunBanned(playa)) {
  1367. SendClientMessage(playerid, X11_TOMATO_2, "This player is weapon banned!");
  1368. return 1;
  1369. }
  1370. new gunid = -1;
  1371. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1372. if(!strcmp(GunJobPrices[i][EGunJobName], gun)) {
  1373. gunid = GunJobPrices[i][EGunJobWeaponID];
  1374. break;
  1375. }
  1376. }
  1377. if(gunid == -1) {
  1378. SendClientMessage(playerid, X11_TOMATO_2, "Invalid weapon name");
  1379. return 1;
  1380. }
  1381. if(price < 1 || price >= 10000000) {
  1382. SendClientMessage(playerid, X11_WHITE, "Invalid Price");
  1383. return 1;
  1384. }
  1385. if(!canAffordGun(playerid, gunid)) {
  1386. SendClientMessage(playerid, X11_RED3, "You don't have enough materials for this weapon.");
  1387. return 1;
  1388. }
  1389. if(!hasGunLevel(playerid, gunid)) {
  1390. SendClientMessage(playerid, X11_RED3, "You don't have the gun level required to make this.");
  1391. return 1;
  1392. }
  1393. new Float:X, Float:Y, Float:Z, vw;
  1394. GetPlayerPos(playa, X, Y, Z);
  1395. vw = GetPlayerVirtualWorld(playa);
  1396. if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z) || GetPlayerVirtualWorld(playerid) != vw) {
  1397. SendClientMessage(playerid, X11_TOMATO_2, "You are not near this person!");
  1398. return 1;
  1399. }
  1400. new curgun,curammo;
  1401. GetPlayerWeaponDataEx(playa, GetWeaponSlot(gunid), curgun, curammo);
  1402. if(curgun != 0) {
  1403. SendClientMessage(playerid, X11_WHITE, "This player is holding a weapon in this slot.");
  1404. return 1;
  1405. }
  1406. new time = canUseGunCommand(playerid);
  1407. if(time != 0) {
  1408. new msg[128];
  1409. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  1410. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1411. return 1;
  1412. }
  1413. SetPVarInt(playerid, "LastGunCommand", gettime());
  1414. sendGunOffer(playerid, playa, gunid, price);
  1415.  
  1416. } else {
  1417. SendClientMessage(playerid, X11_WHITE, "USAGE: /sellgun [playerid/name] [gunname] [price]");
  1418. SendClientMessage(playerid, X11_WHITE, "To create a gun for yourself use /makegun");
  1419. new msg[128];
  1420. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1421. format(msg, sizeof(msg), "%d. Name:[%s] MatsA:[%d] MatsB:[%d] MatsC:[%d] Level:[%d]",i+1,GunJobPrices[i][EGunJobName],GunJobPrices[i][EGunJobAMats],GunJobPrices[i][EGunJobBMats],GunJobPrices[i][EGunJobCMats],GunJobPrices[i][EGunJobLevel]);
  1422. SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
  1423. }
  1424. }
  1425. return 1;
  1426. }
  1427. YCMD:selldrugs(playerid, params[], help) {
  1428. if(help) {
  1429. SendClientMessage(playerid, X11_WHITE, "Offers a player drugs");
  1430. return 1;
  1431. }
  1432. new playa, name[32], amount, price;
  1433. new job = GetPVarInt(playerid, "Job");
  1434. if(job != EJobType_Drug_Dealer) {
  1435. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Drug Dealer");
  1436. return 1;
  1437. }
  1438. new time = canUseGunCommand(playerid);
  1439. if(time != 0) {
  1440. new msg[128];
  1441. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  1442. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1443. return 1;
  1444. }
  1445. if(!sscanf(params, "k<playerLookup>s[32]dd",playa, name, amount, price)) {
  1446. if(!IsPlayerConnectEx(playa)) {
  1447. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  1448. return 1;
  1449. }
  1450. if(playa == playerid) {
  1451. SendClientMessage(playerid, X11_TOMATO_2, "You cannot sell drugs to yourself!");
  1452. return 1;
  1453. }
  1454. if(price < 1 || price >= 10000000) {
  1455. SendClientMessage(playerid, X11_WHITE, "Invalid Price");
  1456. return 1;
  1457. }
  1458. if(amount < 1 || amount > 9999) {
  1459. SendClientMessage(playerid, X11_WHITE, "Invalid Amount!");
  1460. return 1;
  1461. }
  1462. new Float:X, Float:Y, Float:Z, vw;
  1463. GetPlayerPos(playa, X, Y, Z);
  1464. vw = GetPlayerVirtualWorld(playa);
  1465. if(!IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z) || GetPlayerVirtualWorld(playerid) != vw) {
  1466. SendClientMessage(playerid, X11_TOMATO_2, "You are not near this person!");
  1467. return 1;
  1468. }
  1469. new type = tolower(name[0]);
  1470. new pvarname[32];
  1471. switch(type) {
  1472. case 'p': {
  1473. pvarname = "Pot";
  1474. }
  1475. case 'c': {
  1476. pvarname = "Coke";
  1477. }
  1478. case 'm': {
  1479. pvarname = "Meth";
  1480. }
  1481. default: {
  1482. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Drug Type!");
  1483. return 1;
  1484. }
  1485. }
  1486. SetPVarInt(playerid, "LastDrugCommand", gettime());
  1487. sendDrugOffer(playerid, playa, pvarname, amount, price);
  1488. } else {
  1489. SendClientMessage(playerid, X11_WHITE, "USAGE: /selldrugs [playerid/name] [drug] [amount] [price]");
  1490. SendClientMessage(playerid, X11_LIGHTBLUE, "Drug Types: Pot, Coke, Meth");
  1491. }
  1492. return 1;
  1493. }
  1494.  
  1495. YCMD:makegun(playerid, params[], help) {
  1496. if(help) {
  1497. SendClientMessage(playerid, X11_WHITE, "Offer a player a weapon to sell");
  1498. return 1;
  1499. }
  1500. new gun[32];
  1501. new job = GetPVarInt(playerid, "Job");
  1502. if(job != EJobType_Arms_Dealer) {
  1503. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Gun Dealer");
  1504. return 1;
  1505. }
  1506. if(IsGunBanned(playerid)) {
  1507. SendClientMessage(playerid, X11_TOMATO_2, "You are weapon banned!");
  1508. return 1;
  1509. }
  1510. if(!sscanf(params, "s[32]", gun)) {
  1511. new gunid = -1;
  1512. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1513. if(!strcmp(GunJobPrices[i][EGunJobName], gun)) {
  1514. gunid = GunJobPrices[i][EGunJobWeaponID];
  1515. break;
  1516. }
  1517. }
  1518. if(gunid == -1) {
  1519. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Weapon");
  1520. return 1;
  1521. }
  1522. if(!canAffordGun(playerid, gunid)) {
  1523. SendClientMessage(playerid, X11_RED3, "You don't have enough materials for this weapon.");
  1524. return 1;
  1525. }
  1526. if(!hasGunLevel(playerid, gunid)) {
  1527. SendClientMessage(playerid, X11_RED3, "You don't have the gun level required to make this.");
  1528. return 1;
  1529. }
  1530. new string[128];
  1531. new weaponname[32];
  1532. new time = canUseGunCommand(playerid);
  1533. if(time != 0) {
  1534. new msg[128];
  1535. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  1536. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1537. return 1;
  1538. }
  1539. SetPVarInt(playerid, "LastGunCommand", gettime());
  1540. GetWeaponNameEx(gunid, weaponname, sizeof(weaponname));
  1541. format(string, sizeof(string), "* %s makes a %s and hands it to %sself.", GetPlayerNameEx(playerid, ENameType_RPName), weaponname, getThirdPersonPersonalPronoun(playerid));
  1542. ProxMessage(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1543. removeGunMaterials(playerid, gunid);
  1544. GivePlayerWeaponEx(playerid, gunid, -1);
  1545. } else {
  1546. SendClientMessage(playerid, X11_WHITE, "USAGE: /makegun [gunname]");
  1547. new msg[128];
  1548. for(new i=0;i<sizeof(GunJobPrices);i++) {
  1549. format(msg, sizeof(msg), "%d. Name:[%s] MatsA:[%d] MatsB:[%d] MatsC:[%d] Level:[%d]",i+1,GunJobPrices[i][EGunJobName],GunJobPrices[i][EGunJobAMats],GunJobPrices[i][EGunJobBMats],GunJobPrices[i][EGunJobCMats],GunJobPrices[i][EGunJobLevel]);
  1550. SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
  1551. }
  1552. }
  1553. return 1;
  1554. }
  1555. YCMD:skills(playerid, params[], help) {
  1556. tempstr[0] = 0;
  1557. dialogstr[0] = 0;
  1558. if(help) {
  1559. SendClientMessage(playerid, X11_WHITE, "Shows your current job skill");
  1560. return 1;
  1561. }
  1562. for(new i=0;i<sizeof(Skills);i++) {
  1563. format(tempstr, sizeof(tempstr), "%s\n",Skills[i][ESkill_Name]);
  1564. strcat(dialogstr,tempstr,sizeof(dialogstr));
  1565. }
  1566. ShowPlayerDialog(playerid, EJobs_SkillsDialog, DIALOG_STYLE_LIST, "Skills",dialogstr,"Select", "Cancel");
  1567. return 1;
  1568. }
  1569. YCMD:find(playerid, params[], help) {
  1570. if(help) {
  1571. SendClientMessage(playerid, X11_WHITE, "Mercenary command for finding a player");
  1572. return 1;
  1573. }
  1574. new playa;
  1575. new job = GetPVarInt(playerid, "Job");
  1576. if(job != EJobType_Mercenary) {
  1577. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Mercenary");
  1578. return 1;
  1579. }
  1580. new time = canUseMercCommand(playerid);
  1581. new msg[128];
  1582. if(time != 0) {
  1583. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  1584. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1585. return 1;
  1586. }
  1587. if(!sscanf(params, "k<playerLookup>", playa)) {
  1588. if(!IsPlayerConnectEx(playa)) {
  1589. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  1590. return 1;
  1591. }
  1592. if(GetPlayerState(playa) == PLAYER_STATE_SPECTATING || GetPlayerVirtualWorld(playa) != 0 || GetPlayerInterior(playa) != 0 || isTinFoiled(playa)) {
  1593. SendClientMessage(playerid, X11_TOMATO_2, "Could not locate player.");
  1594. return 1;
  1595. }
  1596. if(EAdminFlags:GetPVarInt(playa, "AdminFlags") & EAdminFlags_AdminManage) {
  1597. format(msg, sizeof(msg), "%s has used /find on you.",GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
  1598. SendClientMessage(playa, X11_ORANGE, msg);
  1599. }
  1600. new Float:X, Float:Y, Float:Z;
  1601. GetPlayerPos(playa, X, Y, Z);
  1602. SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
  1603. SetTimerEx("RemoveCheckpoint", getMercCheckpointTimeout(playerid), false, "d", playerid);
  1604. SetPVarInt(playerid, "LastMercCommand", gettime());
  1605. increaseJobPoints(playerid);
  1606. } else {
  1607. SendClientMessage(playerid, X11_WHITE, "USAGE: /find [playerid/name]");
  1608. }
  1609. return 1;
  1610. }
  1611. YCMD:free(playerid, params[], help) {
  1612. if(help) {
  1613. SendClientMessage(playerid, X11_WHITE, "Lawyer command for setting a player out on bail");
  1614. return 1;
  1615. }
  1616. new playa, price;
  1617. new job = GetPVarInt(playerid, "Job");
  1618. new Float:X, Float:Y, Float:Z;
  1619. if(job != EJobType_Lawyer) {
  1620. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Lawyer");
  1621. return 1;
  1622. }
  1623. if(!sscanf(params, "k<playerLookup>d", playa, price)) {
  1624. if(!IsPlayerConnectEx(playa)) {
  1625. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  1626. return 1;
  1627. }
  1628. if(playerid == playa) {
  1629. SendClientMessage(playerid, X11_TOMATO_2, "You can't free yourself!");
  1630. return 1;
  1631. }
  1632. if(price < 500 || price > 999999) {
  1633. SendClientMessage(playerid, X11_TOMATO_2, "The price can't be below 500 or above 999999!");
  1634. return 1;
  1635. }
  1636. GetPlayerPos(playa, X, Y, Z);
  1637. if(!IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) {
  1638. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from this person!");
  1639. return 1;
  1640. }
  1641. if(GetPVarType(playa, "ReleaseTime") != PLAYER_VARTYPE_NONE) {
  1642. sendLawyerOffer(playerid, playa, price);
  1643. } else {
  1644. SendClientMessage(playerid, X11_TOMATO_2, "This person is not in jail.");
  1645. }
  1646. } else {
  1647. SendClientMessage(playerid, X11_WHITE, "USAGE: /free [playerid/name] [price]");
  1648. }
  1649. return 1;
  1650. }
  1651. YCMD:tinfoil(playerid, params[], help) {
  1652. if(help) {
  1653. SendClientMessage(playerid, X11_WHITE, "Lawyer command for tinfoiling a player");
  1654. return 1;
  1655. }
  1656. new playa;
  1657. new job = GetPVarInt(playerid, "Job");
  1658. new Float:X, Float:Y, Float:Z;
  1659. if(job != EJobType_Lawyer) {
  1660. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Lawyer");
  1661. return 1;
  1662. }
  1663. if(!sscanf(params, "k<playerLookup>", playa)) {
  1664. if(!IsPlayerConnectEx(playa)) {
  1665. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  1666. return 1;
  1667. }
  1668. if(playerid == playa) {
  1669. SendClientMessage(playerid, X11_TOMATO_2, "You can't hide yourself!");
  1670. return 1;
  1671. }
  1672. GetPlayerPos(playa, X, Y, Z);
  1673. if(!IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) {
  1674. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from this person!");
  1675. return 1;
  1676. }
  1677. if(isTinFoiled(playa)) {
  1678. toggleTinFoil(playa);
  1679. SendClientMessage(playerid, COLOR_LIGHTBLUE, "This person is not tinfoiled anymore!");
  1680. SendClientMessage(playa, COLOR_LIGHTBLUE, "You aren't being tinfoiled any longer!");
  1681. } else {
  1682. toggleTinFoil(playa);
  1683. SendClientMessage(playerid, COLOR_LIGHTBLUE, "This person is being tinfoiled by you by now!");
  1684. SendClientMessage(playa, COLOR_LIGHTBLUE, "You are being tinfoiled by a lawyer by now!");
  1685. }
  1686. } else {
  1687. SendClientMessage(playerid, X11_WHITE, "USAGE: /tinfoil [playerid/name]");
  1688. }
  1689. return 1;
  1690. }
  1691. YCMD:sellvest(playerid, params[], help) {
  1692. new user, price;
  1693. new Float:amount;
  1694. new job = GetPVarInt(playerid, "Job");
  1695. if(job != EJobType_Mercenary) {
  1696. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Mercenary");
  1697. return 1;
  1698. }
  1699. if(!sscanf(params, "k<playerLookup>dF(98.0)", user, price, amount)) {
  1700. if(!IsPlayerConnectEx(user)) {
  1701. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  1702. return 1;
  1703. }
  1704. if(user == playerid) {
  1705. SendClientMessage(playerid, X11_TOMATO_2, "You can't sell a vest to yourself!");
  1706. return 1;
  1707. }
  1708. new time = canUseMercCommand(playerid);
  1709. if(time != 0) {
  1710. new msg[128];
  1711. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  1712. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1713. return 1;
  1714. }
  1715. if(price < 500 || price > 999999) {
  1716. SendClientMessage(playerid, X11_TOMATO_2, "The price can't be below 500 or above 999999!");
  1717. return 1;
  1718. }
  1719. new Float:X, Float:Y, Float:Z;
  1720. GetPlayerPos(user, X, Y, Z);
  1721. if(!IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) {
  1722. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from this person!");
  1723. return 1;
  1724. }
  1725. if(amount > 98.0 && amount <= 100.0) {
  1726. amount = 98.0;
  1727. }
  1728. if(amount < 1.0 || amount > 98.0) {
  1729. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Vest size");
  1730. return 1;
  1731. }
  1732. sendVestOffer(playerid, user, amount, price);
  1733. SetPVarInt(playerid, "LastMercCommand", gettime());
  1734. } else {
  1735. SendClientMessage(playerid, X11_WHITE, "USAGE: /sellvest [playeird/name] [price] (amount)");
  1736. }
  1737. return 1;
  1738. }
  1739. toggleTinFoil(playerid) {
  1740. if(isTinFoiled(playerid)) {
  1741. DeletePVar(playerid, "TinFoil");
  1742. } else {
  1743. SetPVarInt(playerid, "TinFoil", 1);
  1744. }
  1745. }
  1746. isTinFoiled(playerid) {
  1747. if(GetPVarType(playerid, "TinFoil") != PLAYER_VARTYPE_NONE) {
  1748. return 1;
  1749. }
  1750. return 0;
  1751. }
  1752. sendVestOffer(playerid, user, Float:amount, price) {
  1753. new msg[128];
  1754. new matCPrice = floatround(amount*40);
  1755. new totalmats = GetPVarInt(playerid, "MatsC");
  1756. if(matCPrice > totalmats) {
  1757. format(msg, sizeof(msg), "You need %d more Mats C to make a vest!",matCPrice-totalmats);
  1758. SendClientMessage(playerid, X11_TOMATO_2, msg);
  1759. return 1;
  1760. }
  1761. SetPVarFloat(user, "VestAmount", amount);
  1762. SetPVarInt(user, "VestSeller", playerid);
  1763. SetPVarInt(user, "VestPrice", price);
  1764. SetPVarInt(playerid, "VestOfferer", user);
  1765. SetPVarInt(playerid, "VestMatsPrice", matCPrice);
  1766. format(msg, sizeof(msg), "* %s wants to sell you a amoured vest(%.3f armour) for $%s",GetPlayerNameEx(playerid, ENameType_RPName), amount, getNumberString(price));
  1767. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Vest Offer sent");
  1768. ShowPlayerDialog(user, EJobs_SellVest, DIALOG_STYLE_MSGBOX, "Vest Offer", msg, "Accept", "Reject");
  1769. return 1;
  1770. }
  1771. sendLawyerOffer(playerid, user, price) {
  1772. new msg[128];
  1773. if(playerid == user) {
  1774. SendClientMessage(playerid, X11_TOMATO_2, "You cannot set yourself out on bail, call a lawyer. '/service lawyer'");
  1775. return 1;
  1776. }
  1777. if(GetPVarInt(user, "Bail") == PLAYER_VARTYPE_NONE) {
  1778. SendClientMessage(playerid, X11_TOMATO_2, "This person doesn't have a bail, you cannot set them free.");
  1779. return 1;
  1780. }
  1781. new bail = GetPVarInt(user, "Bail");
  1782. new totalprice = bail+price;
  1783. SetPVarInt(user, "LawyerID", playerid);
  1784. SetPVarInt(user, "LawyerPrice", totalprice);
  1785. SetPVarInt(playerid, "FreedomOfferer", user);
  1786. format(msg, sizeof(msg), "* %s wants to set you free on bail for $%s",GetPlayerNameEx(playerid, ENameType_RPName), getNumberString(totalprice));
  1787. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Lawyer Offer sent");
  1788. ShowPlayerDialog(user, EJobs_LawyerFree, DIALOG_STYLE_MSGBOX, "Lawyer Offer", msg, "Accept", "Reject");
  1789. return 1;
  1790. }
  1791. canUseDrugCommand(playerid) {
  1792. new lastcmd = GetPVarInt(playerid, "LastDrugCommand");
  1793. new coolout = getDrugCooldownTime(playerid);
  1794. new time = gettime();
  1795. if(lastcmd+coolout > time) {
  1796. return lastcmd+coolout-time;
  1797. }
  1798. return 0;
  1799. }
  1800. getDrugCooldownTime(playerid) {
  1801. new coolout = 15;
  1802. new level = getJobLevel(playerid);
  1803. switch(level) {
  1804. case 1: {
  1805. coolout += 165;
  1806. }
  1807. case 2: {
  1808. coolout += 105;
  1809. }
  1810. case 3: {
  1811. coolout += 95;
  1812. }
  1813. case 4: {
  1814. coolout += 55;
  1815. }
  1816. }
  1817. return coolout;
  1818. }
  1819. canUseMercCommand(playerid) {
  1820. new lastcmd = GetPVarInt(playerid, "LastMercCommand");
  1821. new coolout = getMercCooldownTime(playerid);
  1822. new time = gettime();
  1823. if(lastcmd+coolout > time) {
  1824. return lastcmd+coolout-time;
  1825. }
  1826. return 0;
  1827. }
  1828. getMercCooldownTime(playerid) {
  1829. new coolout = 15;
  1830. new level = getJobLevel(playerid);
  1831. switch(level) {
  1832. case 1: {
  1833. coolout += 165;
  1834. }
  1835. case 2: {
  1836. coolout += 105;
  1837. }
  1838. case 3: {
  1839. coolout += 95;
  1840. }
  1841. case 4: {
  1842. coolout += 55;
  1843. }
  1844. }
  1845. return coolout;
  1846. }
  1847.  
  1848. canUseGunCommand(playerid) {
  1849. new lastcmd = GetPVarInt(playerid, "LastGunCommand");
  1850. new coolout = getGunCooldownTime(playerid);
  1851. new time = gettime();
  1852. if(lastcmd+coolout > time) {
  1853. return lastcmd+coolout-time;
  1854. }
  1855. return 0;
  1856. }
  1857. getGunCooldownTime(playerid) {
  1858. new coolout = 15;
  1859. new level = getJobLevel(playerid);
  1860. switch(level) {
  1861. case 1: {
  1862. coolout += 165;
  1863. }
  1864. case 2: {
  1865. coolout += 105;
  1866. }
  1867. case 3: {
  1868. coolout += 95;
  1869. }
  1870. case 4: {
  1871. coolout += 55;
  1872. }
  1873. }
  1874. return coolout;
  1875. }
  1876. getMercCheckpointTimeout(playerid) {
  1877. new level = getJobLevel(playerid);
  1878. new time = 60000;
  1879. switch(level) {
  1880. case 1: {
  1881. time -= 45000;
  1882. }
  1883. case 2: {
  1884. time -= 35000;
  1885. }
  1886. case 3: {
  1887. time -= 25000;
  1888. }
  1889. case 4: {
  1890. time -= 15000;
  1891. }
  1892. }
  1893. return time;
  1894. }
  1895. getMaxPizzaDeliveryTime(playerid, index) {
  1896. new Float: pDistance = GetPlayerDistanceFromPoint(playerid, Houses[index][EHouseX], Houses[index][EHouseY], Houses[index][EHouseZ]);
  1897. return floatround(pDistance/15, floatround_round);
  1898. }
  1899. initiatePizzaDelivery(playerid) {
  1900. new job = GetPVarInt(playerid, "Job");
  1901. if(job != EJobType_PizzaMan) {
  1902. return 1;
  1903. }
  1904. new string[128];
  1905. new houseid = getClosestPizzaDelivery(playerid);
  1906. new deliverytime = getMaxPizzaDeliveryTime(playerid, houseid);
  1907. SetPlayerCheckpoint(playerid, Houses[houseid][EHouseX],Houses[houseid][EHouseY],Houses[houseid][EHouseZ],5.0);
  1908. SetPVarInt(playerid, "IsOnPizzaRoute", 1);
  1909. SetPVarFloat(playerid, "PizzaDeliveryTime", deliverytime);
  1910. format(string, sizeof(string), "You have %d seconds to deliver the pizza to the destination.", deliverytime);
  1911. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1912. return 1;
  1913. }
  1914. getClosestPizzaDelivery(playerid) {
  1915. new Float:pDistance;
  1916. new index;
  1917. for(new i=0;i<sizeof(Houses);i++) {
  1918. pDistance = GetPlayerDistanceFromPoint(playerid, Houses[i][EHouseX], Houses[i][EHouseY], Houses[i][EHouseZ]);
  1919. if(pDistance > random(1000)) {
  1920. continue;
  1921. }
  1922. index = i;
  1923. }
  1924. SetPVarFloat(playerid, "PizzaTravelDistance", pDistance);
  1925. return index;
  1926. }
  1927. onPizzaDeliverySuccess(playerid) {
  1928. if(GetPVarType(playerid, "PizzaDeliveryTime") != PLAYER_VARTYPE_NONE) {
  1929. new Float:totaldist = GetPVarFloat(playerid, "PizzaTravelDistance");
  1930. new Float:takentime = GetPVarFloat(playerid, "PizzaDeliveryTime");
  1931. new pay;
  1932. new string[128];
  1933. DeletePVar(playerid, "IsOnPizzaRoute");
  1934. DeletePVar(playerid, "PizzaDeliveryTime");
  1935. DeletePVar(playerid, "PizzaTravelDistance");
  1936. SetPlayerPos(playerid, 2112.063964, -1778.667968, 13.390113);
  1937. PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  1938. if(takentime >= 5) {
  1939. takentime = takentime*2;
  1940. pay = floatround(totaldist/10.0+takentime, floatround_round);
  1941. format(string, sizeof(string), "Pizza delivered! $%s were added to your paycheck! Speed Bonus: $%s", getNumberString(pay), getNumberString(floatround(takentime)));
  1942. } else {
  1943. pay = floatround(totaldist/10.0, floatround_round);
  1944. format(string, sizeof(string), "Pizza delivered! $%s were added to your paycheck!", getNumberString(pay));
  1945. }
  1946. new paycheck = GetPVarInt(playerid, "Payday");
  1947. SetPVarInt(playerid, "Payday", paycheck+pay);
  1948. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  1949. DisablePlayerCheckpoint(playerid);
  1950. new vehicleid = GetPlayerVehicleID(playerid);
  1951. SetVehicleToRespawn(vehicleid);
  1952. }
  1953. return 1;
  1954. }
  1955. onPizzaDeliveryFail(playerid) {
  1956. if(GetPVarType(playerid, "PizzaDeliveryTime") != PLAYER_VARTYPE_NONE) {
  1957. DeletePVar(playerid, "IsOnPizzaRoute");
  1958. DeletePVar(playerid, "PizzaDeliveryTime");
  1959. new vehicleid = GetPVarInt(playerid, "LastCar");
  1960. SetVehicleToRespawn(vehicleid);
  1961. SetPlayerPos(playerid, 2112.063964, -1778.667968, 13.390113);
  1962. SendClientMessage(playerid, X11_TOMATO_2, "You failed to deliver the pizza!");
  1963. DisablePlayerCheckpoint(playerid);
  1964. }
  1965. return 1;
  1966. }
  1967. doPizzaTime(playerid) {
  1968. new string[24];
  1969. new Float:pizzadeliverytime;
  1970. if(GetPVarType(playerid, "PizzaDeliveryTime") != PLAYER_VARTYPE_NONE) {
  1971. pizzadeliverytime = GetPVarFloat(playerid, "PizzaDeliveryTime");
  1972. format(string, sizeof(string), "%d", floatround(pizzadeliverytime-1, floatround_round));
  1973. GameTextForPlayer(playerid, string, 1000, 6);
  1974. SetPVarFloat(playerid, "PizzaDeliveryTime", pizzadeliverytime-1);
  1975. if(pizzadeliverytime < 0) {
  1976. onPizzaDeliveryFail(playerid);
  1977. }
  1978. }
  1979. }
  1980. checkJobsTime() {
  1981. foreach(Player, i) {
  1982. if(IsPlayerConnectEx(i)) {
  1983. if(GetPVarInt(i, "Job") == EJobType_PizzaMan) {
  1984. doPizzaTime(i);
  1985. }
  1986. }
  1987. }
  1988. }
  1989. jobOnPlayerEnterCheckpoint(playerid) {
  1990. if(GetPVarType(playerid, "TrashRoute") != PLAYER_VARTYPE_NONE) {
  1991. new msg[128];
  1992. new route = GetPVarInt(playerid, "TrashRoute");
  1993. new index = GetPVarInt(playerid, "TrashRouteIndex");
  1994. DisablePlayerCheckpoint(playerid);
  1995. if(!IsPlayerInRangeOfPoint(playerid, 15.0, TrashRoutePaths[index][ETrashPointX],TrashRoutePaths[index][ETrashPointY],TrashRoutePaths[index][ETrashPointZ])) {
  1996. SendClientMessage(playerid, X11_TOMATO_2, "You must be in the trash point!");
  1997. SetPlayerCheckpoint(playerid, TrashRoutePaths[index][ETrashPointX],TrashRoutePaths[index][ETrashPointY],TrashRoutePaths[index][ETrashPointZ],5.0);
  1998. return 1;
  1999. }
  2000. if(index != -1 && ++index < sizeof(TrashRoutePaths) && TrashRoutePaths[index][ETrashRouteIndex] == route) {
  2001. SetPlayerCheckpoint(playerid, TrashRoutePaths[index][ETrashPointX],TrashRoutePaths[index][ETrashPointY],TrashRoutePaths[index][ETrashPointZ],5.0);
  2002. SetPVarInt(playerid, "TrashRouteIndex",index);
  2003. format(msg, sizeof(msg), "~n~~n~~n~~n~~n~~n~~g~Next Stop: ~r~%s",TrashRoutePaths[index][ETrashPointName]);
  2004. } else {
  2005. SendClientMessage(playerid, X11_WHITE, "You have finished your trash route. You will recieve your money next payday.");
  2006. new pay = GetPVarInt(playerid, "Payday");
  2007. pay += TrashRoutes[route][ETrashPathReward];
  2008. SetPVarInt(playerid, "Payday", pay);
  2009. DeletePVar(playerid, "TrashRoute");
  2010. DeletePVar(playerid, "TrashRouteIndex");
  2011. return 1;
  2012. }
  2013. PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  2014. GameTextForPlayer(playerid, msg, 10000, 3);
  2015. } else if(GetPVarType(playerid, "CurrentSmugglerRoute") != PLAYER_VARTYPE_NONE) {
  2016. new p = GetPVarInt(playerid, "CurrentSmugglerRoute");
  2017. if(!IsPlayerInRangeOfPoint(playerid, 15.0, SmugglerRoutes[p][EIRX], SmugglerRoutes[p][EIRY], SmugglerRoutes[p][EIRZ])) {
  2018. SendClientMessage(playerid, X11_TOMATO_2, "You must be in the smuggler point!");
  2019. SetPlayerCheckpoint(playerid, SmugglerRoutes[p][EIRX], SmugglerRoutes[p][EIRY], SmugglerRoutes[p][EIRZ],5.0);
  2020. return 1;
  2021. }
  2022. nextSmugglerRoute(playerid);
  2023. }
  2024. if(GetPVarType(playerid, "IsOnPizzaRoute") != PLAYER_VARTYPE_NONE) {
  2025. onPizzaDeliverySuccess(playerid);
  2026. }
  2027. return 1;
  2028. }
  2029. //called when a player somehow aborts a job
  2030. onJobAbort(playerid) {
  2031. new job = GetPVarInt(playerid, "Job");
  2032. if(job != -1) {
  2033. switch(job) {
  2034. case EJobType_TrashCleaner: {
  2035. if(GetPVarType(playerid, "TrashRoute") != PLAYER_VARTYPE_NONE) {
  2036. DeletePVar(playerid, "TrashRoute");
  2037. DeletePVar(playerid, "TrashRouteIndex");
  2038. DisablePlayerCheckpoint(playerid);
  2039. SendClientMessage(playerid, X11_WHITE, "You failed your job because you exited the vehicle.");
  2040. }
  2041. }
  2042. case EJobType_TaxiDriver: {
  2043. if(GetPVarType(playerid, "TaxiPassenger") != PLAYER_VARTYPE_NONE) {
  2044. new passenger = GetPVarInt(playerid, "TaxiPassenger");
  2045. if(IsPlayerConnectEx(passenger)) {
  2046. onTaxiPassengerAbort(passenger);
  2047. DeletePVar(passenger, "TaxiDriver");
  2048. }
  2049. DeletePVar(playerid, "TaxiPassenger");
  2050. }
  2051. }
  2052. case EJobType_Smuggler: {
  2053. endSmuggleRoute(playerid);
  2054. }
  2055. case EJobType_PizzaMan: {
  2056. onPizzaDeliveryFail(playerid);
  2057. }
  2058. }
  2059. }
  2060. }
  2061. onTaxiPassengerAbort(playerid) {
  2062. if(GetPVarType(playerid, "TaxiPassenger") != PLAYER_VARTYPE_NONE) {
  2063. new driver = GetPVarInt(playerid, "TaxiDriver");
  2064. SendClientMessage(driver, X11_RED, "Taxi round ended.");
  2065. SendClientMessage(playerid, X11_RED,"Taxi charges aborted");
  2066. DeletePVar(playerid, "TaxiPassenger");
  2067. DeletePVar(playerid, "TaxiDriver");
  2068. }
  2069. }
  2070. startRoute(playerid, index) {
  2071. new msg[128];
  2072. new rindex = GetStartingRouteIndex(index);
  2073. if(rindex == -1) {
  2074. SendClientMessage(playerid, X11_RED3, "Script error: Failed to start route, report this to an admin");
  2075. return 0;
  2076. }
  2077. SetPVarInt(playerid, "TrashRoute",index);
  2078. SetPVarInt(playerid, "TrashRouteIndex",rindex);
  2079. SetPlayerCheckpoint(playerid, TrashRoutePaths[rindex][ETrashPointX], TrashRoutePaths[rindex][ETrashPointY], TrashRoutePaths[rindex][ETrashPointZ], 5.0);
  2080. format(msg, sizeof(msg), "~n~~n~~n~~n~~n~~n~~g~Next Stop: ~r~%s",TrashRoutePaths[rindex][ETrashPointName]);
  2081. PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  2082. GameTextForPlayer(playerid, msg, 10000, 3);
  2083. return 1;
  2084. }
  2085. nextSmugglerRoute(playerid) {
  2086. new r;
  2087. if(GetPVarType(playerid, "CurrentSmugglerRoute") == PLAYER_VARTYPE_NONE) {
  2088. r = random(sizeof(SmugglerRoutes));
  2089. SetPlayerCheckpoint(playerid, SmugglerRoutes[r][EIRX], SmugglerRoutes[r][EIRY], SmugglerRoutes[r][EIRZ], 5.0);
  2090. SetPVarInt(playerid, "CurrentSmugglerRoute", r);
  2091. SetPVarInt(playerid, "SmugglerDeliver", 0);
  2092. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Drive to the destination on your mini-map to pickup the items");
  2093. } else {
  2094. new l = GetPVarInt(playerid, "CurrentSmugglerRoute");
  2095. new o = GetPVarInt(playerid, "LastSmugglerRoute");
  2096. if(GetPVarInt(playerid, "SmugglerDeliver") == 0) {
  2097. SetPVarInt(playerid, "SmugglerDeliver", 1);
  2098. } else {
  2099. new Float:distance = GetPointDistance(SmugglerRoutes[r][EIRX], SmugglerRoutes[r][EIRY], SmugglerRoutes[r][EIRZ], SmugglerRoutes[o][EIRX], SmugglerRoutes[o][EIRY], SmugglerRoutes[o][EIRZ]);
  2100. new money = floatround(distance)/4;
  2101. money += 100;
  2102. SetPVarInt(playerid, "SmugglerDeliver", 0);
  2103. GiveMoneyEx(playerid, money);
  2104. format(query, sizeof(query), "* You earned $%d from this delievery!",money);
  2105. SendClientMessage(playerid, COLOR_LIGHTGREEN, query);
  2106. }
  2107. do {
  2108. r = random(sizeof(SmugglerRoutes));
  2109. } while(IsPointInRangeOfPoint(SmugglerRoutes[r][EIRX], SmugglerRoutes[r][EIRY], SmugglerRoutes[r][EIRZ],2500.0,SmugglerRoutes[l][EIRX], SmugglerRoutes[l][EIRY], SmugglerRoutes[l][EIRZ]));
  2110. SetPlayerCheckpoint(playerid, SmugglerRoutes[r][EIRX], SmugglerRoutes[r][EIRY], SmugglerRoutes[r][EIRZ], 5.0);
  2111. SetPVarInt(playerid, "CurrentSmugglerRoute", r);
  2112. SetPVarInt(playerid, "LastSmugglerRoute",l);
  2113. }
  2114. return r;
  2115. }
  2116. endSmuggleRoute(playerid) {
  2117. if(GetPVarType(playerid, "CurrentSmugglerRoute") != PLAYER_VARTYPE_NONE) {
  2118. DeletePVar(playerid, "CurrentSmugglerRoute");
  2119. DeletePVar(playerid, "LastSmugglerRoute");
  2120. DeletePVar(playerid, "SmugglerDeliver");
  2121. DisablePlayerCheckpoint(playerid);
  2122. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* The job has been aborted");
  2123. }
  2124. }
  2125. startSmugglerRoute(playerid) {
  2126. nextSmugglerRoute(playerid);
  2127. }
  2128. YCMD:startclean(playerid, params[], help) {
  2129. dialogstr[0] = 0;
  2130. tempstr[0] = 0;
  2131. new carid = GetPlayerVehicleID(playerid);
  2132. if(carid != 0) {
  2133. if(VehicleInfo[carid][EVType] != EVehicleType_JobCar) {
  2134. SendClientMessage(playerid, X11_RED3, "You must be in a Trash Cleaner vehicle");
  2135. return 1;
  2136. }
  2137. } else {
  2138. SendClientMessage(playerid, X11_RED3, "You must be in a Trash Cleaner vehicle, do /jobcar near the vehicle point to spawn a trash car if none are available.");
  2139. return 1;
  2140. }
  2141. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER){
  2142. SendClientMessage(playerid, X11_TOMATO_2, "You must be the driver!");
  2143. return 1;
  2144. }
  2145. new job = GetPVarInt(playerid, "Job");
  2146. if(job != EJobType_TrashCleaner) {
  2147. SendClientMessage(playerid, X11_TOMATO_2,"You must be a trash cleaner");
  2148. return 1;
  2149. }
  2150. if(!IsPlayerInRangeOfPoint(playerid, 50.0, JobPickups[job][EJobSpotX],JobPickups[job][EJobSpotY],JobPickups[job][EJobSpotZ])) {
  2151. SendClientMessage(playerid, X11_WHITE, "You must be near the job spot in order to do this. Do /jobspots to see all the job spots");
  2152. return 1;
  2153. }
  2154. for(new i=0;i<sizeof(TrashRoutes);i++) {
  2155. format(tempstr,sizeof(tempstr),"Route: %s Number of stops: %d Pay: $%s\n",TrashRoutes[i][ETrashPathName],GetNumTrashPaths(i), getNumberString(TrashRoutes[i][ETrashPathReward]));
  2156. strcat(dialogstr,tempstr,sizeof(dialogstr));
  2157. }
  2158. ShowPlayerDialog(playerid, EJobs_TrashDialog, DIALOG_STYLE_LIST, "Choose your garbage route",dialogstr,"Select", "Cancel");
  2159. return 1;
  2160. }
  2161. YCMD:fare(playerid, params[], help) {
  2162. if(help) {
  2163. SendClientMessage(playerid, X11_WHITE, "Sets a players taxi fare");
  2164. return 1;
  2165. }
  2166. new price;
  2167. new job = GetPVarInt(playerid, "Job");
  2168. if(job != EJobType_TaxiDriver) {
  2169. SendClientMessage(playerid, X11_TOMATO_2, "You must be a Taxi Driver!");
  2170. return 1;
  2171. }
  2172. new time,timenow;
  2173. time = GetPVarInt(playerid, "FareCooldown");
  2174. timenow = gettime();
  2175. if(JOB_PICKUP_COOLDOWN-(timenow-time) > 0) {
  2176. SendClientMessage(playerid, X11_TOMATO_2, "You must wait before using this command again!");
  2177. return 1;
  2178. }
  2179. if(!sscanf(params, "d", price)) {
  2180. if(price < 1 || price > 500) {
  2181. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Price!");
  2182. return 1;
  2183. }
  2184. new carid = GetPlayerVehicleID(playerid);
  2185. if(carid != 0) {
  2186. if(VehicleInfo[carid][EVType] != EVehicleType_JobCar) {
  2187. SendClientMessage(playerid, X11_RED3, "You must be in a Taxi Driver vehicle");
  2188. return 1;
  2189. }
  2190. } else {
  2191. SendClientMessage(playerid, X11_RED3, "You must be in a Taxi Driver vehicle, do /jobcar near the vehicle point to spawn a taxi if none are available.");
  2192. return 1;
  2193. }
  2194. if(GetPVarType(playerid, "TaxiFare") == PLAYER_VARTYPE_NONE) {
  2195. new msg[128];
  2196. SetPVarInt(playerid, "TaxiFare", price);
  2197. format(msg, sizeof(msg), "Taxi Driver %s is now on duty for $%s, do /service taxi to call for a taxi",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),getNumberString(price));
  2198. SendClientMessageToAll(TEAM_GROVE_COLOR, msg);
  2199. } else {
  2200. SendClientMessage(playerid, X11_WHITE, "You are now off duty.");
  2201. DeletePVar(playerid, "TaxiFare");
  2202. }
  2203. SetPVarInt(playerid, "FareCooldown", gettime());
  2204. } else {
  2205. SendClientMessage(playerid, X11_WHITE, "USAGE: /fare [price]");
  2206. }
  2207. return 1;
  2208. }
  2209. YCMD:tie(playerid, params[], help) {
  2210. if(help) {
  2211. SendClientMessage(playerid, X11_WHITE, "Ties or unties a player");
  2212. return 1;
  2213. }
  2214. new target;
  2215. new job = GetPVarInt(playerid, "Job");
  2216. if(job != EJobType_Mercenary) {
  2217. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Mercenary");
  2218. return 1;
  2219. }
  2220. new time = canUseMercCommand(playerid);
  2221. if(time != 0) {
  2222. new msg[128];
  2223. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  2224. SendClientMessage(playerid, X11_TOMATO_2, msg);
  2225. return 1;
  2226. }
  2227. if(!sscanf(params, "k<playerLookup>", target)) {
  2228. if(!IsPlayerConnectEx(target)) {
  2229. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  2230. return 1;
  2231. }
  2232. if(IsPlayerInAnyVehicle(target) == 0 || IsPlayerInAnyVehicle(playerid) == 0) {
  2233. SendClientMessage(playerid, X11_TOMATO_2, "You both must be in a car");
  2234. return 1;
  2235. }
  2236. if(GetPlayerVehicleID(target) != GetPlayerVehicleID(playerid)) {
  2237. SendClientMessage(playerid, X11_TOMATO_2, "You must be in the same vehicle!");
  2238. return 1;
  2239. }
  2240. new string[128];
  2241. if(GetPVarType(target,"Tied") == PLAYER_VARTYPE_NONE) {
  2242. format(string, sizeof(string), "* You were tied by %s.", GetPlayerNameEx(playerid, ENameType_RPName));
  2243. SendClientMessage(target, COLOR_LIGHTBLUE, string);
  2244. format(string, sizeof(string), "* You tied %s.", GetPlayerNameEx(target, ENameType_RPName));
  2245. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  2246. GameTextForPlayer(target, "~r~Tied", 2500, 3);
  2247. TogglePlayerControllableEx(target, 0);
  2248. SetPVarInt(target, "Tied", 1);
  2249. } else {
  2250. format(string, sizeof(string), "* You were untied by %s.", GetPlayerNameEx(playerid, ENameType_RPName));
  2251. SendClientMessage(target, COLOR_LIGHTBLUE, string);
  2252. format(string, sizeof(string), "* You untied %s.", GetPlayerNameEx(target, ENameType_RPName));
  2253. SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  2254. GameTextForPlayer(target, "~g~Untied", 2500, 3);
  2255. TogglePlayerControllableEx(target, 1);
  2256. DeletePVar(target, "Tied");
  2257. }
  2258. } else {
  2259. SendClientMessage(playerid, X11_WHITE, "USAGE: /(un)tie [playerid/name]");
  2260. }
  2261. return 1;
  2262. }
  2263. YCMD:trunkplayer(playerid, params[], help) {
  2264. if(help) {
  2265. SendClientMessage(playerid, X11_WHITE, "Puts a player in your trunk");
  2266. return 1;
  2267. }
  2268. new job = GetPVarInt(playerid, "Job");
  2269. if(job != EJobType_Mercenary) {
  2270. SendClientMessage(playerid, X11_TOMATO_2,"You must be a Mercenary");
  2271. return 1;
  2272. }
  2273. new msg[128];
  2274. new time = canUseMercCommand(playerid);
  2275. if(time != 0) {
  2276. format(msg, sizeof(msg), "You must wait %d seconds before continuing",time);
  2277. SendClientMessage(playerid, X11_TOMATO_2, msg);
  2278. return 1;
  2279. }
  2280. new carid = GetClosestVehicle(playerid);
  2281. if(carid == -1) {
  2282. SendClientMessage(playerid, X11_TOMATO_2, "There are no cars!");
  2283. return 1;
  2284. }
  2285. new target;
  2286. if(!sscanf(params,"k<playerLookup>",target)) {
  2287. if(!IsPlayerConnectEx(target) || target == playerid) {
  2288. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  2289. return 1;
  2290. }
  2291. new Float:X, Float:Y, Float:Z;
  2292. GetVehiclePos(carid, X, Y, Z);
  2293. if(GetPVarType(target, "TrunkedCar") == PLAYER_VARTYPE_NONE && !IsPlayerInRangeOfPoint(target, 2.5, X, Y, Z) ) {
  2294. SendClientMessage(playerid, X11_TOMATO_2, "The player is too far away!");
  2295. return 1;
  2296. }
  2297. GetPlayerPos(target, X, Y, Z);
  2298. if(GetPVarType(target, "TrunkedCar") == PLAYER_VARTYPE_NONE && !IsPlayerInRangeOfPoint(playerid, 5.5, X, Y, Z) && !IsPlayerInAnyVehicle(target)) {
  2299. SendClientMessage(playerid, X11_TOMATO_2, "You are too far away from this person!");
  2300. return 1;
  2301. }
  2302. new engine,lights,alarm,doors,bonnet,boot,objective;
  2303. GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
  2304. if(boot == 0) {
  2305. SendClientMessage(playerid, X11_TOMATO_2, "The trunk must be opened");
  2306. return 1;
  2307. }
  2308. if(GetPVarType(target, "TrunkedCar") == PLAYER_VARTYPE_NONE) {
  2309. SetPVarInt(target, "TrunkedCar", carid);
  2310. saveSpecDetails(target);
  2311. TogglePlayerSpectating(target, 1);
  2312. PlayerSpectateVehicle(target, carid);
  2313. format(msg, sizeof(msg), "* %s throws %s in the vehicles trunk.", GetPlayerNameEx(playerid, ENameType_RPName), GetPlayerNameEx(target, ENameType_RPName));
  2314. SetPVarInt(playerid, "LastMercCommand", gettime());
  2315. } else {
  2316. if(GetPVarInt(target, "TrunkedCar") != carid) {
  2317. SendClientMessage(playerid, X11_TOMATO_2, "This player is not in this car!");
  2318. return 1;
  2319. }
  2320. format(msg, sizeof(msg), "* %s pulls %s out of the vehicles trunk.", GetPlayerNameEx(playerid, ENameType_RPName), GetPlayerNameEx(target, ENameType_RPName));
  2321. DeletePVar(target, "TrunkedCar");
  2322. GetPlayerPos(playerid, X, Y, Z);
  2323. TogglePlayerSpectating(target, 0);
  2324. loadSpecDetails(target, 0);
  2325. SetPlayerPos(target, X, Y, Z);
  2326. }
  2327. ProxMessage(30.0, playerid, msg, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2328.  
  2329. } else {
  2330. SendClientMessage(playerid, X11_WHITE, "USAGE: /(un)trunkplayer [playerid/name]");
  2331. }
  2332. return 1;
  2333. }
  2334. /*
  2335. Have you finished your job?
  2336. */
  2337.  
  2338. CanTakeJob(playerid) {
  2339. new time = gettime();
  2340. new jobtime = GetPVarInt(playerid, "JobTime");
  2341. if(JOB_EXPIRE_TIME-(time-jobtime) > 0) {
  2342. return JOB_EXPIRE_TIME-(time-jobtime);
  2343. }
  2344. return 0;
  2345. }
  2346. SetPlayerJob(playerid, jobid, skipcontract = 0) {
  2347. new msg[128];
  2348. SetPVarInt(playerid, "Job", jobid);
  2349. if(skipcontract == 0) {
  2350. format(msg, sizeof(msg), "You are now on a one hour contract. When it is complete, you can use {FF6347}/quitjob");
  2351. SendClientMessage(playerid, X11_WHITE, msg);
  2352. SetPVarInt(playerid, "JobTime",gettime());
  2353. }
  2354. return 1;
  2355. }
  2356. stock GetJobName(jobid) {
  2357. new name[MAX_JOB_NAME];
  2358. if(jobid < 0 || jobid > sizeof(JobPickups)-1) {
  2359. strmid(name,"None",0, 4, sizeof(name));
  2360. } else {
  2361. strmid(name,JobPickups[jobid][EJobName],0, strlen(JobPickups[jobid][EJobName]), sizeof(name));
  2362. }
  2363. return name;
  2364. }
  2365. GetNumJobs() {
  2366. return sizeof(JobPickups);
  2367. }
  2368. GetNumTrashPaths(index) {
  2369. new count;
  2370. for(new i=0;i<sizeof(TrashRoutePaths);i++) {
  2371. if(TrashRoutePaths[i][ETrashRouteIndex] == index) {
  2372. count++;
  2373. }
  2374. }
  2375. return count;
  2376. }
  2377. GetStartingRouteIndex(route) {
  2378. for(new i=0;i<sizeof(TrashRoutePaths);i++) {
  2379. if(TrashRoutePaths[i][ETrashRouteIndex] == route) {
  2380. return i;
  2381. }
  2382. }
  2383. return -1;
  2384. }
  2385. sendGunOffer(playerid, target, gunid, price) {
  2386. new msg[128];
  2387. new gunname[32];
  2388. GetWeaponNameEx(gunid, gunname, sizeof(gunname));
  2389. format(msg, sizeof(msg), "%s wants to sell you a %s for $%s", GetPlayerNameEx(playerid, ENameType_RPName),gunname, getNumberString(price));
  2390. SetPVarInt(target, "GunSeller", playerid);
  2391. SetPVarInt(target, "GunPrice", price);
  2392. SetPVarInt(target, "GunSellID", gunid);
  2393. SendClientMessage(playerid, X11_WHITE, "Offered gun to player, waiting to see if he will accept");
  2394. ShowPlayerDialog(target, EJobs_GunSellDialog, DIALOG_STYLE_MSGBOX, "Gun deal", msg, "Accept", "Reject");
  2395. }
  2396. sendDrugOffer(playerid, target, drugname[], amount, price) {
  2397. new total = GetPVarInt(playerid, drugname);
  2398. if(total < amount) {
  2399. SendClientMessage(playerid, X11_TOMATO_2, "You don't have enough drugs!");
  2400. return 1;
  2401. }
  2402. new msg[128];
  2403. format(msg, sizeof(msg), "%s wants to sell you %sgs of %s for $%s", GetPlayerNameEx(playerid, ENameType_RPName),getNumberString(amount), drugname, getNumberString(price));
  2404. SetPVarInt(target, "DrugSeller", playerid);
  2405. SetPVarInt(target, "DrugBuyer", target);
  2406. SetPVarInt(target, "DrugPrice", price);
  2407. SetPVarInt(target, "DrugAmount", amount);
  2408. SetPVarString(target, "DrugType", drugname);
  2409. SendClientMessage(playerid, X11_WHITE, "Offered drugs to player, waiting to see if he will accept");
  2410. ShowPlayerDialog(target, EJobs_DrugSellDialog, DIALOG_STYLE_MSGBOX, "Drug Deal", msg, "Accept", "Reject");
  2411. return 0;
  2412. }
  2413.  
  2414. findJobSkillIndex(job) {
  2415. for(new i=0;i<sizeof(Skills);i++) {
  2416. if(Skills[i][ESkill_Job] == job) {
  2417. return i;
  2418. }
  2419. }
  2420. return -1;
  2421. }
  2422. increaseJobPoints(playerid) {
  2423. new pvarname[32];
  2424. getJobPointsPVarName(playerid, pvarname, sizeof(pvarname));
  2425. new level = GetPVarInt(playerid, pvarname);
  2426. setJobPoints(playerid, level+1);
  2427. }
  2428. setJobPoints(playerid, level) {
  2429. new index = findJobSkillIndex(GetPVarInt(playerid, "Job"));
  2430. setSkillPoints(playerid, index, level);
  2431. }
  2432. setSkillPoints(playerid, skillindex, points) {
  2433. query[0] = 0;
  2434. SetPVarInt(playerid, Skills[skillindex][ESkill_PVarName], points);
  2435. format(query, sizeof(query), "UPDATE `characters` SET `%s` = %d WHERE `id` = %d", Skills[skillindex][ESkill_PVarName], points, GetPVarInt(playerid, "CharID"));
  2436. mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", "");
  2437. }
  2438. increaseSkillPoints(playerid, skillindex) {
  2439. new points = getSkillPoints(playerid, skillindex);
  2440. points++;
  2441. setSkillPoints(playerid, skillindex, points);
  2442. }
  2443. getJobPoints(playerid) {
  2444. new points;
  2445. new pvarname[32];
  2446. getJobPointsPVarName(playerid, pvarname, sizeof(pvarname));
  2447. points = GetPVarInt(playerid, pvarname);
  2448. return points;
  2449. }
  2450. #pragma unused getJobPoints
  2451. getJobPointsPVarName(playerid, dst[], dstlen) {
  2452. new job = GetPVarInt(playerid, "Job");
  2453. new index = findJobSkillIndex(job);
  2454. if(index != -1) {
  2455. strmid(dst, Skills[index][ESkill_PVarName], 0, strlen(Skills[index][ESkill_PVarName]), dstlen);
  2456. }
  2457. return 0;
  2458. }
  2459. getJobLevel(playerid) {
  2460. new job = GetPVarInt(playerid, "Job");
  2461. new index = findJobSkillIndex(job);
  2462. if(index != -1) {
  2463. return getSkillLevel(playerid, index);
  2464. }
  2465.  
  2466. return 0;
  2467. }
  2468. getSkillLevel(playerid, skillindex) {
  2469. if(skillindex < 0 || skillindex > sizeof(Skills)) {
  2470. return 0;
  2471. }
  2472. new points = GetPVarInt(playerid, Skills[skillindex][ESkill_PVarName]);
  2473. if(points <= Skills[skillindex][ESkill_Level1Points]) {
  2474. return 1;
  2475. }
  2476. if(points <= Skills[skillindex][ESkill_Level2Points]) {
  2477. return 2;
  2478. }
  2479. if(points <= Skills[skillindex][ESkill_Level3Points]) {
  2480. return 3;
  2481. }
  2482. if(points <= Skills[skillindex][ESkill_Level4Points]) {
  2483. return 4;
  2484. } else {
  2485. //if(points <= Skills[skillindex][ESkill_Level5Points]) {
  2486. return 5;
  2487. }
  2488. }
  2489. getSkillPoints(playerid, skillindex) {
  2490. if(skillindex < 0 || skillindex > sizeof(Skills)) {
  2491. return 0;
  2492. }
  2493. return GetPVarInt(playerid, Skills[skillindex][ESkill_PVarName]);
  2494. }
  2495.  
  2496. showJobSkills(playerid, index) {
  2497. new msg[256];
  2498. new levelupstr[128];
  2499. new level = getSkillLevel(playerid, index);
  2500. new remainingpoints;
  2501. switch(level) {
  2502. case 1: {
  2503. remainingpoints = Skills[index][ESkill_Level1Points];
  2504. }
  2505. case 2: {
  2506. remainingpoints = Skills[index][ESkill_Level2Points];
  2507. }
  2508. case 3: {
  2509. remainingpoints = Skills[index][ESkill_Level3Points];
  2510. }
  2511. case 4: {
  2512. remainingpoints = Skills[index][ESkill_Level4Points];
  2513. }
  2514. case 5: {
  2515. remainingpoints = Skills[index][ESkill_Level5Points];
  2516. }
  2517. }
  2518. remainingpoints -= getSkillPoints(playerid, index);
  2519. if(remainingpoints < 0) remainingpoints = 0;
  2520. format(levelupstr, sizeof(levelupstr), Skills[index][ESkill_LevelUpStr], remainingpoints);
  2521. format(msg, sizeof(msg), "{FF0000}%s\n{FFFF00}%s\nYou are level %d!",Skills[index][ESkill_Name],levelupstr,getSkillLevel(playerid, index));
  2522. ShowPlayerDialog(playerid, EJobs_SkillInfoDialog, DIALOG_STYLE_MSGBOX, "Skills", msg, "Ok", "");
  2523. return 1;
  2524. }
  2525. loadSkills(playerid) {
  2526. format(query, sizeof(query), "SELECT ");
  2527. for(new i=0;i<sizeof(Skills);i++) {
  2528. format(tempstr, sizeof(tempstr), "`%s`,",Skills[i][ESkill_PVarName]);
  2529. strcat(query, tempstr, sizeof(query));
  2530. }
  2531. query[strlen(query)-1] = 0;
  2532. format(tempstr, sizeof(tempstr), " FROM `characters` WHERE `id` = %d",GetPVarInt(playerid, "CharID"));
  2533. strcat(query, tempstr, sizeof(query));
  2534. mysql_function_query(g_mysql_handle, query, true, "OnLoadSkills", "d",playerid);
  2535. }
  2536. forward OnLoadSkills(playerid);
  2537. public OnLoadSkills(playerid) {
  2538. new rows, fields;
  2539. cache_get_data(rows, fields);
  2540. if(rows < 0 ){
  2541. return 1;
  2542. }
  2543. new fieldname[32],data[32];
  2544. for(new i=0;i<fields;i++) {
  2545. cache_get_field(i, fieldname);
  2546. cache_get_row(0, i, data);
  2547. SetPVarInt(playerid, fieldname, strval(data));
  2548. }
  2549. return 0;
  2550. }
  2551. saveSkills(playerid) {
  2552. format(query, sizeof(query), "UPDATE `characters` SET ");
  2553. for(new i=0;i<sizeof(Skills);i++) {
  2554. format(tempstr, sizeof(tempstr), "`%s` = %d,",Skills[i][ESkill_PVarName],GetPVarInt(playerid,Skills[i][ESkill_PVarName]) );
  2555. strcat(query, tempstr, sizeof(query));
  2556. }
  2557. query[strlen(query)-1] = 0;
  2558. format(tempstr, sizeof(tempstr), " WHERE `id` = %d",GetPVarInt(playerid, "CharID"));
  2559. strcat(query, tempstr, sizeof(query));
  2560. mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", "");
  2561. }
  2562. YCMD:service(playerid, params[], help) {
  2563. new type[32];
  2564. if(help) {
  2565. SendClientMessage(playerid, X11_WHITE, "Request a service");
  2566. return 1;
  2567. }
  2568. if(!sscanf(params, "s[32]", type)) {
  2569. new time,timenow;
  2570. time = GetPVarInt(playerid, "ServiceCooldown");
  2571. timenow = gettime();
  2572. if(JOB_PICKUP_COOLDOWN-(timenow-time) > 0) {
  2573. SendClientMessage(playerid, X11_TOMATO_2, "You must wait before using this command again!");
  2574. return 1;
  2575. }
  2576. SetPVarInt(playerid, "ServiceCooldown", gettime());
  2577. new msg[128];
  2578. if(!strcmp(type, "Mechanic", true)) {
  2579. format(msg, sizeof(msg), "* %s is requesting a mechanic {FFFFFF}(( /accept mechanic %d ))",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),playerid);
  2580. sendJobMessage(EJobType_Mechanic, COLOR_LIGHTBLUE, msg);
  2581. SetPVarInt(playerid, "MechRequest", gettime());
  2582. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Your request has been sent to all on duty mechanics");
  2583. } else if(!strcmp(type, "Taxi", true)) {
  2584. format(msg, sizeof(msg), "* %s is requesting a taxi {FFFFFF}(( /accept taxi %d ))",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),playerid);
  2585. sendJobMessage(EJobType_TaxiDriver, COLOR_LIGHTBLUE, msg);
  2586. SetPVarInt(playerid, "TaxiRequest", gettime());
  2587. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Your request has been sent to all on duty taxi drivers");
  2588. } else if(!strcmp(type, "Lawyer", true)) {
  2589. format(msg, sizeof(msg), "* %s is requesting a lawyer {FFFFFF}(( /accept lawyer %d ))",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),playerid);
  2590. sendJobMessage(EJobType_Lawyer, COLOR_LIGHTBLUE, msg);
  2591. SetPVarInt(playerid, "LawyerRequest", gettime());
  2592. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Your request has been sent to all lawyers");
  2593. } else if(!strcmp(type, "EMS", true)) {
  2594. format(msg, sizeof(msg), "* %s is requesting a paramedic {FFFFFF}(( /accept EMS %d ))",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),playerid);
  2595. SendMedicMessage(COLOR_LIGHTBLUE, 1, msg);
  2596. SetPVarInt(playerid, "MedicRequest", gettime());
  2597. SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Your request has been sent to all on duty EMS members");
  2598. } else {
  2599. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Type!");
  2600. }
  2601. } else {
  2602. SendClientMessage(playerid, X11_WHITE, "USAGE: /service [type]");
  2603. SendClientMessage(playerid, X11_WHITE, "Types: Mechanic, Taxi, EMS, Lawyer");
  2604. }
  2605. return 1;
  2606. }
  2607. YCMD:accept(playerid, params[], help) {
  2608. if(help) {
  2609. SendClientMessage(playerid, X11_WHITE, "Accept something from someone");
  2610. return 1;
  2611. }
  2612. new type[32], user;
  2613. new Float:X, Float:Y, Float:Z;
  2614. if(!sscanf(params, "s[32]U(-1)", type, user)) {
  2615. if(!strcmp(type, "Mechanic", true)) {
  2616. new job = GetPVarInt(playerid, "Job");
  2617. if(job != EJobType_Mechanic) {
  2618. SendClientMessage(playerid, X11_TOMATO_2, "You must be a mechanic for this!");
  2619. return 1;
  2620. }
  2621. if(!IsPlayerConnectEx(user)) {
  2622. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  2623. return 1;
  2624. }
  2625. if(GetPVarInt(user, "MechRequest") != PLAYER_VARTYPE_NONE) {
  2626. new msg[128];
  2627. format(msg, sizeof(msg), "* %s has accepted your mechanic request. Stay where you are and wait.",GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
  2628. SendClientMessage(user, X11_YELLOW, msg);
  2629. format(msg, sizeof(msg), "* %s has accepted the mechanic request of %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),GetPlayerNameEx(user, ENameType_RPName_NoMask));
  2630. sendJobMessage(EJobType_Mechanic, COLOR_LIGHTBLUE, msg);
  2631. DeletePVar(user, "MechRequest");
  2632. if(GetPlayerInterior(user) != 0 || GetPlayerVirtualWorld(user) != 0) {
  2633. SendClientMessage(playerid, X11_TOMATO_2, "This user is inside a building now!");
  2634. return 1;
  2635. }
  2636. GetPlayerPos(user, X, Y, Z);
  2637. SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
  2638. SendClientMessage(playerid, COLOR_LIGHTGREEN, "(( Do /killcheckpoint to remove the checkpoint from your radar ))");
  2639. } else {
  2640. SendClientMessage(playerid, X11_TOMATO_2, "This person is not requesting a mechanic!");
  2641. }
  2642. } else if(!strcmp(type, "Taxi", true)) {
  2643. new job = GetPVarInt(playerid, "Job");
  2644. if(job != EJobType_TaxiDriver) {
  2645. SendClientMessage(playerid, X11_TOMATO_2, "You must be a taxi driver for this!");
  2646. return 1;
  2647. }
  2648. if(!IsPlayerConnectEx(user)) {
  2649. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  2650. return 1;
  2651. }
  2652. if(GetPVarInt(user, "TaxiRequest") != PLAYER_VARTYPE_NONE) {
  2653. new msg[128];
  2654. format(msg, sizeof(msg), "* %s has accepted your taxi request. Stay where you are and wait.",GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
  2655. SendClientMessage(user, X11_YELLOW, msg);
  2656. format(msg, sizeof(msg), "* %s has accepted the taxi request of %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),GetPlayerNameEx(user, ENameType_RPName_NoMask));
  2657. sendJobMessage(EJobType_TaxiDriver, COLOR_LIGHTBLUE, msg);
  2658. DeletePVar(user, "TaxiRequest");
  2659. if(GetPlayerInterior(user) != 0 || GetPlayerVirtualWorld(user) != 0) {
  2660. SendClientMessage(playerid, X11_TOMATO_2, "This user is inside a building now!");
  2661. return 1;
  2662. }
  2663. GetPlayerPos(user, X, Y, Z);
  2664. SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
  2665. SendClientMessage(playerid, COLOR_LIGHTGREEN, "(( Do /killcheckpoint to remove the checkpoint from your radar ))");
  2666. } else {
  2667. SendClientMessage(playerid, X11_TOMATO_2, "This person is not requesting a taxi!");
  2668. }
  2669. } else if(!strcmp(type, "Lawyer", true)) {
  2670. new job = GetPVarInt(playerid, "Job");
  2671. if(job != EJobType_Lawyer) {
  2672. SendClientMessage(playerid, X11_TOMATO_2, "You must be a lawyer for this!");
  2673. return 1;
  2674. }
  2675. if(!IsPlayerConnectEx(user)) {
  2676. SendClientMessage(playerid, X11_TOMATO_2, "User not found");
  2677. return 1;
  2678. }
  2679. if(GetPVarInt(user, "LawyerRequest") != PLAYER_VARTYPE_NONE) {
  2680. new msg[128];
  2681. format(msg, sizeof(msg), "* %s has accepted your lawyer request. Stay where you are and wait.",GetPlayerNameEx(playerid, ENameType_RPName_NoMask));
  2682. SendClientMessage(user, X11_YELLOW, msg);
  2683. format(msg, sizeof(msg), "* %s has accepted the lawyer request of %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),GetPlayerNameEx(user, ENameType_RPName_NoMask));
  2684. sendJobMessage(EJobType_TaxiDriver, COLOR_LIGHTBLUE, msg);
  2685. DeletePVar(user, "LawyerRequest");
  2686. } else {
  2687. SendClientMessage(playerid, X11_TOMATO_2, "This person is not requesting a lawyer!");
  2688. }
  2689. } else if(!strcmp(type, "EMS", true)) {
  2690. new faction = GetPVarInt(playerid, "Faction");
  2691. if(getFactionType(faction) != EFactionType_EMS) {
  2692. SendClientMessage(playerid, X11_TOMATO_2, "You must be a medic");
  2693. return 1;
  2694. }
  2695. if(GetPVarInt(user, "MedicRequest") != 0) {
  2696. new msg[128];
  2697. format(msg, sizeof(msg), "* %s has accepted the medic request of %s",GetPlayerNameEx(playerid, ENameType_RPName_NoMask),GetPlayerNameEx(user, ENameType_RPName_NoMask));
  2698. SendMedicMessage(COLOR_LIGHTBLUE, 1, msg);
  2699. DeletePVar(user, "MedicRequest");
  2700. if(GetPlayerInterior(user) != 0 || GetPlayerVirtualWorld(user) != 0) {
  2701. SendClientMessage(playerid, X11_TOMATO_2, "This person is inside an interior!");
  2702. return 1;
  2703. }
  2704. GetPlayerPos(user, X, Y, Z);
  2705. SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
  2706. SendClientMessage(playerid, COLOR_LIGHTGREEN, "(( Do /killcheckpoint to remove the checkpoint from your radar ))");
  2707. } else {
  2708. SendClientMessage(playerid, X11_TOMATO_2, "This person is not requesting a medic.");
  2709. }
  2710. }else if(!strcmp(type, "Death", true)) {
  2711. if(!isPlayerDying(playerid)) {
  2712. SendClientMessage(playerid, X11_TOMATO_2, "You are not dying!");
  2713. return 1;
  2714. }
  2715. finishDying(playerid);
  2716. } else if(!strcmp(type, "Anim", true)) {
  2717. if(IsPlayerBlocked(playerid)) {
  2718. SendClientMessage(playerid, X11_TOMATO_2, "You cannot do this right now!");
  2719. return 1;
  2720. }
  2721. if(GetPVarType(playerid, "OfferingAnim") != PLAYER_VARTYPE_NONE) {
  2722. new animidx = GetPVarInt(playerid, "OfferingAnim");
  2723. new offerer = GetPVarInt(playerid, "AnimOfferer");
  2724. new subanim = GetPVarInt(playerid, "AnimSubAnim");
  2725. SendClientMessage(offerer, COLOR_LIGHTBLUE, "* Animation Accepted!");
  2726. SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Animation Accepted!");
  2727. DeletePVar(playerid, "OfferingAnim");
  2728. DeletePVar(playerid, "AnimOfferer");
  2729. DeletePVar(playerid, "AnimSubAnim");
  2730. GetPlayerPos(offerer, X, Y, Z);
  2731. if(!IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z) || GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(offerer)) {
  2732. SendClientMessage(playerid, X11_TOMATO_2, "You are too far!");
  2733. return 1;
  2734. }
  2735. if(subanim) {
  2736. printf("subanim: %s %s %s\n",offerer,animidx,playerid);
  2737. StartPlayerSubAnim(offerer, animidx, playerid);
  2738. } else {
  2739. printf("anim: %s %s %s\n",offerer,animidx,playerid);
  2740. StartPlayerAnimation(offerer, animidx,playerid);
  2741. }
  2742. } else {
  2743. SendClientMessage(playerid, X11_TOMATO_2, "You are not being offered an animation!");
  2744. return 1;
  2745. }
  2746. return 1;
  2747. } else {
  2748. SendClientMessage(playerid, X11_TOMATO_2, "Invalid Type!");
  2749. }
  2750. } else {
  2751. SendClientMessage(playerid, X11_WHITE, "USAGE: /accept [type]");
  2752. SendClientMessage(playerid, X11_WHITE, "Types: mechanic, taxi, medic");
  2753. }
  2754. return 1;
  2755. }
  2756. sendJobMessage(job, color, const msg[]) {
  2757. foreach(Player, i) {
  2758. if(IsPlayerConnectEx(i)) {
  2759. if(GetPVarInt(i, "Job") == job) {
  2760. if(~EAccountFlags:GetPVarInt(i, "AccountFlags") & EAccountFlags_NoJobMessages) {
  2761. SendClientMessage(i, color, msg);
  2762. }
  2763. }
  2764. }
  2765. }
  2766. }
  2767.  
  2768. forward ShowSetSkillMenu(playerid,targetid);
  2769. public ShowSetSkillMenu(playerid,targetid) {
  2770. tempstr[0] = 0;
  2771. dialogstr[0] = 0;
  2772. SetPVarInt(playerid, "SetSkillTarget", targetid);
  2773. for(new i=0;i<sizeof(Skills);i++) {
  2774. format(tempstr, sizeof(tempstr), "%s\n",Skills[i][ESkill_Name]);
  2775. strcat(dialogstr, tempstr, sizeof(dialogstr));
  2776. }
  2777. ShowPlayerDialog(playerid, EJobs_SetSkillLevelMenu, DIALOG_STYLE_LIST, "Set Job",dialogstr,"Set", "Cancel");
  2778. }
  2779. OnEnterJobCar(playerid, carid, job) {
  2780. #pragma unused carid
  2781. if(job == EJobType_Smuggler && GetPVarInt(playerid, "Job") == EJobType_Smuggler) {
  2782. startSmugglerRoute(playerid);
  2783. }
  2784. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement