uzzi_Samp

Job Pizza Boy

Apr 29th, 2016
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.20 KB | None | 0 0
  1. /* Pizzaboy Part-Time Job
  2.  
  3. Made by Lucky13
  4.  
  5.  
  6. Script Version: 1.0
  7.  
  8. Script Type: Filterscript
  9.  
  10. Script Lines: 759
  11.  
  12. Script Details:
  13.  
  14. - Unique Part-Time / Side-Job Filterscript that will amaze your players
  15. - Includes 5 Pizzaboy bikes placed infront of the Well Stacked Pizza Co. in Idlewood, Los Santos
  16. - Small Introduction when you start the job, so you can know what to do ( and what not! )
  17. - Each bike can hold up to 5 pizzas! You will need to restock them back at the Well Stacked Pizza Co.
  18. - Actors added for a better Roleplay experience!
  19. - Textdraws used so you can see your statistics!
  20. - Pizza Box as Holding Object added, again, for a better Roleplay experience!
  21. - Unique Tip System! You have 30 seconds to get with the pizza to the customer. If you succeed, you
  22. will get a small tip, if you don't, you will not!
  23. - Work as long as you want!
  24.  
  25. Please keep credits ( highly appreciated ), however you can edit it anyway you like but do not release
  26. this without my permission!
  27.  
  28.  
  29. For more information about this script or feedbacks / ideas, feel free to contact me on the SA:MP Forums!
  30.  
  31. Link: http://forum.sa-mp.com/member.php?u=272024
  32.  
  33. Have Fun :)
  34.  
  35. */
  36.  
  37.  
  38. #define FILTERSCRIPT
  39.  
  40. #include <a_samp>
  41. #include <izcmd>
  42. #include <foreach>
  43.  
  44. #define CHECKPOINTS 24 // Total Houses
  45. #define PAY_PER_CHECKPOINT 10 // 10$ per delivered pizza
  46. #define MAX_TIP 20 // Maximum Random Tip + 10$
  47. #define CHECKPOINT_NONE 0 // No Checkpoint
  48. #define PIZZA_CHECKPOINT 1 // Pizza Checkpoint
  49. #define PIZZA_INDEX 9 // Pizza Index for SetPlayerAttachedObject
  50.  
  51. // Keys
  52. #define PRESSED(%0) \
  53. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  54.  
  55. // Server Pickups & 3D Texts
  56. new jobpickup;
  57. new restockpickup;
  58. new Text3D:jobtext;
  59. new Text3D:restocktext;
  60.  
  61. // Server Vehicles
  62. new pizzabikes[5];
  63. new PizzaBikesPizzas[MAX_VEHICLES];
  64.  
  65. // Player Variables
  66. new IsInJob[MAX_PLAYERS];
  67. new TipTime[MAX_PLAYERS];
  68. new PlayerTutorialTime[MAX_PLAYERS];
  69. new InfoTimer[MAX_PLAYERS];
  70. new PlayerCustomer[MAX_PLAYERS];
  71. new PlayerCheckpoint[MAX_PLAYERS];
  72. new PlayerTips[MAX_PLAYERS];
  73. new PlayerEarnings[MAX_PLAYERS];
  74. new PlayerSkin[MAX_PLAYERS];
  75.  
  76. // Textdraws
  77. new PlayerText:Textdraw0[MAX_PLAYERS];
  78. new PlayerText:Textdraw1[MAX_PLAYERS];
  79. new PlayerText:Textdraw2[MAX_PLAYERS];
  80. new PlayerText:PizzasText[MAX_PLAYERS];
  81. new PlayerText:PizzaSymbol[MAX_PLAYERS];
  82. new PlayerText:TipsText[MAX_PLAYERS];
  83. new PlayerText:EarningsText[MAX_PLAYERS];
  84. new PlayerText:TotalEarningsText[MAX_PLAYERS];
  85. new PlayerText:TipTimeText[MAX_PLAYERS];
  86.  
  87. // Timers
  88. new TutorialTimer;
  89.  
  90. // Checkpoints for each house
  91. new Float:Houses[CHECKPOINTS][4] = {
  92. {2065.9780,-1703.4775,14.1484,90.8956},
  93. {2068.2600,-1656.4601,13.5469,86.9378},
  94. {2068.8579,-1643.8237,13.5469,90.3844},
  95. {2068.7437,-1628.9187,13.8762,90.3844},
  96. {2065.0508,-1583.8545,13.4814,92.2467},
  97. {2003.0380,-1595.1025,13.5759,39.7419},
  98. {2016.8215,-1629.8384,13.5469,270.7754},
  99. {2015.4512,-1641.6316,13.7824,272.6556},
  100. {2012.0426,-1656.4589,13.5547,268.4961},
  101. {2017.1294,-1703.3452,14.2043,272.0217},
  102. {2014.4487,-1732.6185,14.2353,271.6387},
  103. {2139.1643,-1698.1489,15.0784,4.0066},
  104. {2166.9363,-1672.0193,15.0749,46.6203},
  105. {2244.2312,-1638.2906,15.9074,340.8198},
  106. {2257.1416,-1644.8845,15.5164,353.3532},
  107. {2282.2446,-1641.7231,15.8898,357.1133},
  108. {2307.0203,-1678.1877,14.0012,180.0783},
  109. {2328.2483,-1681.9125,14.8624,90.7775},
  110. {2362.8362,-1644.1184,13.5332,0.849},
  111. {2368.3418,-1674.5013,13.9063,179.1149},
  112. {2393.2185,-1646.7593,13.6432,1.7900},
  113. {2409.0159,-1673.8960,13.6045,180.0550},
  114. {2413.9771,-1647.1270,14.0119,2.4167},
  115. {2452.0852,-1642.3127,13.7357,1.4767}
  116. };
  117.  
  118. // Forwards
  119. forward ShowPlayerIntroTexts(playerid);
  120. forward HidePlayerIntroTexts(playerid);
  121. forward ShowPlayerInfoTexts(playerid);
  122. forward HidePlayerInfoTexts(playerid);
  123. forward TutorialTime();
  124. forward ShowPlayerPizzaBikeTexts(playerid);
  125. forward HidePlayerPizzaBikeTexts(playerid);
  126. forward ShowTipTimeText(playerid);
  127. forward HideTipTimeText(playerid);
  128.  
  129. #if defined FILTERSCRIPT
  130.  
  131. public OnFilterScriptInit()
  132. {
  133. print("\n--------------------------------------");
  134. print(" Pizzaboy Part-Time Job by Lucky13 Loaded!");
  135. print("--------------------------------------\n");
  136.  
  137. jobpickup = CreatePickup(1239,1,2104.2502,-1806.3750,13.5547,0);
  138. restockpickup = CreatePickup(1239,1,2116.4973,-1788.3663,13.1152,0);
  139.  
  140. pizzabikes[0] = CreateVehicle(448,2093.9578,-1812.5789,12.9786,89.6835,3,6,60000,0); // Pizzaboy
  141. pizzabikes[1] = CreateVehicle(448,2093.9387,-1814.8420,12.9820,91.6584,3,6,60000,0); // Pizzaboy
  142. pizzabikes[2] = CreateVehicle(448,2094.1182,-1816.9015,12.9825,89.0844,3,6,60000,0); // Pizzaboy
  143. pizzabikes[3] = CreateVehicle(448,2094.1975,-1819.0215,12.9821,88.4043,3,6,60000,0); // Pizzaboy
  144. pizzabikes[4] = CreateVehicle(448,2094.0500,-1821.4058,12.9817,90.0841,3,6,60000,0); // Pizzaboy
  145.  
  146. PizzaBikesPizzas[pizzabikes[0]]=5;
  147. PizzaBikesPizzas[pizzabikes[1]]=5;
  148. PizzaBikesPizzas[pizzabikes[2]]=5;
  149. PizzaBikesPizzas[pizzabikes[3]]=5;
  150. PizzaBikesPizzas[pizzabikes[4]]=5;
  151.  
  152. jobtext = Create3DTextLabel("{FF0000}Pizzaboy Job\n{FFFFFF}Use {7FFF00}/startjob{FFFFFF} to start the job!",0x008080FF,2104.2502,-1806.3750,13.5547,30.0,0,1);
  153. restocktext = Create3DTextLabel("{FF0000}Restocking Point\n{FFFFFF}Use {7FFF00}/restock{FFFFFF} to restock your pizza bike with pizzas!",0x008080FF,2116.4973,-1788.3663,13.1152,30.0,0,1);
  154.  
  155. TutorialTimer = SetTimer("TutorialTime",1000,true);
  156.  
  157. DisableInteriorEnterExits();
  158. return 1;
  159. }
  160.  
  161. public OnFilterScriptExit()
  162. {
  163. print("\n--------------------------------------");
  164. print(" Pizzaboy Part-Time Job by Lucky13 Unloaded!");
  165. print("--------------------------------------\n");
  166.  
  167. Delete3DTextLabel(jobtext);
  168. Delete3DTextLabel(restocktext);
  169. DestroyPickup(jobpickup);
  170. DestroyPickup(restockpickup);
  171. DestroyVehicle(pizzabikes[0]);
  172. DestroyVehicle(pizzabikes[1]);
  173. DestroyVehicle(pizzabikes[2]);
  174. DestroyVehicle(pizzabikes[3]);
  175. DestroyVehicle(pizzabikes[4]);
  176. KillTimer(TutorialTimer);
  177. return 1;
  178. }
  179.  
  180. PreloadAnimLib(playerid, animlib[])
  181. {
  182. ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
  183. }
  184.  
  185. public OnPlayerConnect(playerid)
  186. {
  187. IsInJob[playerid]=0;TipTime[playerid]=0;
  188. KillTimer(InfoTimer[playerid]);
  189. PlayerTutorialTime[playerid]=0;
  190. PlayerCheckpoint[playerid]=CHECKPOINT_NONE;
  191. PlayerTips[playerid]=0;
  192. PlayerEarnings[playerid]=0;
  193. PlayerSkin[playerid]=0;
  194. PreloadAnimLib(playerid,"DEALER");
  195. PreloadAnimLib(playerid,"CARRY");
  196. return 1;
  197. }
  198.  
  199. public OnPlayerDisconnect(playerid, reason)
  200. {
  201. IsInJob[playerid]=0;TipTime[playerid]=0;
  202. KillTimer(InfoTimer[playerid]);
  203. PlayerTutorialTime[playerid]=0;
  204. PlayerCheckpoint[playerid]=CHECKPOINT_NONE;
  205. PlayerTips[playerid]=0;
  206. PlayerEarnings[playerid]=0;
  207. if(IsValidActor(PlayerCustomer[playerid])) { DestroyActor(PlayerCustomer[playerid]); }
  208. PlayerSkin[playerid]=0;
  209. HidePlayerIntroTexts(playerid);
  210. HidePlayerInfoTexts(playerid);
  211. HidePlayerPizzaBikeTexts(playerid);
  212. HideTipTimeText(playerid);
  213. return 1;
  214. }
  215.  
  216. public OnPlayerDeath(playerid, killerid, reason)
  217. {
  218. if(IsInJob[playerid] == 1)
  219. {
  220. IsInJob[playerid]=0;TipTime[playerid]=0;
  221. KillTimer(InfoTimer[playerid]);
  222. PlayerTutorialTime[playerid]=0;
  223. PlayerCheckpoint[playerid]=CHECKPOINT_NONE;
  224. PlayerTips[playerid]=0;
  225. PlayerEarnings[playerid]=0;
  226. if(IsValidActor(PlayerCustomer[playerid])) { DestroyActor(PlayerCustomer[playerid]); }
  227. PlayerSkin[playerid]=0;
  228. HidePlayerIntroTexts(playerid);
  229. HidePlayerInfoTexts(playerid);
  230. HidePlayerPizzaBikeTexts(playerid);
  231. HideTipTimeText(playerid);
  232. SendClientMessage(playerid,-1," You have died and the part-time job has been canceled!");
  233. }
  234. return 1;
  235. }
  236.  
  237. CMD:pizzahelp(playerid, params[])
  238. {
  239. SendClientMessage(playerid,-1," Pizzaboy Commands: /startjob, /endjob, /restock, /getpizza, /putbackpizza");
  240. return 1;
  241. }
  242.  
  243. CMD:restock(playerid, params[])
  244. {
  245. if(IsPlayerInRangeOfPoint(playerid,3.0,2116.4973,-1788.3663,13.1152))
  246. {
  247. if(IsInJob[playerid] == 1)
  248. {
  249. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  250. {
  251. if(PizzaBikesPizzas[GetPlayerVehicleID(playerid)] == 0)
  252. {
  253. new string[56];
  254. PizzaBikesPizzas[GetPlayerVehicleID(playerid)]=5;
  255. SendClientMessage(playerid,-1," You have restocked your pizzabike with {FF0000}5 {FFFFFF}pizzas!");
  256.  
  257. PlayerTextDrawHide(playerid,PizzasText[playerid]);
  258. format(string,sizeof(string),"Pizzas: ~r~%d~w~ /~g~ 5",PizzaBikesPizzas[GetPlayerVehicleID(playerid)]);
  259. PlayerTextDrawSetString(playerid,PizzasText[playerid],string);
  260. PlayerTextDrawShow(playerid,PizzasText[playerid]);
  261. }
  262. else return SendClientMessage(playerid,-1," Your pizzabike still has some pizzas!");
  263. }
  264. else return SendClientMessage(playerid,-1," You must be on the pizzabike to use this command!");
  265. }
  266. else return SendClientMessage(playerid,-1," You must be doing the part-time job before using this command!");
  267. }
  268. else return SendClientMessage(playerid,-1," You must be at the Well Stacked Pizza Co. in order to use this command!");
  269. return 1;
  270. }
  271.  
  272. CMD:putbackpizza(playerid, params[])
  273. {
  274. if(IsInJob[playerid] == 1)
  275. {
  276. if(IsPlayerAttachedObjectSlotUsed(playerid,PIZZA_INDEX))
  277. {
  278. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  279. {
  280. new Float:X,Float:Y,Float:Z;
  281. for(new j=0;j<5;j++)
  282. {
  283. GetVehiclePos(pizzabikes[j],X,Y,Z);
  284. if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
  285. {
  286. if(PizzaBikesPizzas[pizzabikes[j]] < 5)
  287. {
  288. PizzaBikesPizzas[pizzabikes[j]]++;
  289. ClearAnimations(playerid);
  290. RemovePlayerAttachedObject(playerid, PIZZA_INDEX);
  291. SendClientMessage(playerid,-1," The pizza has been placed back in the bike!");
  292. ApplyAnimation(playerid, "INT_HOUSE", "wash_up",4.1,0,0,0,0,0,1);
  293. return 1;
  294. }
  295. else
  296. {
  297. SendClientMessage(playerid,-1," This pizzabike already has 5 pizzas!");
  298. return 1;
  299. }
  300. }
  301. }
  302. }
  303. else return SendClientMessage(playerid,-1," You must be on foot while using this command!");
  304. }
  305. else return SendClientMessage(playerid,-1," You are not holding a pizza box!");
  306. }
  307. return 1;
  308. }
  309.  
  310. CMD:getpizza(playerid, params[])
  311. {
  312. if(IsInJob[playerid] == 1)
  313. {
  314. if(!IsPlayerAttachedObjectSlotUsed(playerid,PIZZA_INDEX))
  315. {
  316. if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  317. {
  318. new Float:X,Float:Y,Float:Z;
  319. for(new j=0;j<5;j++)
  320. {
  321. GetVehiclePos(pizzabikes[j],X,Y,Z);
  322. if(IsPlayerInRangeOfPoint(playerid,3.0,X,Y,Z))
  323. {
  324. if(PizzaBikesPizzas[pizzabikes[j]] >= 1)
  325. {
  326. PizzaBikesPizzas[pizzabikes[j]]--;
  327. ApplyAnimation(playerid,"CARRY","crry_prtial",4.1,1,1,1,1,1,1);
  328. SetPlayerAttachedObject( playerid, PIZZA_INDEX, 1582, 1, 0.002953, 0.469660, -0.009797, 269.851104, 88.443557, 0.000000, 0.804894, 1.000000, 0.822361 );
  329. return 1;
  330. }
  331. else
  332. {
  333. SendClientMessage(playerid,-1," This pizzabike doesn't got any pizzas left!");
  334. return 1;
  335. }
  336. }
  337. }
  338. }
  339. else return SendClientMessage(playerid,-1," You must be on foot while using this command!");
  340. }
  341. else return SendClientMessage(playerid,-1," You are already carrying a pizza box!");
  342. }
  343. return 1;
  344. }
  345.  
  346. CMD:endjob(playerid, params[])
  347. {
  348. if(IsPlayerInRangeOfPoint(playerid,3.0,2104.2502,-1806.3750,13.5547))
  349. {
  350. if(IsInJob[playerid] == 1)
  351. {
  352. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  353. {
  354. new string[128];
  355. GivePlayerMoney(playerid,PlayerEarnings[playerid]+PlayerTips[playerid]);
  356. format(string,sizeof(string)," You have earned {7FFF00}%d$ {FFFFFF}for completing the part-time pizzaboy job!",PlayerEarnings[playerid]+PlayerTips[playerid]);
  357. SendClientMessage(playerid,-1,string);
  358. PlayerEarnings[playerid]=0;
  359. PlayerTips[playerid]=0;
  360. if(IsPlayerAttachedObjectSlotUsed(playerid,PIZZA_INDEX)) { RemovePlayerAttachedObject(playerid,PIZZA_INDEX); }
  361. PlayerCheckpoint[playerid]=CHECKPOINT_NONE;
  362. DisablePlayerCheckpoint(playerid);
  363. IsInJob[playerid]=0;
  364. PlayerTutorialTime[playerid]=0;
  365. if(IsValidActor(PlayerCustomer[playerid])) { DestroyActor(PlayerCustomer[playerid]); }
  366. TipTime[playerid]=0;
  367. HidePlayerIntroTexts(playerid);
  368. HidePlayerInfoTexts(playerid);
  369. HidePlayerPizzaBikeTexts(playerid);
  370. HideTipTimeText(playerid);
  371. PizzaBikesPizzas[GetPlayerVehicleID(playerid)]=5;
  372. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  373. RemovePlayerFromVehicle(playerid);
  374. SetPlayerSkin(playerid,PlayerSkin[playerid]);
  375. PlayerSkin[playerid]=0;
  376. }
  377. else return SendClientMessage(playerid,-1," You must be on your pizzaboy bike to end the job!");
  378. }
  379. else return SendClientMessage(playerid,-1," You must start the job before ending it!");
  380. }
  381. else return SendClientMessage(playerid,-1," You must be infront of the Well Stacked Pizza Co. to end your job!");
  382. return 1;
  383. }
  384.  
  385. CMD:startjob(playerid, params[])
  386. {
  387. if(IsPlayerInRangeOfPoint(playerid,3.0,2104.2502,-1806.3750,13.5547))
  388. {
  389. if(IsInJob[playerid] == 0)
  390. {
  391. SetPlayerCameraPos(playerid,2088.402343, -1790.125854, 16.726133);
  392. SetPlayerCameraLookAt(playerid,2102.1492,-1806.3496,18.1543);
  393. ShowPlayerIntroTexts(playerid);
  394. PlayerTutorialTime[playerid]=30;
  395. IsInJob[playerid]=1;
  396. PlayerSkin[playerid]=GetPlayerSkin(playerid);
  397. SetPlayerSkin(playerid,155);
  398. TogglePlayerControllable(playerid,0);
  399. }
  400. else return SendClientMessage(playerid,-1," You are already doing the Pizzaboy part-time job!");
  401. }
  402. else return SendClientMessage(playerid,-1," You must be infront of the Well Stacked Pizza Co. in order to start the part-time job!");
  403. return 1;
  404. }
  405.  
  406. public ShowPlayerIntroTexts(playerid)
  407. {
  408. Textdraw0[playerid] = CreatePlayerTextDraw(playerid,660.000000, 0.000000, "~n~");
  409. PlayerTextDrawBackgroundColor(playerid,Textdraw0[playerid], 255);
  410. PlayerTextDrawFont(playerid,Textdraw0[playerid], 1);
  411. PlayerTextDrawLetterSize(playerid,Textdraw0[playerid], 0.500000, 14.000000);
  412. PlayerTextDrawColor(playerid,Textdraw0[playerid], -1);
  413. PlayerTextDrawSetOutline(playerid,Textdraw0[playerid], 0);
  414. PlayerTextDrawSetProportional(playerid,Textdraw0[playerid], 1);
  415. PlayerTextDrawSetShadow(playerid,Textdraw0[playerid], 1);
  416. PlayerTextDrawUseBox(playerid,Textdraw0[playerid], 1);
  417. PlayerTextDrawBoxColor(playerid,Textdraw0[playerid], 255);
  418. PlayerTextDrawTextSize(playerid,Textdraw0[playerid], -20.000000, 0.000000);
  419. PlayerTextDrawSetSelectable(playerid,Textdraw0[playerid], 0);
  420.  
  421. Textdraw1[playerid] = CreatePlayerTextDraw(playerid,660.000000, 320.000000, "~n~");
  422. PlayerTextDrawBackgroundColor(playerid,Textdraw1[playerid], 255);
  423. PlayerTextDrawFont(playerid,Textdraw1[playerid], 1);
  424. PlayerTextDrawLetterSize(playerid,Textdraw1[playerid], 0.500000, 19.000000);
  425. PlayerTextDrawColor(playerid,Textdraw1[playerid], -1);
  426. PlayerTextDrawSetOutline(playerid,Textdraw1[playerid], 0);
  427. PlayerTextDrawSetProportional(playerid,Textdraw1[playerid], 1);
  428. PlayerTextDrawSetShadow(playerid,Textdraw1[playerid], 1);
  429. PlayerTextDrawUseBox(playerid,Textdraw1[playerid], 1);
  430. PlayerTextDrawBoxColor(playerid,Textdraw1[playerid], 255);
  431. PlayerTextDrawTextSize(playerid,Textdraw1[playerid], -20.000000, 0.000000);
  432. PlayerTextDrawSetSelectable(playerid,Textdraw1[playerid], 0);
  433.  
  434. Textdraw2[playerid] = CreatePlayerTextDraw(playerid,40.000000, 350.000000, "This is the Well Stacked Pizza Co. They are hiring part-time people~n~who want to earn a few bucks in their free time.");
  435. PlayerTextDrawBackgroundColor(playerid,Textdraw2[playerid], 255);
  436. PlayerTextDrawFont(playerid,Textdraw2[playerid], 1);
  437. PlayerTextDrawLetterSize(playerid,Textdraw2[playerid], 0.500000, 1.000000);
  438. PlayerTextDrawColor(playerid,Textdraw2[playerid], -1);
  439. PlayerTextDrawSetOutline(playerid,Textdraw2[playerid], 1);
  440. PlayerTextDrawSetProportional(playerid,Textdraw2[playerid], 1);
  441. PlayerTextDrawSetSelectable(playerid,Textdraw2[playerid], 0);
  442.  
  443. PlayerTextDrawShow(playerid,Textdraw0[playerid]);
  444. PlayerTextDrawShow(playerid,Textdraw1[playerid]);
  445. PlayerTextDrawShow(playerid,Textdraw2[playerid]);
  446. return 1;
  447. }
  448.  
  449. public HidePlayerIntroTexts(playerid)
  450. {
  451. PlayerTextDrawHide(playerid,Textdraw0[playerid]);
  452. PlayerTextDrawHide(playerid,Textdraw1[playerid]);
  453. PlayerTextDrawHide(playerid,Textdraw2[playerid]);
  454.  
  455. PlayerTextDrawDestroy(playerid,Textdraw0[playerid]);
  456. PlayerTextDrawDestroy(playerid,Textdraw1[playerid]);
  457. PlayerTextDrawDestroy(playerid,Textdraw2[playerid]);
  458. return 1;
  459. }
  460.  
  461. public ShowPlayerInfoTexts(playerid)
  462. {
  463. Textdraw0[playerid] = CreatePlayerTextDraw(playerid,150.000000, 350.000000, "Hop in one of the free bikes to start your job!");
  464. PlayerTextDrawBackgroundColor(playerid,Textdraw0[playerid], 255);
  465. PlayerTextDrawFont(playerid,Textdraw0[playerid], 1);
  466. PlayerTextDrawLetterSize(playerid,Textdraw0[playerid], 0.400000, 1.000000);
  467. PlayerTextDrawColor(playerid,Textdraw0[playerid], -1);
  468. PlayerTextDrawSetOutline(playerid,Textdraw0[playerid], 1);
  469. PlayerTextDrawSetProportional(playerid,Textdraw0[playerid], 1);
  470. PlayerTextDrawSetSelectable(playerid,Textdraw0[playerid], 0);
  471.  
  472. PlayerTextDrawShow(playerid,Textdraw0[playerid]);
  473. return 1;
  474. }
  475.  
  476. public HidePlayerInfoTexts(playerid)
  477. {
  478. if(IsPlayerConnected(playerid))
  479. {
  480. PlayerTextDrawHide(playerid,Textdraw0[playerid]);
  481. PlayerTextDrawDestroy(playerid,Textdraw0[playerid]);
  482. KillTimer(InfoTimer[playerid]);
  483. }
  484. return 1;
  485. }
  486.  
  487. public ShowPlayerPizzaBikeTexts(playerid)
  488. {
  489. new string[56];
  490. format(string,sizeof(string),"Pizzas: ~r~%d~w~ /~g~ 5",PizzaBikesPizzas[GetPlayerVehicleID(playerid)]);
  491. PizzasText[playerid] = CreatePlayerTextDraw(playerid,510.000000, 170.000000, string);
  492. PlayerTextDrawBackgroundColor(playerid,PizzasText[playerid], 255);
  493. PlayerTextDrawFont(playerid,PizzasText[playerid], 1);
  494. PlayerTextDrawLetterSize(playerid,PizzasText[playerid], 0.300000, 1.000000);
  495. PlayerTextDrawColor(playerid,PizzasText[playerid], -1);
  496. PlayerTextDrawSetOutline(playerid,PizzasText[playerid], 1);
  497. PlayerTextDrawSetProportional(playerid,PizzasText[playerid], 1);
  498. PlayerTextDrawSetSelectable(playerid,PizzasText[playerid], 0);
  499.  
  500. PizzaSymbol[playerid] = CreatePlayerTextDraw(playerid,477.000000, 156.000000, "Pizzaboy");
  501. PlayerTextDrawBackgroundColor(playerid,PizzaSymbol[playerid], 0);
  502. PlayerTextDrawFont(playerid,PizzaSymbol[playerid], 5);
  503. PlayerTextDrawLetterSize(playerid,PizzaSymbol[playerid], 0.500000, 1.000000);
  504. PlayerTextDrawColor(playerid,PizzaSymbol[playerid], -1);
  505. PlayerTextDrawSetOutline(playerid,PizzaSymbol[playerid], 0);
  506. PlayerTextDrawSetProportional(playerid,PizzaSymbol[playerid], 1);
  507. PlayerTextDrawSetShadow(playerid,PizzaSymbol[playerid], 1);
  508. PlayerTextDrawUseBox(playerid,PizzaSymbol[playerid], 1);
  509. PlayerTextDrawBoxColor(playerid,PizzaSymbol[playerid], 0);
  510. PlayerTextDrawTextSize(playerid,PizzaSymbol[playerid], 30.000000, 30.000000);
  511. PlayerTextDrawSetSelectable(playerid,PizzaSymbol[playerid], 0);
  512. PlayerTextDrawSetPreviewModel(playerid,PizzaSymbol[playerid],1582);
  513. PlayerTextDrawSetPreviewRot(playerid,PizzaSymbol[playerid],120.0,0.0,0.0,1.0);
  514.  
  515. format(string,sizeof(string),"Tips: ~g~+%d$",PlayerTips[playerid]);
  516. TipsText[playerid] = CreatePlayerTextDraw(playerid,510.000000, 218.000000, string);
  517. PlayerTextDrawBackgroundColor(playerid,TipsText[playerid], 255);
  518. PlayerTextDrawFont(playerid,TipsText[playerid], 1);
  519. PlayerTextDrawLetterSize(playerid,TipsText[playerid], 0.300000, 1.000000);
  520. PlayerTextDrawColor(playerid,TipsText[playerid], -1);
  521. PlayerTextDrawSetOutline(playerid,TipsText[playerid], 1);
  522. PlayerTextDrawSetProportional(playerid,TipsText[playerid], 1);
  523. PlayerTextDrawSetSelectable(playerid,TipsText[playerid], 0);
  524.  
  525. format(string,sizeof(string),"Earnings: ~g~%d$",PlayerEarnings[playerid]);
  526. EarningsText[playerid] = CreatePlayerTextDraw(playerid,510.000000, 208.000000, string);
  527. PlayerTextDrawBackgroundColor(playerid,EarningsText[playerid], 255);
  528. PlayerTextDrawFont(playerid,EarningsText[playerid], 1);
  529. PlayerTextDrawLetterSize(playerid,EarningsText[playerid], 0.300000, 1.000000);
  530. PlayerTextDrawColor(playerid,EarningsText[playerid], -1);
  531. PlayerTextDrawSetOutline(playerid,EarningsText[playerid], 1);
  532. PlayerTextDrawSetProportional(playerid,EarningsText[playerid], 1);
  533. PlayerTextDrawSetSelectable(playerid,EarningsText[playerid], 0);
  534.  
  535. format(string,sizeof(string),"Total Earnings: ~g~%d$",PlayerEarnings[playerid]+PlayerTips[playerid]);
  536. TotalEarningsText[playerid] = CreatePlayerTextDraw(playerid,510.000000, 228.000000, string);
  537. PlayerTextDrawBackgroundColor(playerid,TotalEarningsText[playerid], 255);
  538. PlayerTextDrawFont(playerid,TotalEarningsText[playerid], 1);
  539. PlayerTextDrawLetterSize(playerid,TotalEarningsText[playerid], 0.300000, 1.000000);
  540. PlayerTextDrawColor(playerid,TotalEarningsText[playerid], -1);
  541. PlayerTextDrawSetOutline(playerid,TotalEarningsText[playerid], 1);
  542. PlayerTextDrawSetProportional(playerid,TotalEarningsText[playerid], 1);
  543. PlayerTextDrawSetSelectable(playerid,TotalEarningsText[playerid], 0);
  544.  
  545. PlayerTextDrawShow(playerid,PizzasText[playerid]);
  546. PlayerTextDrawShow(playerid,PizzaSymbol[playerid]);
  547. PlayerTextDrawShow(playerid,EarningsText[playerid]);
  548. PlayerTextDrawShow(playerid,TotalEarningsText[playerid]);
  549. PlayerTextDrawShow(playerid,TipsText[playerid]);
  550. return 1;
  551. }
  552.  
  553. public HidePlayerPizzaBikeTexts(playerid)
  554. {
  555. PlayerTextDrawHide(playerid,PizzasText[playerid]);
  556. PlayerTextDrawHide(playerid,PizzaSymbol[playerid]);
  557. PlayerTextDrawHide(playerid,EarningsText[playerid]);
  558. PlayerTextDrawHide(playerid,TotalEarningsText[playerid]);
  559. PlayerTextDrawHide(playerid,TipsText[playerid]);
  560.  
  561. PlayerTextDrawDestroy(playerid,PizzasText[playerid]);
  562. PlayerTextDrawDestroy(playerid,PizzaSymbol[playerid]);
  563. PlayerTextDrawDestroy(playerid,EarningsText[playerid]);
  564. PlayerTextDrawDestroy(playerid,TotalEarningsText[playerid]);
  565. PlayerTextDrawDestroy(playerid,TipsText[playerid]);
  566. return 1;
  567. }
  568.  
  569. public ShowTipTimeText(playerid)
  570. {
  571. TipTimeText[playerid] = CreatePlayerTextDraw(playerid,508.000000, 191.000000, "Tip Time: 00:30");
  572. PlayerTextDrawBackgroundColor(playerid,TipTimeText[playerid], 255);
  573. PlayerTextDrawFont(playerid,TipTimeText[playerid], 2);
  574. PlayerTextDrawLetterSize(playerid,TipTimeText[playerid], 0.280000, 1.000000);
  575. PlayerTextDrawColor(playerid,TipTimeText[playerid], -1);
  576. PlayerTextDrawSetOutline(playerid,TipTimeText[playerid], 1);
  577. PlayerTextDrawSetProportional(playerid,TipTimeText[playerid], 1);
  578. PlayerTextDrawSetSelectable(playerid,TipTimeText[playerid], 0);
  579.  
  580. PlayerTextDrawShow(playerid,TipTimeText[playerid]);
  581. return 1;
  582. }
  583.  
  584. public HideTipTimeText(playerid)
  585. {
  586. PlayerTextDrawHide(playerid,TipTimeText[playerid]);
  587.  
  588. PlayerTextDrawDestroy(playerid,TipTimeText[playerid]);
  589. return 1;
  590. }
  591.  
  592. public OnPlayerStateChange(playerid, newstate, oldstate)
  593. {
  594. if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
  595. {
  596. if(IsPlayerAttachedObjectSlotUsed(playerid,PIZZA_INDEX))
  597. {
  598. RemovePlayerFromVehicle(playerid);
  599. SetPlayerArmedWeapon(playerid,0);
  600. ApplyAnimation(playerid,"CARRY","crry_prtial",4.1,1,1,1,1,1,1);
  601. }
  602. new vehid = GetPlayerVehicleID(playerid);
  603. if(vehid == pizzabikes[0] || vehid == pizzabikes[1] || vehid == pizzabikes[2] || vehid == pizzabikes[3] || vehid == pizzabikes[4])
  604. {
  605. if(IsInJob[playerid] == 1)
  606. {
  607. ShowPlayerPizzaBikeTexts(playerid);
  608. if(PlayerCheckpoint[playerid] == CHECKPOINT_NONE)
  609. {
  610. ShowPlayerInfoTexts(playerid);
  611. PlayerTextDrawHide(playerid,Textdraw0[playerid]);
  612. PlayerTextDrawSetString(playerid,Textdraw0[playerid],"Looks like you have a ~r~customer~w~! Head right to their place~n~ with a fresh ~r~pizza~w~!");
  613. PlayerTextDrawShow(playerid,Textdraw0[playerid]);
  614. InfoTimer[playerid] = SetTimerEx("HidePlayerInfoTexts",5000,false,"d",playerid);
  615. new rand = random(sizeof(Houses));
  616. new skin = random(311)+1;
  617. if(skin == 74) return skin=75;
  618. SetPlayerCheckpoint(playerid,Houses[rand][0],Houses[rand][1],Houses[rand][2],2.0);
  619. PlayerCustomer[playerid] = CreateActor(skin,Houses[rand][0],Houses[rand][1],Houses[rand][2]+0.5,Houses[rand][3]-180.0);
  620. ApplyActorAnimation(PlayerCustomer[playerid],"DEALER","DEALER_IDLE",4.1,1,0,0,0,0);
  621. PlayerCheckpoint[playerid]=PIZZA_CHECKPOINT;
  622. TipTime[playerid]=30;
  623. ShowTipTimeText(playerid);
  624. }
  625. }
  626. else
  627. {
  628. SendClientMessage(playerid,-1," You must start the job first before getting on the bike!");
  629. RemovePlayerFromVehicle(playerid);
  630. }
  631. }
  632. }
  633. else if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER) { HidePlayerPizzaBikeTexts(playerid); }
  634. return 1;
  635. }
  636.  
  637. public OnPlayerEnterCheckpoint(playerid)
  638. {
  639. if(PlayerCheckpoint[playerid] == PIZZA_CHECKPOINT)
  640. {
  641. if(IsPlayerAttachedObjectSlotUsed(playerid,PIZZA_INDEX))
  642. {
  643. new string[128];
  644. PlayerEarnings[playerid]+=PAY_PER_CHECKPOINT;
  645. format(string,sizeof(string)," You have earned {7FFF00}%d$ {FFFFFF}for delivering the pizza!",PAY_PER_CHECKPOINT);
  646. SendClientMessage(playerid,-1,string);
  647. RemovePlayerAttachedObject(playerid,PIZZA_INDEX);
  648. PlayerCheckpoint[playerid]=CHECKPOINT_NONE;
  649. DisablePlayerCheckpoint(playerid);
  650. DestroyActor(PlayerCustomer[playerid]);
  651. ClearAnimations(playerid);
  652. if(TipTime[playerid] > 0)
  653. {
  654. TipTime[playerid]=0;
  655. new tip=random(MAX_TIP)+5;
  656. PlayerTips[playerid]+=tip;
  657. format(string,sizeof(string)," Congratulations! You have also earned a {7FFF00}%d$ {FFFFFF}tip for the fast delivering!",tip);
  658. SendClientMessage(playerid,-1,string);
  659. PlayerPlaySound(playerid,1139,0.0,0.0,0.0);
  660. HideTipTimeText(playerid);
  661. }
  662. }
  663. else return SendClientMessage(playerid,-1," You must be holding the pizza box in order to enter the {FF0000}checkpoint{FFFFFF}!");
  664. }
  665. return 1;
  666. }
  667.  
  668. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  669. {
  670. if(PRESSED(KEY_FIRE))
  671. {
  672. if(IsPlayerAttachedObjectSlotUsed(playerid,PIZZA_INDEX))
  673. {
  674. SetPlayerArmedWeapon(playerid,0);
  675. ApplyAnimation(playerid,"CARRY","crry_prtial",4.1,1,1,1,1,1,1);
  676. }
  677. }
  678. return 1;
  679. }
  680.  
  681. TimeConvert(seconds)
  682. {
  683. new tmp[256];
  684. new minutes = floatround(seconds/60);
  685. seconds -= minutes*60;
  686. format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
  687. return tmp;
  688. }
  689.  
  690. public TutorialTime()
  691. {
  692. foreach(Player,i)
  693. {
  694. if(PlayerTutorialTime[i] > 0)
  695. {
  696. PlayerTutorialTime[i]--;
  697. if(PlayerTutorialTime[i] == 24)
  698. {
  699. InterpolateCameraPos(i, 2088.402343, -1790.125854, 16.726133, 2088.853027, -1812.807495, 14.554449, 3000);
  700. InterpolateCameraLookAt(i, 2092.098144, -1793.486572, 16.940910, 2093.178466, -1815.248168, 13.977611, 3000);
  701. PlayerTextDrawHide(i,Textdraw2[i]);
  702. PlayerTextDrawSetString(i,Textdraw2[i],"To start this part-time job, all you have to do is to hop in one of~n~those pizzaboy bikes.");
  703. PlayerTextDrawShow(i,Textdraw2[i]);
  704. }
  705. else if(PlayerTutorialTime[i] == 18)
  706. {
  707. InterpolateCameraPos(i, 2088.853027, -1812.807495, 14.554449, 2046.698730, -1616.230712, 49.785942, 3000);
  708. InterpolateCameraLookAt(i, 2093.144042, -1815.167358, 13.545793, 2048.481201, -1620.497070, 47.883228, 3000);
  709. PlayerTextDrawHide(i,Textdraw2[i]);
  710. PlayerTextDrawSetString(i,Textdraw2[i],"People around Idlewood and Ganton will always call when they need~n~a pizza, so you must do your best to arrive in time with~n~their hot pizza!");
  711. PlayerTextDrawShow(i,Textdraw2[i]);
  712. }
  713. else if(PlayerTutorialTime[i] == 12)
  714. {
  715. new skin = random(311)+1;
  716. if(skin == 74) return skin=75;
  717. PlayerCustomer[i] = CreateActor(skin,2067.2793,-1703.4181,14.1484,271.5973);
  718. ApplyActorAnimation(PlayerCustomer[i],"DEALER","DEALER_IDLE",4.1,1,0,0,0,0);
  719.  
  720. InterpolateCameraPos(i, 2046.698852, -1616.231201, 49.785850, 2077.879638, -1698.481567, 16.811132, 3000);
  721. InterpolateCameraLookAt(i, 2047.768066, -1620.363891, 47.182411, 2073.304199, -1700.195068, 15.748975, 3000);
  722. PlayerTextDrawHide(i,Textdraw2[i]);
  723. PlayerTextDrawSetString(i,Textdraw2[i],"Doing it in the right and fastest possible time, this will earn you~n~an extra tip alongside your paycheck!");
  724. PlayerTextDrawShow(i,Textdraw2[i]);
  725. }
  726. else if(PlayerTutorialTime[i] == 6)
  727. {
  728. InterpolateCameraPos(i, 2077.879150, -1698.480346, 16.811641, 2119.111328, -1780.575683, 15.841483, 3000);
  729. InterpolateCameraLookAt(i, 2079.523681, -1703.201416, 16.725708, 2116.954589, -1784.953247, 14.752622, 3000);
  730. PlayerTextDrawHide(i,Textdraw2[i]);
  731. PlayerTextDrawSetString(i,Textdraw2[i],"Each bike can only have ~r~5~w~ pizzas. Make sure to restock it regulary!");
  732. PlayerTextDrawShow(i,Textdraw2[i]);
  733. DestroyActor(PlayerCustomer[i]);
  734. }
  735. else if(PlayerTutorialTime[i] <= 0)
  736. {
  737. TogglePlayerSpectating(i,0);
  738. HidePlayerIntroTexts(i);
  739. ShowPlayerInfoTexts(i);
  740. InfoTimer[i] = SetTimerEx("HidePlayerInfoTexts",1000,false,"d",i);
  741. SetCameraBehindPlayer(i);
  742. TogglePlayerControllable(i,1);
  743. }
  744. }
  745. if(TipTime[i] > 0)
  746. {
  747. new string[26];
  748. TipTime[i]--;
  749. PlayerTextDrawHide(i,TipTimeText[i]);
  750. format(string,sizeof(string),"Tip Time: %s",TimeConvert(TipTime[i]));
  751. PlayerTextDrawSetString(i,TipTimeText[i],string);
  752. PlayerTextDrawShow(i,TipTimeText[i]);
  753. if(TipTime[i] == 0) { HideTipTimeText(i); }
  754. }
  755. }
  756. return 1;
  757. }
  758.  
  759. #endif
Add Comment
Please, Sign In to add comment