Advertisement
Guest User

Jari Johnson's taxi system

a guest
Feb 19th, 2013
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.85 KB | None | 0 0
  1. /*                                                      Taxi job script by Jari_Johnson
  2.                                                                 Keep the credits!
  3.                                                                 Version 1.0 bèta
  4.  
  5. When on foot, use /duty to go on duty as a taxi driver, when you have a customer, use /fare to start the fare.
  6. If you need to spawn a taxi, use /spawntaxi (can be disabled).
  7.                                                                
  8.                                                                                                                                             */
  9.  
  10.  
  11. #include <a_samp> //Credits to the SA-MP Team
  12. #include <zcmd> //Credits to Zeex
  13. #include <colors> //Credits to Oxside
  14. #include <getvehicledriver> //Credits to Smeti
  15.  
  16. #define STARTAMOUNT 2.66 //This is the starting amount for the fare, remember, enter is as a float, ex. 1.23
  17. #define MONEYPER100 1.00 //This is the amount of money the customer has to pay each 100 meters, remember, enter as a float, ex. 1.23
  18. #define ScriptVersion "1.0b"//Do not change, this is for my reference.
  19. #define AllowTaxiSpawn  //Comment this line if you don't want to allow the /spawntaxi command.
  20.  
  21. //===NEW'S====//
  22. new Text:taxiblackbox[MAX_PLAYERS];
  23. new Text:taxigreendisplay[MAX_PLAYERS];
  24. new Text:taxitimedisplay[MAX_PLAYERS];
  25. new Text:taxi100mfare[MAX_PLAYERS];
  26. new Text:taxithisfare[MAX_PLAYERS];
  27. new Text:taxilstlogo[MAX_PLAYERS];
  28. new Text:taxistatus[MAX_PLAYERS];
  29. new Text:startfare[MAX_PLAYERS];
  30. new IsOnFare[MAX_PLAYERS];
  31. new OnDuty[MAX_PLAYERS];
  32. new clockupdate;
  33. new faretimer[MAX_PLAYERS];
  34.  
  35. new Float:OldX[MAX_PLAYERS],Float:OldY[MAX_PLAYERS],Float:OldZ[MAX_PLAYERS],Float:NewX[MAX_PLAYERS],Float:NewY[MAX_PLAYERS],Float:NewZ[MAX_PLAYERS];
  36. new Float:TotalFare[MAX_PLAYERS];
  37.  
  38. //
  39. public OnFilterScriptInit()
  40. {
  41.     print("\n--------------------------------------");
  42.     printf("    Jari_Johnson's Taxi Script\n          Version %s",ScriptVersion);
  43.     print("--------------------------------------\n");
  44.     return 1;
  45. }
  46.  
  47. public OnFilterScriptExit()
  48. {
  49.     return 1;
  50. }
  51. public OnPlayerConnect(playerid)
  52. {
  53.     return 1;
  54. }
  55.  
  56. public OnPlayerDisconnect(playerid, reason)
  57. {
  58.     KillTimer(faretimer[playerid]);
  59.     OnDuty[playerid] = 0;
  60.     IsOnFare[playerid] = 0;
  61.    
  62.     TotalFare[playerid] = 0.0;
  63.    
  64.     return 1;
  65. }
  66.  
  67. public OnPlayerSpawn(playerid)
  68. {
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerDeath(playerid, killerid, reason)
  73. {
  74.     return 1;
  75. }
  76.  
  77. public OnVehicleSpawn(vehicleid)
  78. {
  79.     return 1;
  80. }
  81.  
  82. public OnVehicleDeath(vehicleid, killerid)
  83. {
  84.     return 1;
  85. }
  86.  
  87. public OnPlayerText(playerid, text[])
  88. {
  89.     return 1;
  90. }
  91.  
  92. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  93. {
  94.     return 1;
  95. }
  96.  
  97. public OnPlayerExitVehicle(playerid, vehicleid)
  98. {
  99.    
  100.     new driver = GetVehicleDriver(vehicleid);
  101.     if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER && TotalFare[driver] > 0)
  102.     {
  103.     new money = floatround(TotalFare[driver]);
  104.     new message[128];
  105.     format(message,sizeof(message),"You have paid %d $ to the Taxi driver",money);
  106.     GivePlayerMoney(playerid,-money);
  107.     TotalFare[driver] = 0;
  108.     TextDrawSetString(taxithisfare[driver],"Total Fare: N/A");
  109.     GivePlayerMoney(driver,money);
  110.     SendClientMessage(playerid,COLOR_LIGHTBLUE,message);
  111.     format(message,sizeof(message),"%s has paid you %d $ for the ride.",GetPlayerNameEx(playerid),money);
  112.     SendClientMessage(driver,COLOR_LIGHTBLUE,message);
  113.     TotalFare[driver] = 0.00;
  114.    
  115.    
  116.     IsOnFare[driver] = 0;
  117.     KillTimer(faretimer[driver]);
  118.     }
  119.    
  120.  
  121.    
  122.    
  123.  
  124.     for(new i=0; i < MAX_PLAYERS; i++)
  125.     {
  126.     TextDrawHideForPlayer(playerid, taxiblackbox[i]);
  127.     TextDrawHideForPlayer(playerid, startfare[i]);
  128.     TextDrawHideForPlayer(playerid, taxigreendisplay[i]);
  129.     TextDrawHideForPlayer(playerid, taxitimedisplay[i]);
  130.     TextDrawHideForPlayer(playerid, taxi100mfare[i]);
  131.     TextDrawHideForPlayer(playerid, taxithisfare[i]);
  132.     TextDrawHideForPlayer(playerid, taxilstlogo[i]);
  133.     TextDrawHideForPlayer(playerid, taxistatus[i]);
  134.     TextDrawHideForPlayer(playerid, startfare[i]);
  135.     }
  136.     TextDrawSetString(taxistatus[driver],"Taxi Status: Free");
  137.  
  138.     return 1;
  139. }
  140.  
  141. public OnPlayerStateChange(playerid, newstate, oldstate)
  142. {
  143.     new vehicleid = GetPlayerVehicleID(playerid);
  144.     new driver = GetVehicleDriver(vehicleid);
  145.     if(newstate == PLAYER_STATE_DRIVER)
  146.     {
  147.    
  148.     if(OnDuty[playerid] == 1 && IsATaxi(vehicleid) == 1)
  149.     {
  150.  
  151.     TextDrawShowForPlayer(playerid, taxiblackbox[playerid]);
  152.     TextDrawShowForPlayer(playerid, taxigreendisplay[playerid]);
  153.     TextDrawShowForPlayer(playerid, taxitimedisplay[playerid]);
  154.     TextDrawShowForPlayer(playerid, taxi100mfare[playerid]);
  155.     TextDrawShowForPlayer(playerid, startfare[playerid]);
  156.     TextDrawShowForPlayer(playerid, taxithisfare[playerid]);
  157.     TextDrawShowForPlayer(playerid, taxilstlogo[playerid]);
  158.     TextDrawShowForPlayer(playerid, taxistatus[playerid]);
  159.     }
  160.     }
  161.     if(newstate == PLAYER_STATE_PASSENGER)
  162.     {
  163.     if(OnDuty[driver] == 1)
  164.     {
  165.    
  166.     TextDrawShowForPlayer(playerid, taxiblackbox[driver]);
  167.     TextDrawShowForPlayer(playerid, taxigreendisplay[driver]);
  168.     TextDrawShowForPlayer(playerid, taxitimedisplay[driver]);
  169.     TextDrawShowForPlayer(playerid, taxi100mfare[driver]);
  170.     TextDrawShowForPlayer(playerid, taxithisfare[driver]);
  171.     TextDrawShowForPlayer(playerid, taxilstlogo[driver]);
  172.     TextDrawSetString(taxistatus[driver],"Taxi Status: Occupied");
  173.     TextDrawShowForPlayer(playerid, taxistatus[driver]);
  174.     TextDrawShowForPlayer(playerid, startfare[driver]);
  175.  
  176.     }
  177.     }
  178.     if(newstate == PLAYER_STATE_ONFOOT)
  179.     {
  180.    
  181.     TextDrawHideForPlayer(playerid, taxiblackbox[playerid]);
  182.     TextDrawHideForPlayer(playerid, taxigreendisplay[playerid]);
  183.     TextDrawHideForPlayer(playerid, taxitimedisplay[playerid]);
  184.     TextDrawHideForPlayer(playerid, taxi100mfare[playerid]);
  185.     TextDrawHideForPlayer(playerid, taxithisfare[playerid]);
  186.     TextDrawHideForPlayer(playerid, taxilstlogo[playerid]);
  187.     TextDrawHideForPlayer(playerid, taxistatus[playerid]);
  188.     TextDrawHideForPlayer(playerid, startfare[playerid]);
  189.    
  190.     if(IsOnFare[playerid] == 1)
  191.     {
  192.    
  193.  
  194.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"Taxi duty over - You exited the vehicle!");
  195.     OnDuty[playerid] = 0;
  196.     TotalFare[playerid] = 0.00;
  197.     TextDrawSetString(taxithisfare[playerid],"N/A");
  198.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"Fare stopped");
  199.     IsOnFare[playerid] = 0;
  200.     KillTimer(faretimer[playerid]);
  201.     TextDrawDestroy(taxiblackbox[playerid]);
  202.     TextDrawDestroy(taxigreendisplay[playerid]);
  203.     TextDrawDestroy(taxitimedisplay[playerid]);
  204.     TextDrawDestroy(taxi100mfare[playerid]);
  205.     TextDrawDestroy(taxithisfare[playerid]);
  206.     TextDrawDestroy(taxilstlogo[playerid]);
  207.     TextDrawDestroy(taxistatus[playerid]);
  208.     TextDrawDestroy(startfare[playerid]);
  209.     TextDrawDestroy(taxiblackbox[driver]);
  210.     TextDrawDestroy(taxigreendisplay[driver]);
  211.     TextDrawDestroy(taxitimedisplay[driver]);
  212.     TextDrawDestroy(taxi100mfare[driver]);
  213.     TextDrawDestroy(taxithisfare[driver]);
  214.     TextDrawDestroy(taxilstlogo[driver]);
  215.     TextDrawDestroy(taxistatus[driver]);
  216.     TextDrawDestroy(startfare[driver]);
  217.    
  218.    
  219.  
  220.     }
  221.     }
  222.     return 1;
  223. }
  224.  
  225. public OnPlayerEnterCheckpoint(playerid)
  226. {
  227.     return 1;
  228. }
  229.  
  230. public OnPlayerLeaveCheckpoint(playerid)
  231. {
  232.     return 1;
  233. }
  234.  
  235. public OnPlayerEnterRaceCheckpoint(playerid)
  236. {
  237.     return 1;
  238. }
  239.  
  240. public OnPlayerLeaveRaceCheckpoint(playerid)
  241. {
  242.     return 1;
  243. }
  244.  
  245. public OnRconCommand(cmd[])
  246. {
  247.     return 1;
  248. }
  249.  
  250. public OnPlayerRequestSpawn(playerid)
  251. {
  252.     return 1;
  253. }
  254.  
  255. public OnObjectMoved(objectid)
  256. {
  257.     return 1;
  258. }
  259.  
  260. public OnPlayerObjectMoved(playerid, objectid)
  261. {
  262.     return 1;
  263. }
  264.  
  265. public OnPlayerPickUpPickup(playerid, pickupid)
  266. {
  267.     return 1;
  268. }
  269.  
  270. public OnVehicleMod(playerid, vehicleid, componentid)
  271. {
  272.     return 1;
  273. }
  274.  
  275. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  276. {
  277.     return 1;
  278. }
  279.  
  280. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  281. {
  282.     return 1;
  283. }
  284.  
  285. public OnPlayerSelectedMenuRow(playerid, row)
  286. {
  287.     return 1;
  288. }
  289.  
  290. public OnPlayerExitedMenu(playerid)
  291. {
  292.     return 1;
  293. }
  294.  
  295. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  296. {
  297.     return 1;
  298. }
  299.  
  300. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  301. {
  302.     return 1;
  303. }
  304.  
  305. public OnRconLoginAttempt(ip[], password[], success)
  306. {
  307.     return 1;
  308. }
  309.  
  310. public OnPlayerUpdate(playerid)
  311. {
  312.     return 1;
  313. }
  314.  
  315. public OnPlayerStreamIn(playerid, forplayerid)
  316. {
  317.     return 1;
  318. }
  319.  
  320. public OnPlayerStreamOut(playerid, forplayerid)
  321. {
  322.     return 1;
  323. }
  324.  
  325. public OnVehicleStreamIn(vehicleid, forplayerid)
  326. {
  327.     return 1;
  328. }
  329.  
  330. public OnVehicleStreamOut(vehicleid, forplayerid)
  331. {
  332.     return 1;
  333. }
  334.  
  335. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  336. {
  337.     return 1;
  338. }
  339.  
  340. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  341. {
  342.     return 1;
  343. }
  344. //==COMMANDS==//
  345. CMD:fare(playerid,params[])
  346. {
  347.     if(OnDuty[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"You are not on duty");
  348.     new vehicleid = GetPlayerVehicleID(playerid);
  349.     if(!IsATaxi(vehicleid)) return SendClientMessage(playerid,COLOR_RED,"You need to be in a taxi to do this!");
  350.     if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid,COLOR_RED,"You need to be the driver to do this!");
  351.     if(CheckPassengers(vehicleid) != 1) return SendClientMessage(playerid,COLOR_RED,"DO NOT ABUSE YOUR JOB! Wait for someone to get in the taxi!");
  352.     if(IsOnFare[playerid] == 0)
  353.     {
  354.    
  355.     if(IsOnFare[playerid] == 1) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are already on a fare");
  356.     GetPlayerPos(playerid,Float:OldX[playerid],Float:OldY[playerid],Float:OldZ[playerid]);
  357.     faretimer[playerid] = SetTimerEx("FareUpdate", 1000, true, "i", playerid);
  358.     IsOnFare[playerid] = 1;
  359.     TotalFare[playerid] = STARTAMOUNT;
  360.     new formatted[128];
  361.     format(formatted,128,"Total Fare: %.2f $",STARTAMOUNT);
  362.     TextDrawSetString(taxithisfare[playerid],formatted);
  363.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now on a fare, take your customer to his/her desired place!");
  364.     return 1;
  365.     }
  366.     if(IsOnFare[playerid] == 1)
  367.     {
  368.     TotalFare[playerid] = 0.00;
  369.     TextDrawSetString(taxithisfare[playerid],"Total Fare: N/A");
  370.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"Fare stopped");
  371.     IsOnFare[playerid] = 0;
  372.     KillTimer(faretimer[playerid]);
  373.     return 1;
  374.     }
  375.     return 1;
  376.    
  377. }
  378. CMD:spawntaxi(playerid,params[])
  379. {
  380.     #if defined AllowTaxiSpawn
  381.     new Float:x,Float:y,Float:z;
  382.     GetPlayerPos(playerid,x,y,z);
  383.     CreateVehicle(420,x,y,z,0,0,0,10000);
  384.     return 1;
  385.     #else
  386.     return SendClientMessage(playerid,COLOR_RED,"This command is disabled");
  387.  
  388.     #endif
  389.    
  390. }
  391. CMD:duty(playerid,params[])
  392. {
  393.    
  394.     if(IsOnFare[playerid] == 1) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are currently on a fare, you cant go off duty now!");
  395.     if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have to be on foot to do this!");
  396.     if(OnDuty[playerid] == 0)
  397.     {
  398.     OnDuty[playerid] = 1;
  399.    
  400.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now on duty!");
  401.  
  402.  
  403.  
  404.     taxiblackbox[playerid] = TextDrawCreate(497.000000, 302.000000, "              ");
  405.     TextDrawBackgroundColor(taxiblackbox[playerid], 255);
  406.     TextDrawFont(taxiblackbox[playerid], 1);
  407.     TextDrawLetterSize(taxiblackbox[playerid], 0.500000, 1.000000);
  408.     TextDrawColor(taxiblackbox[playerid], -1);
  409.     TextDrawSetOutline(taxiblackbox[playerid], 0);
  410.     TextDrawSetProportional(taxiblackbox[playerid], 1);
  411.     TextDrawSetShadow(taxiblackbox[playerid], 1);
  412.     TextDrawUseBox(taxiblackbox[playerid], 1);
  413.     TextDrawBoxColor(taxiblackbox[playerid], 255);
  414.     TextDrawTextSize(taxiblackbox[playerid], 140.000000, -1.000000);
  415.  
  416.     taxigreendisplay[playerid] = TextDrawCreate(484.000000, 318.000000, "          ");
  417.     TextDrawBackgroundColor(taxigreendisplay[playerid], 255);
  418.     TextDrawFont(taxigreendisplay[playerid], 1);
  419.     TextDrawLetterSize(taxigreendisplay[playerid], 0.500000, 1.000000);
  420.     TextDrawColor(taxigreendisplay[playerid], -1);
  421.     TextDrawSetOutline(taxigreendisplay[playerid], 0);
  422.     TextDrawSetProportional(taxigreendisplay[playerid], 1);
  423.     TextDrawSetShadow(taxigreendisplay[playerid], 1);
  424.     TextDrawUseBox(taxigreendisplay[playerid], 1);
  425.     TextDrawBoxColor(taxigreendisplay[playerid], 576786175);
  426.     TextDrawTextSize(taxigreendisplay[playerid], 154.000000, -1.000000);
  427.  
  428.     taxitimedisplay[playerid] = TextDrawCreate(160.000000, 340.000000, "Time:  Loading..");
  429.     TextDrawBackgroundColor(taxitimedisplay[playerid], 255);
  430.     TextDrawFont(taxitimedisplay[playerid], 2);
  431.     TextDrawLetterSize(taxitimedisplay[playerid], 0.250000, 0.799999);
  432.     TextDrawColor(taxitimedisplay[playerid], 835715327);
  433.     TextDrawSetOutline(taxitimedisplay[playerid], 1);
  434.     TextDrawSetProportional(taxitimedisplay[playerid], 1);
  435.     new format100[128];
  436.     format(format100,128,"Price per 100 meters: %.2f",MONEYPER100);
  437.     taxi100mfare[playerid] = TextDrawCreate(160.000000, 360.000000, format100);
  438.     TextDrawBackgroundColor(taxi100mfare[playerid], 255);
  439.     TextDrawFont(taxi100mfare[playerid], 2);
  440.     TextDrawLetterSize(taxi100mfare[playerid], 0.250000, 0.799999);
  441.     TextDrawColor(taxi100mfare[playerid], 835715327);
  442.     TextDrawSetOutline(taxi100mfare[playerid], 1);
  443.     TextDrawSetProportional(taxi100mfare[playerid], 1);
  444.  
  445.     taxithisfare[playerid] = TextDrawCreate(160.000000, 380.000000, "This fare: N/A ");
  446.     TextDrawBackgroundColor(taxithisfare[playerid], 255);
  447.     TextDrawFont(taxithisfare[playerid], 2);
  448.     TextDrawLetterSize(taxithisfare[playerid], 0.250000, 0.799999);
  449.     TextDrawColor(taxithisfare[playerid], 835715327);
  450.     TextDrawSetOutline(taxithisfare[playerid], 1);
  451.     TextDrawSetProportional(taxithisfare[playerid], 1);
  452.  
  453.     taxilstlogo[playerid] = TextDrawCreate(220.000000, 317.000000, "Los Santos Transport");
  454.     TextDrawBackgroundColor(taxilstlogo[playerid], 255);
  455.     TextDrawFont(taxilstlogo[playerid], 3);
  456.     TextDrawLetterSize(taxilstlogo[playerid], 0.550000, 1.799998);
  457.     TextDrawColor(taxilstlogo[playerid], 835715327);
  458.     TextDrawSetOutline(taxilstlogo[playerid], 1);
  459.     TextDrawSetProportional(taxilstlogo[playerid], 1);
  460.  
  461.     taxistatus[playerid] = TextDrawCreate(320.000000, 390.000000, "Taxi Status: ");
  462.     TextDrawBackgroundColor(taxistatus[playerid], 255);
  463.     TextDrawFont(taxistatus[playerid], 2);
  464.     TextDrawLetterSize(taxistatus[playerid], 0.250000, 0.799998);
  465.     TextDrawColor(taxistatus[playerid], 835715327);
  466.     TextDrawSetOutline(taxistatus[playerid], 1);
  467.     TextDrawSetProportional(taxistatus[playerid], 1);
  468.     new formatted[128];
  469.     format(formatted,128,"Start fare: %.2f",STARTAMOUNT);
  470.  
  471.     startfare[playerid] = TextDrawCreate(380.000000, 340.000000, formatted);
  472.  
  473.     TextDrawBackgroundColor(startfare[playerid], 255);
  474.  
  475.     TextDrawFont(startfare[playerid], 2);
  476.  
  477.     TextDrawLetterSize(startfare[playerid], 0.250000, 0.799998);
  478.  
  479.     TextDrawColor(startfare[playerid], 835715327);
  480.  
  481.     TextDrawSetOutline(startfare[playerid], 1);
  482.  
  483.     TextDrawSetProportional(startfare[playerid], 1);
  484.  
  485.     TextDrawSetString(taxistatus[playerid],"Taxi Status: Free");
  486.     Clock();
  487.  
  488.     return 1;
  489.     }
  490.  
  491.     if(OnDuty[playerid] == 1)
  492.     {
  493.     SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now Off-Duty");
  494.     OnDuty[playerid] = 0;
  495.     TextDrawDestroy(taxiblackbox[playerid]);
  496.     TextDrawDestroy(taxigreendisplay[playerid]);
  497.     TextDrawDestroy(taxitimedisplay[playerid]);
  498.     TextDrawDestroy(taxi100mfare[playerid]);
  499.     TextDrawDestroy(taxithisfare[playerid]);
  500.     TextDrawDestroy(taxilstlogo[playerid]);
  501.     TextDrawDestroy(taxistatus[playerid]);
  502.     TextDrawDestroy(startfare[playerid]);
  503.  
  504.     return 1;
  505.     }
  506.  
  507.  
  508.     return 1;
  509. }
  510. //
  511. forward Clock();
  512. public Clock()
  513. {
  514.     new hour,minute;
  515.     gettime(hour,minute);
  516.     new string[128];
  517.     if(minute < 10)
  518.     {
  519.     format(string,sizeof(string),"Time: %d : 0%d",hour,minute);
  520.     }
  521.     else
  522.     {
  523.     format(string,sizeof(string),"Time: %d : %d",hour,minute);
  524.     }
  525.     for(new i = 0; i < MAX_PLAYERS; i++)
  526.     {
  527.     if(IsPlayerConnected(i))
  528.     {
  529.     if(OnDuty[i] == 1)
  530.     {
  531.     TextDrawSetString(taxitimedisplay[i],string);
  532.     }
  533.     }
  534.     }
  535.     KillTimer(clockupdate);
  536.     clockupdate = SetTimer("Clock",60000,0);
  537. }
  538. forward IsATaxi(vehicleid);
  539. public IsATaxi(vehicleid)
  540. {
  541.     new vmodel = GetVehicleModel(vehicleid);
  542.     if(vmodel == 420 || vmodel == 438)
  543.     {
  544.         return 1;
  545.     }
  546.     return 0;
  547. }
  548. forward FareUpdate(playerid);
  549. public FareUpdate(playerid)
  550. {
  551.  
  552.    
  553.     new farestring[128];
  554.     GetPlayerPos(playerid,NewX[playerid],NewY[playerid],NewZ[playerid]);
  555.     new Float:totdistance = GetDistanceBetweenPoints(OldX[playerid],OldY[playerid],OldZ[playerid], NewX[playerid],NewY[playerid],NewZ[playerid]);
  556.     if(totdistance > 100.0)
  557.     {
  558.     TotalFare[playerid] = TotalFare[playerid]+MONEYPER100;
  559.     format(farestring,sizeof(farestring),"Total Fare: %.2f $",TotalFare[playerid]);
  560.     TextDrawSetString(taxithisfare[playerid],farestring);
  561.     GetPlayerPos(playerid,Float:OldX[playerid],Float:OldY[playerid],Float:OldZ[playerid]);
  562.     }
  563.  
  564.  
  565.     return 1;
  566.  
  567. }
  568. forward Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
  569. stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
  570. {
  571.     x1 -= x2;
  572.     y1 -= y2;
  573.     z1 -= z2;
  574.     return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
  575. }
  576. stock CheckPassengers(vehicleid)
  577. {
  578.     for(new i = 0; i < MAX_PLAYERS; i++)
  579.     {
  580.     if(IsPlayerInAnyVehicle(i))
  581.     {
  582.     if(GetPlayerVehicleID(i) == vehicleid && i != GetVehicleDriver(vehicleid))
  583.     {
  584.    
  585.     return 1;
  586.    
  587.     }
  588.     }
  589.     }
  590.     return 0;
  591. }
  592. stock GetPlayerNameEx(playerid)
  593. {
  594.     new pname[MAX_PLAYER_NAME];
  595.     GetPlayerName(playerid,pname,sizeof(pname));
  596.     return pname;
  597. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement