daily pastebin goal
63%
SHARE
TWEET

[SAMP] jTaxi - A taxi driver system [V1.2]

Jstylezzz Nov 17th, 2013 1,100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*                                                      Taxi job script by Jstylezzz
  2.                                                                                                                         Keep the credits!
  3.                                                                                                                    Version 1.2
  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. Release thread: http://bit.ly/12bRqwE
  8.                                                                                                                                
  9.                                                                                                                                                                                                                                                         */
  10.  
  11.  
  12. #include <a_samp> //Credits to the SA-MP Team
  13. #include <zcmd> //Credits to Zeex
  14. #include <colors> //Credits to Oxside
  15. #include <getvehicledriver> //Credits to Smeti
  16.  
  17. #define STARTAMOUNT 2.66 //This is the starting amount for the fare, remember, enter is as a float, ex. 1.23
  18. #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
  19. #define ScriptVersion "1.2"//Do not change, this is for my reference.
  20. #define AllowTaxiSpawn  //Comment this line if you don't want to allow the /spawntaxi command.
  21. #define DESIGN_NUMBER 2 //Change the number according to the design you want, refer to the release thread for pictures of the designs
  22.  
  23. //===NEW'S====//
  24. new Text:ScreenCorner1;
  25. new Text:ScreenCorner2;
  26. new Text:ScreenCorner3;
  27. new Text:ScreenCorner4;
  28. new Text:ClockBase;
  29. new Text:ClockScreen;
  30. new Text:BackLight;
  31. new Text:taxiblackbox[MAX_PLAYERS];
  32. new Text:taxigreendisplay[MAX_PLAYERS];
  33. new Text:taxitimedisplay[MAX_PLAYERS];
  34. new Text:taxi100mfare[MAX_PLAYERS];
  35. new Text:taxithisfare[MAX_PLAYERS];
  36. new Text:taxilstlogo[MAX_PLAYERS];
  37. new Text:taxistatus[MAX_PLAYERS];
  38. new Text:startfare[MAX_PLAYERS];
  39. new IsOnFare[MAX_PLAYERS];
  40. new OnDuty[MAX_PLAYERS];
  41. new clockupdate;
  42. new faretimer[MAX_PLAYERS];
  43. 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];
  44. new Float:TotalFare[MAX_PLAYERS];
  45. new Text:yourdriver[MAX_PLAYERS];
  46. new Text:drivername[MAX_PLAYERS];
  47. new HideID[MAX_PLAYERS];
  48. //
  49. public OnFilterScriptInit()
  50. {
  51.         print("\n--------------------------------------");
  52.         printf("        Jstylezzz's Taxi Script\n        Version %s",ScriptVersion);
  53.         print("--------------------------------------\n");
  54.         CheckDesign();
  55.         return 1;
  56. }
  57.  
  58. public OnPlayerDisconnect(playerid, reason)
  59. {
  60.     KillTimer(faretimer[playerid]);
  61.     OnDuty[playerid] = 0;
  62.     IsOnFare[playerid] = 0;
  63.         TotalFare[playerid] = 0.0;
  64.         return 1;
  65. }
  66.  
  67.  
  68.  
  69. public OnPlayerExitVehicle(playerid, vehicleid)
  70. {
  71.        
  72.     new driver = GetVehicleDriver(vehicleid);
  73.     HideID[playerid] = driver;
  74.         if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER && TotalFare[driver] > 0)
  75.         {
  76.                 new money = floatround(TotalFare[driver]/GetNumOfPassengers(driver)); //We split the cash over the passengers
  77.                 new message[128];
  78.             format(message,sizeof(message),"You have paid %d $ to the Taxi driver",money);
  79.                 GivePlayerMoney(playerid,-money);
  80.                 TotalFare[driver] = 0;
  81.                 TextDrawSetString(taxithisfare[driver],"Total Fare: N/A");
  82.                 GivePlayerMoney(driver,money);
  83.                 SendClientMessage(playerid,COLOR_LIGHTBLUE,message);
  84.                 format(message,sizeof(message),"%s has paid you %d $ for the ride.",GetPlayerNameEx(playerid),money);
  85.                 SendClientMessage(driver,COLOR_LIGHTBLUE,message);
  86.                 TotalFare[driver] = 0.00;
  87.                 IsOnFare[driver] = 0;
  88.                 KillTimer(faretimer[driver]);
  89.         }
  90.    
  91.         TextDrawSetString(taxistatus[driver],"Taxi Status: Free");
  92.  
  93.         return 1;
  94. }
  95.  
  96. public OnPlayerStateChange(playerid, newstate, oldstate)
  97. {
  98.     new vehicleid = GetPlayerVehicleID(playerid);
  99.     new driver = GetVehicleDriver(vehicleid);
  100.     new name[MAX_PLAYER_NAME];
  101.         format(name,sizeof(name),"%s",GetFirstName(driver));
  102.     if(newstate == PLAYER_STATE_DRIVER)
  103.         {
  104.  
  105.                         if(OnDuty[playerid] == 1 && IsATaxi(vehicleid) == 1)
  106.                         {
  107.  
  108.                                 TextDrawShowForPlayer(playerid, taxiblackbox[playerid]);
  109.                                 TextDrawShowForPlayer(playerid, taxigreendisplay[playerid]);
  110.                                 TextDrawShowForPlayer(playerid, taxitimedisplay[playerid]);
  111.                                 TextDrawShowForPlayer(playerid, taxi100mfare[playerid]);
  112.                                 TextDrawShowForPlayer(playerid, startfare[playerid]);
  113.                                 TextDrawShowForPlayer(playerid, taxithisfare[playerid]);
  114.                                 TextDrawShowForPlayer(playerid, taxilstlogo[playerid]);
  115.                                 TextDrawShowForPlayer(playerid, taxistatus[playerid]);
  116.                                 #if DESIGN_NUMBER == 2
  117.                     CheckDesign();
  118.                                         TextDrawShowForPlayer(playerid, drivername[playerid]);
  119.                                     TextDrawShowForPlayer(playerid, yourdriver[driver]);
  120.                                     TextDrawShowForPlayer(playerid, ClockBase);
  121.                                     TextDrawShowForPlayer(playerid, ClockScreen);
  122.                                     TextDrawShowForPlayer(playerid, BackLight);
  123.                                 TextDrawShowForPlayer(playerid, ScreenCorner1);
  124.                                     TextDrawShowForPlayer(playerid, ScreenCorner2);
  125.                                     TextDrawShowForPlayer(playerid, ScreenCorner3);
  126.                                     TextDrawShowForPlayer(playerid, ScreenCorner4);
  127.                                     TextDrawSetString(drivername[driver],name);
  128.                                 #endif
  129.                         }
  130.         }
  131.         if(newstate == PLAYER_STATE_PASSENGER)
  132.         {
  133.                 if(OnDuty[driver] == 1)
  134.                 {
  135.  
  136.                         TextDrawShowForPlayer(playerid, taxiblackbox[driver]);
  137.                         TextDrawShowForPlayer(playerid, taxigreendisplay[driver]);
  138.                         TextDrawShowForPlayer(playerid, taxitimedisplay[driver]);
  139.                         TextDrawShowForPlayer(playerid, taxi100mfare[driver]);
  140.                         TextDrawShowForPlayer(playerid, taxithisfare[driver]);
  141.                         TextDrawShowForPlayer(playerid, taxilstlogo[driver]);
  142.                     TextDrawSetString(taxistatus[driver],"Taxi Status: Occupied");
  143.                         TextDrawShowForPlayer(playerid, taxistatus[driver]);
  144.                         TextDrawShowForPlayer(playerid, startfare[driver]);
  145.                         #if DESIGN_NUMBER == 2
  146.                 CheckDesign();
  147.                             TextDrawShowForPlayer(playerid, drivername[playerid]);
  148.                             TextDrawShowForPlayer(playerid, yourdriver[driver]);
  149.                             TextDrawShowForPlayer(playerid, ClockBase);
  150.                             TextDrawShowForPlayer(playerid, ClockScreen);
  151.                             TextDrawShowForPlayer(playerid, BackLight);
  152.                             TextDrawShowForPlayer(playerid, ScreenCorner1);
  153.                             TextDrawShowForPlayer(playerid, ScreenCorner2);
  154.                             TextDrawShowForPlayer(playerid, ScreenCorner3);
  155.                             TextDrawShowForPlayer(playerid, ScreenCorner4);
  156.                             TextDrawSetString(drivername[driver],name);
  157.                         #endif
  158.  
  159.                 }
  160.         }
  161.         if(newstate == PLAYER_STATE_ONFOOT)
  162.         {
  163.             TextDrawHideForPlayer(playerid, ScreenCorner1);
  164.             TextDrawHideForPlayer(playerid, ScreenCorner2);
  165.             TextDrawHideForPlayer(playerid, ScreenCorner3);
  166.             TextDrawHideForPlayer(playerid, ScreenCorner4);
  167.             TextDrawHideForPlayer(playerid, ClockBase);
  168.             TextDrawHideForPlayer(playerid, ClockScreen);
  169.             TextDrawHideForPlayer(playerid, BackLight);
  170.             TextDrawHideForPlayer(playerid, drivername[HideID[playerid]]);
  171.             TextDrawHideForPlayer(playerid, yourdriver[HideID[playerid]]);
  172.             TextDrawHideForPlayer(playerid, taxiblackbox[HideID[playerid]]);
  173.                 TextDrawHideForPlayer(playerid, taxigreendisplay[HideID[playerid]]);
  174.                 TextDrawHideForPlayer(playerid, taxitimedisplay[HideID[playerid]]);
  175.                 TextDrawHideForPlayer(playerid, taxi100mfare[HideID[playerid]]);
  176.                 TextDrawHideForPlayer(playerid, taxithisfare[HideID[playerid]]);
  177.                 TextDrawHideForPlayer(playerid, taxilstlogo[HideID[playerid]]);
  178.                 TextDrawHideForPlayer(playerid, taxistatus[HideID[playerid]]);
  179.                 TextDrawHideForPlayer(playerid, startfare[HideID[playerid]]);
  180.             TextDrawSetString(drivername[driver],"N/A");
  181.            
  182.        
  183.             if(IsOnFare[playerid] == 1)
  184.                 {
  185.  
  186.  
  187.                         SendClientMessage(playerid,COLOR_LIGHTBLUE,"Taxi duty over - You exited the vehicle!");
  188.                         OnDuty[playerid] = 0;
  189.                         TotalFare[playerid] = 0.00;
  190.                         TextDrawSetString(taxithisfare[playerid],"N/A");
  191.                         SendClientMessage(playerid,COLOR_LIGHTBLUE,"Fare stopped");
  192.                         IsOnFare[playerid] = 0;
  193.                         KillTimer(faretimer[playerid]);
  194.                         TextDrawDestroy(taxiblackbox[playerid]);
  195.                         TextDrawDestroy(taxigreendisplay[playerid]);
  196.                         TextDrawDestroy(taxitimedisplay[playerid]);
  197.                         TextDrawDestroy(taxi100mfare[playerid]);
  198.                         TextDrawDestroy(taxithisfare[playerid]);
  199.                         TextDrawDestroy(taxilstlogo[playerid]);
  200.                         TextDrawDestroy(taxistatus[playerid]);
  201.                         TextDrawDestroy(startfare[playerid]);
  202.                         TextDrawDestroy(taxiblackbox[driver]);
  203.                         TextDrawDestroy(taxigreendisplay[driver]);
  204.                         TextDrawDestroy(taxitimedisplay[driver]);
  205.                         TextDrawDestroy(taxi100mfare[driver]);
  206.                         TextDrawDestroy(taxithisfare[driver]);
  207.                         TextDrawDestroy(taxilstlogo[driver]);
  208.                         TextDrawDestroy(taxistatus[driver]);
  209.                         TextDrawDestroy(startfare[driver]);
  210.  
  211.  
  212.  
  213.                 }
  214.         }
  215.         return 1;
  216. }
  217.  
  218. //==COMMANDS==//
  219. CMD:fare(playerid,params[])
  220. {
  221.         if(OnDuty[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"You are not on duty");
  222.         new vehicleid = GetPlayerVehicleID(playerid);
  223.         if(!IsATaxi(vehicleid)) return SendClientMessage(playerid,COLOR_RED,"You need to be in a taxi to do this!");
  224.         if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid,COLOR_RED,"You need to be the driver to do this!");
  225.         if(CheckPassengers(vehicleid) != 1) return SendClientMessage(playerid,COLOR_RED,"DO NOT ABUSE YOUR JOB! Wait for someone to get in the taxi!");
  226.         if(IsOnFare[playerid] == 0)
  227.         {
  228.        
  229.                 if(IsOnFare[playerid] == 1) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are already on a fare");
  230.                 GetPlayerPos(playerid,Float:OldX[playerid],Float:OldY[playerid],Float:OldZ[playerid]);
  231.                 faretimer[playerid] = SetTimerEx("FareUpdate", 1000, true, "i", playerid);
  232.                 IsOnFare[playerid] = 1;
  233.                 TotalFare[playerid] = STARTAMOUNT;
  234.                 new formatted[128];
  235.                 format(formatted,128,"Total Fare: %.2f $",STARTAMOUNT);
  236.                 TextDrawSetString(taxithisfare[playerid],formatted);
  237.                 SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now on a fare, take your customer to his/her desired place!");
  238.                 return 1;
  239.         }
  240.         if(IsOnFare[playerid] == 1)
  241.         {
  242.                 TotalFare[playerid] = 0.00;
  243.                 TextDrawSetString(taxithisfare[playerid],"Total Fare: N/A");
  244.                 SendClientMessage(playerid,COLOR_LIGHTBLUE,"Fare stopped");
  245.                 IsOnFare[playerid] = 0;
  246.                 KillTimer(faretimer[playerid]);
  247.                 return 1;
  248.         }
  249.         return 1;
  250.        
  251. }
  252. CMD:spawntaxi(playerid,params[])
  253. {
  254.         #if defined AllowTaxiSpawn
  255.         new Float:x,Float:y,Float:z;
  256.         GetPlayerPos(playerid,x,y,z);
  257.         CreateVehicle(420,x,y,z,0,0,0,10000);
  258.         return 1;
  259.         #else
  260.         return SendClientMessage(playerid,COLOR_RED,"This command is disabled");
  261.         #endif
  262.        
  263. }
  264. CMD:duty(playerid,params[])
  265. {
  266.        
  267.         if(IsOnFare[playerid] == 1) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are currently on a fare, you cant go off duty now!");
  268.         if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have to be on foot to do this!");
  269.         if(OnDuty[playerid] == 0)
  270.         {
  271.             new formatted[128];
  272.                 OnDuty[playerid] = 1;
  273.         CreatePlayerDraws(playerid);
  274.                 SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now on duty!");
  275.                 format(formatted,128,"Start fare: %.2f$",STARTAMOUNT);
  276.                 TextDrawSetString(startfare[playerid],formatted);
  277.                 TextDrawSetString(taxistatus[playerid],"Taxi Status: Free");
  278.                 new format100[128];
  279.                 format(format100,128,"100 Meter price: %.2f$",MONEYPER100);
  280.                 TextDrawSetString(taxi100mfare[playerid],format100);
  281.                 Clock();
  282.                 return 1;
  283.         }
  284.  
  285.         if(OnDuty[playerid] == 1)
  286.         {
  287.                 SendClientMessage(playerid,COLOR_LIGHTBLUE,"You are now Off-Duty");
  288.                 OnDuty[playerid] = 0;
  289.                 DestroyPlayerDraws(playerid);
  290.                 return 1;
  291.         }
  292.  
  293.  
  294.         return 1;
  295. }
  296. //
  297. forward Clock();
  298. public Clock()
  299. {
  300.     new hour,minute;
  301.         gettime(hour,minute);
  302.         new string[128];
  303.         if(minute < 10)
  304.         {
  305.                 format(string,sizeof(string),"%d : 0%d",hour,minute);
  306.         }
  307.         else
  308.         {
  309.                 format(string,sizeof(string),"%d : %d",hour,minute);
  310.         }
  311.         for(new i = 0; i < MAX_PLAYERS; i++)
  312.         {
  313.                 if(IsPlayerConnected(i))
  314.                 {
  315.                         if(OnDuty[i] == 1)
  316.                         {
  317.                                 TextDrawSetString(taxitimedisplay[i],string);
  318.                         }
  319.                 }
  320.         }
  321.         KillTimer(clockupdate);
  322.         clockupdate = SetTimer("Clock",60000,0);
  323. }
  324. forward IsATaxi(vehicleid);
  325. public IsATaxi(vehicleid)
  326. {
  327.         new vmodel = GetVehicleModel(vehicleid);
  328.         if(vmodel == 420 || vmodel == 438)
  329.         {
  330.                 return 1;
  331.         }
  332.         return 0;
  333. }
  334.  
  335. forward DestroyPlayerDraws(playerid);
  336. public DestroyPlayerDraws(playerid)
  337. {
  338.         TextDrawDestroy(taxiblackbox[playerid]);
  339.                 TextDrawDestroy(taxigreendisplay[playerid]);
  340.                 TextDrawDestroy(taxitimedisplay[playerid]);
  341.                 TextDrawDestroy(taxi100mfare[playerid]);
  342.                 TextDrawDestroy(taxithisfare[playerid]);
  343.                 TextDrawDestroy(taxilstlogo[playerid]);
  344.                 TextDrawDestroy(taxistatus[playerid]);
  345.                 TextDrawDestroy(startfare[playerid]);
  346.                 TextDrawDestroy(drivername[playerid]);
  347.        
  348. }
  349. forward CreatePlayerDraws(playerid);
  350. public CreatePlayerDraws(playerid)
  351. {
  352.         #if DESIGN_NUMBER == 1
  353.  
  354.                 taxiblackbox[playerid] = TextDrawCreate(497.000000, 302.000000, "              ");
  355.                 TextDrawBackgroundColor(taxiblackbox[playerid], 255);
  356.                 TextDrawFont(taxiblackbox[playerid], 1);
  357.                 TextDrawLetterSize(taxiblackbox[playerid], 0.500000, 1.000000);
  358.                 TextDrawColor(taxiblackbox[playerid], -1);
  359.                 TextDrawSetOutline(taxiblackbox[playerid], 0);
  360.                 TextDrawSetProportional(taxiblackbox[playerid], 1);
  361.                 TextDrawSetShadow(taxiblackbox[playerid], 1);
  362.                 TextDrawUseBox(taxiblackbox[playerid], 1);
  363.                 TextDrawBoxColor(taxiblackbox[playerid], 255);
  364.                 TextDrawTextSize(taxiblackbox[playerid], 140.000000, -1.000000);
  365.  
  366.                 taxigreendisplay[playerid] = TextDrawCreate(484.000000, 318.000000, "          ");
  367.                 TextDrawBackgroundColor(taxigreendisplay[playerid], 255);
  368.                 TextDrawFont(taxigreendisplay[playerid], 1);
  369.                 TextDrawLetterSize(taxigreendisplay[playerid], 0.500000, 1.000000);
  370.                 TextDrawColor(taxigreendisplay[playerid], -1);
  371.                 TextDrawSetOutline(taxigreendisplay[playerid], 0);
  372.                 TextDrawSetProportional(taxigreendisplay[playerid], 1);
  373.                 TextDrawSetShadow(taxigreendisplay[playerid], 1);
  374.                 TextDrawUseBox(taxigreendisplay[playerid], 1);
  375.                 TextDrawBoxColor(taxigreendisplay[playerid], 576786175);
  376.                 TextDrawTextSize(taxigreendisplay[playerid], 154.000000, -1.000000);
  377.  
  378.                 taxitimedisplay[playerid] = TextDrawCreate(160.000000, 340.000000, "Time:  Loading..");
  379.                 TextDrawBackgroundColor(taxitimedisplay[playerid], 255);
  380.                 TextDrawFont(taxitimedisplay[playerid], 2);
  381.                 TextDrawLetterSize(taxitimedisplay[playerid], 0.250000, 0.799999);
  382.                 TextDrawColor(taxitimedisplay[playerid], 835715327);
  383.                 TextDrawSetOutline(taxitimedisplay[playerid], 1);
  384.                 TextDrawSetProportional(taxitimedisplay[playerid], 1);
  385.        
  386.                 taxi100mfare[playerid] = TextDrawCreate(160.000000, 360.000000, format100);
  387.                 TextDrawBackgroundColor(taxi100mfare[playerid], 255);
  388.                 TextDrawFont(taxi100mfare[playerid], 2);
  389.                 TextDrawLetterSize(taxi100mfare[playerid], 0.250000, 0.799999);
  390.                 TextDrawColor(taxi100mfare[playerid], 835715327);
  391.                 TextDrawSetOutline(taxi100mfare[playerid], 1);
  392.                 TextDrawSetProportional(taxi100mfare[playerid], 1);
  393.  
  394.                 taxithisfare[playerid] = TextDrawCreate(160.000000, 380.000000, "This fare: N/A ");
  395.                 TextDrawBackgroundColor(taxithisfare[playerid], 255);
  396.                 TextDrawFont(taxithisfare[playerid], 2);
  397.                 TextDrawLetterSize(taxithisfare[playerid], 0.250000, 0.799999);
  398.                 TextDrawColor(taxithisfare[playerid], 835715327);
  399.                 TextDrawSetOutline(taxithisfare[playerid], 1);
  400.                 TextDrawSetProportional(taxithisfare[playerid], 1);
  401.  
  402.                 taxilstlogo[playerid] = TextDrawCreate(220.000000, 317.000000, "Los Santos Transport");
  403.                 TextDrawBackgroundColor(taxilstlogo[playerid], 255);
  404.                 TextDrawFont(taxilstlogo[playerid], 3);
  405.                 TextDrawLetterSize(taxilstlogo[playerid], 0.550000, 1.799998);
  406.                 TextDrawColor(taxilstlogo[playerid], 835715327);
  407.                 TextDrawSetOutline(taxilstlogo[playerid], 1);
  408.                 TextDrawSetProportional(taxilstlogo[playerid], 1);
  409.  
  410.                 taxistatus[playerid] = TextDrawCreate(320.000000, 390.000000, "Taxi Status: ");
  411.                 TextDrawBackgroundColor(taxistatus[playerid], 255);
  412.                 TextDrawFont(taxistatus[playerid], 2);
  413.                 TextDrawLetterSize(taxistatus[playerid], 0.250000, 0.799998);
  414.                 TextDrawColor(taxistatus[playerid], 835715327);
  415.                 TextDrawSetOutline(taxistatus[playerid], 1);
  416.                 TextDrawSetProportional(taxistatus[playerid], 1);
  417.                
  418.                 startfare[playerid] = TextDrawCreate(380.000000, 340.000000, "999");
  419.                 TextDrawBackgroundColor(startfare[playerid], 255);
  420.                 TextDrawFont(startfare[playerid], 2);
  421.                 TextDrawLetterSize(startfare[playerid], 0.250000, 0.799998);
  422.                 TextDrawColor(startfare[playerid], 835715327);
  423.                 TextDrawSetOutline(startfare[playerid], 1);
  424.                 TextDrawSetProportional(startfare[playerid], 1);
  425.                
  426.         #endif
  427.        
  428.         #if DESIGN_NUMBER == 2
  429.  
  430.            
  431.             ClockBase = TextDrawCreate(545.500, 274.000, "LD_POOL:ball");
  432.             TextDrawFont(ClockBase, 4);
  433.             TextDrawTextSize(ClockBase, 61.000, 50.500);
  434.             TextDrawColor(ClockBase, 1296911871);
  435.  
  436.             ClockScreen = TextDrawCreate(551.500, 292.000, "LD_DRV:tvbase");
  437.             TextDrawFont(ClockScreen, 4);
  438.             TextDrawTextSize(ClockScreen, 49.000, 14.500);
  439.             TextDrawColor(ClockScreen, 255);
  440.  
  441.             BackLight = TextDrawCreate(527.500, 323.500, "LD_NONE:thrust");
  442.             TextDrawFont(BackLight, 4);
  443.             TextDrawTextSize(BackLight, 100.000, 100.000);
  444.             TextDrawColor(BackLight, -327425);
  445.  
  446.             taxigreendisplay[playerid] = TextDrawCreate(638.000000, 323.937500, "usebox");
  447.                 TextDrawLetterSize(taxigreendisplay[playerid], 0.000000, 8.725000);
  448.                 TextDrawTextSize(taxigreendisplay[playerid], 512.000000, 0.000000);
  449.                 TextDrawAlignment(taxigreendisplay[playerid], 1);
  450.                 TextDrawColor(taxigreendisplay[playerid], 0);
  451.                 TextDrawUseBox(taxigreendisplay[playerid], true);
  452.                 TextDrawBoxColor(taxigreendisplay[playerid], 8388863);
  453.                 TextDrawSetShadow(taxigreendisplay[playerid], 0);
  454.                 TextDrawSetOutline(taxigreendisplay[playerid], 0);
  455.                 TextDrawFont(taxigreendisplay[playerid], 0);
  456.  
  457.                 taxiblackbox[playerid] = TextDrawCreate(637.000000, 323.937500, "usebox");
  458.                 TextDrawLetterSize(taxiblackbox[playerid], 0.000000, 8.773611);
  459.                 TextDrawTextSize(taxiblackbox[playerid], 512.500000, 0.000000);
  460.                 TextDrawAlignment(taxiblackbox[playerid], 1);
  461.                 TextDrawColor(taxiblackbox[playerid], -256);
  462.                 TextDrawUseBox(taxiblackbox[playerid], true);
  463.                 TextDrawBoxColor(taxiblackbox[playerid], 200);
  464.                 TextDrawSetShadow(taxiblackbox[playerid], 0);
  465.                 TextDrawSetOutline(taxiblackbox[playerid], 0);
  466.                 TextDrawBackgroundColor(taxiblackbox[playerid], -206);
  467.                 TextDrawFont(taxiblackbox[playerid], 0);
  468.  
  469.                 taxithisfare[playerid] = TextDrawCreate(524.500000, 330.750000, "Total fare: 0 $");
  470.                 TextDrawLetterSize(taxithisfare[playerid], 0.211998, 1.018123);
  471.                 TextDrawAlignment(taxithisfare[playerid], 1);
  472.                 TextDrawColor(taxithisfare[playerid], -1);
  473.                 TextDrawSetShadow(taxithisfare[playerid], 0);
  474.                 TextDrawSetOutline(taxithisfare[playerid], 1);
  475.                 TextDrawBackgroundColor(taxithisfare[playerid], 51);
  476.                 TextDrawFont(taxithisfare[playerid], 1);
  477.                 TextDrawSetProportional(taxithisfare[playerid], 1);
  478.  
  479.                 startfare[playerid] = TextDrawCreate(525.000000, 339.187500, "Startfare: 0 $");
  480.                 TextDrawLetterSize(startfare[playerid], 0.211998, 1.018123);
  481.                 TextDrawAlignment(startfare[playerid], 1);
  482.                 TextDrawColor(startfare[playerid], -1);
  483.                 TextDrawSetShadow(startfare[playerid], 0);
  484.                 TextDrawSetOutline(startfare[playerid], 1);
  485.                 TextDrawBackgroundColor(startfare[playerid], 51);
  486.                 TextDrawFont(startfare[playerid], 1);
  487.                 TextDrawSetProportional(startfare[playerid], 1);
  488.  
  489.                 taxistatus[playerid] = TextDrawCreate(525.000000, 348.500000, "Taxi Status: Unoccupied");
  490.                 TextDrawLetterSize(taxistatus[playerid], 0.211998, 1.018123);
  491.                 TextDrawAlignment(taxistatus[playerid], 1);
  492.                 TextDrawColor(taxistatus[playerid], -1);
  493.                 TextDrawSetShadow(taxistatus[playerid], 0);
  494.                 TextDrawSetOutline(taxistatus[playerid], 1);
  495.                 TextDrawBackgroundColor(taxistatus[playerid], 51);
  496.                 TextDrawFont(taxistatus[playerid], 1);
  497.                 TextDrawSetProportional(taxistatus[playerid], 1);
  498.  
  499.                 taxitimedisplay[playerid] = TextDrawCreate(562.000000, 291.375000, "99:99");
  500.                 TextDrawLetterSize(taxitimedisplay[playerid], 0.210499, 1.441874);
  501.                 TextDrawTextSize(taxitimedisplay[playerid], 598.500000, 39.375000);
  502.                 TextDrawAlignment(taxitimedisplay[playerid], 1);
  503.                 TextDrawColor(taxitimedisplay[playerid], -1);
  504.                 TextDrawSetShadow(taxitimedisplay[playerid], 0);
  505.                 TextDrawSetOutline(taxitimedisplay[playerid], 1);
  506.                 TextDrawBackgroundColor(taxitimedisplay[playerid], 51);
  507.                 TextDrawFont(taxitimedisplay[playerid], 2);
  508.                 TextDrawSetProportional(taxitimedisplay[playerid], 1);
  509.  
  510.                 taxi100mfare[playerid] = TextDrawCreate(525.000000, 357.375000, "Fare per 100M: 999$");
  511.                 TextDrawLetterSize(taxi100mfare[playerid], 0.206496, 1.004997);
  512.                 TextDrawAlignment(taxi100mfare[playerid], 1);
  513.                 TextDrawColor(taxi100mfare[playerid], -1);
  514.                 TextDrawSetShadow(taxi100mfare[playerid], 0);
  515.                 TextDrawSetOutline(taxi100mfare[playerid], 1);
  516.                 TextDrawBackgroundColor(taxi100mfare[playerid], 51);
  517.                 TextDrawFont(taxi100mfare[playerid], 1);
  518.                 TextDrawSetProportional(taxi100mfare[playerid], 1);
  519.                
  520.                 drivername[playerid] = TextDrawCreate(559.500000, 383.750000, "Firstname");
  521.                 TextDrawLetterSize(drivername[playerid], 0.282997, 1.328747);
  522.                 TextDrawAlignment(drivername[playerid], 1);
  523.                 TextDrawColor(drivername[playerid], -1);
  524.                 TextDrawSetShadow(drivername[playerid], 0);
  525.                 TextDrawSetOutline(drivername[playerid], 1);
  526.                 TextDrawBackgroundColor(drivername[playerid], 51);
  527.                 TextDrawFont(drivername[playerid], 1);
  528.                 TextDrawSetProportional(drivername[playerid], 1);
  529.                
  530.                 yourdriver[playerid] = TextDrawCreate(548.000000, 371.375000, "Your driver");
  531.                 TextDrawLetterSize(yourdriver[playerid], 0.282997, 1.328747);
  532.                 TextDrawAlignment(yourdriver[playerid], 1);
  533.                 TextDrawColor(yourdriver[playerid], -1);
  534.                 TextDrawSetShadow(yourdriver[playerid], 0);
  535.                 TextDrawSetOutline(yourdriver[playerid], 1);
  536.                 TextDrawBackgroundColor(yourdriver[playerid], 51);
  537.                 TextDrawFont(yourdriver[playerid], 1);
  538.                 TextDrawSetProportional(yourdriver[playerid], 1);
  539.                
  540.                
  541.            
  542.         #endif
  543.  
  544. }
  545. forward CheckDesign();
  546. public CheckDesign()
  547. {
  548.         #if DESIGN_NUMBER == 2
  549.         ScreenCorner1 = TextDrawCreate(637.000, 322.000, "LD_DUAL:tvcorn");
  550.             TextDrawFont(ScreenCorner1, 4);
  551.             TextDrawTextSize(ScreenCorner1, -62.000, 41.500);
  552.             TextDrawColor(ScreenCorner1, -1);
  553.  
  554.             ScreenCorner2 = TextDrawCreate(637.000, 404.500, "LD_NONE:tvcorn");
  555.             TextDrawFont(ScreenCorner2, 4);
  556.             TextDrawTextSize(ScreenCorner2, -62.000, -41.000);
  557.             TextDrawColor(ScreenCorner2, -1);
  558.  
  559.             ScreenCorner3 = TextDrawCreate(514.000, 322.000, "LD_DRV:tvcorn");
  560.             TextDrawFont(ScreenCorner3, 4);
  561.             TextDrawTextSize(ScreenCorner3, 61.000, 40.000);
  562.             TextDrawColor(ScreenCorner3, -1);
  563.  
  564.             ScreenCorner4 = TextDrawCreate(514.000, 404.500, "LD_DRV:tvcorn");
  565.             TextDrawFont(ScreenCorner4, 4);
  566.             TextDrawTextSize(ScreenCorner4, 61.000, -42.500);
  567.             TextDrawColor(ScreenCorner4, -1);
  568.         #endif
  569. }
  570. forward FareUpdate(playerid);
  571. public FareUpdate(playerid)
  572. {
  573.  
  574.        
  575.         new farestring[128];
  576.         GetPlayerPos(playerid,NewX[playerid],NewY[playerid],NewZ[playerid]);
  577.         new Float:totdistance = GetDistanceBetweenPoints(OldX[playerid],OldY[playerid],OldZ[playerid], NewX[playerid],NewY[playerid],NewZ[playerid]);
  578.     if(totdistance > 100.0)
  579.     {
  580.             TotalFare[playerid] = TotalFare[playerid]+MONEYPER100;
  581.                 format(farestring,sizeof(farestring),"Total Fare: %.2f $",TotalFare[playerid]);
  582.                 TextDrawSetString(taxithisfare[playerid],farestring);
  583.                 GetPlayerPos(playerid,Float:OldX[playerid],Float:OldY[playerid],Float:OldZ[playerid]);
  584.         }
  585.  
  586.  
  587.         return 1;
  588.  
  589. }
  590. forward Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2);
  591. stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
  592. {
  593.     x1 -= x2;
  594.     y1 -= y2;
  595.     z1 -= z2;
  596.     return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
  597. }
  598. stock CheckPassengers(vehicleid)
  599. {
  600.         for(new i = 0; i < MAX_PLAYERS; i++)
  601.         {
  602.                 if(IsPlayerInAnyVehicle(i))
  603.                 {
  604.                         if(GetPlayerVehicleID(i) == vehicleid && i != GetVehicleDriver(vehicleid))
  605.                         {
  606.  
  607.                                 return 1;
  608.  
  609.                         }
  610.                 }
  611.         }
  612.         return 0;
  613. }
  614. stock GetNumOfPassengers(driver)
  615. {
  616.         new count = 0;
  617.     for(new i = 0; i < MAX_PLAYERS; i++)
  618.         {
  619.                 if(IsPlayerInAnyVehicle(i))
  620.                 {
  621.                         if(GetPlayerVehicleID(i) == GetPlayerVehicleID(driver) && i != driver)
  622.                         {
  623.                                 count++;
  624.                         }
  625.                 }
  626.         }
  627.         return count;
  628. }
  629. stock GetFirstName(playerid)
  630. {
  631.     new ns[2][MAX_PLAYER_NAME], n[MAX_PLAYER_NAME];
  632.  
  633.     GetPlayerName(playerid,n,MAX_PLAYER_NAME);
  634.     split(n, ns, '_');
  635.     return ns[0];
  636. }
  637. stock GetPlayerNameEx(playerid)
  638. {
  639.         new pname[MAX_PLAYER_NAME];
  640.         GetPlayerName(playerid,pname,sizeof(pname));
  641.         return pname;
  642. }
  643. stock split(const strsrc[], strdest[][], delimiter)
  644. {
  645.     new i, li;
  646.     new aNum;
  647.     new len;
  648.     while(i <= strlen(strsrc))
  649.     {
  650.         if(strsrc[i] == delimiter || i == strlen(strsrc))
  651.         {
  652.             len = strmid(strdest[aNum], strsrc, li, i, 128);
  653.             strdest[aNum][len] = 0;
  654.             li = i+1;
  655.             aNum++;
  656.         }
  657.         i++;
  658.     }
  659.     return 1;
  660. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top