Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 25.73 KB | None | 0 0
  1. /*
  2.     pInfo:
  3.         pHoursOnCareer:
  4.             Hours online and part of
  5.             the careers.
  6.         pPayCheck:
  7.             Money player has built up
  8.             to go into their paycheck.
  9.         pCredit:
  10.             Credit info.
  11.     pVars:
  12.         career_PTime:
  13.             Countdown to remove the
  14.             promotion TD.
  15. */
  16. /*============================================================================*/
  17. forward Career_Disconnect       ( playerid );
  18. forward Career_Connect          ( playerid );
  19. forward Career_OneHour          ( playerid );
  20. forward Career_OneSecond        ( playerid );
  21. forward IsPlayerAtMayPayCheck   ( playerid );
  22. forward Career_TDCreate         ( playerid, career_string[], Float:career_extra_lines );
  23. forward Career_BizUpdate        ( bizid  );
  24. forward Career_PropUpdate       ( propid );
  25. forward Career_EnterCP          ( playerid );
  26. /*============================================================================*/
  27. new Text:Career_PlayerTD[MAX_PLAYERS];
  28. Str_gTxtStrip( const string[] )
  29. {
  30.     new StringS = strlen(string);
  31.     new NewString[128],
  32.         sCheck;
  33.     for( new i; i < StringS; i++ )
  34.     {
  35.         if( string[i] == '~' && sCheck == 0 )
  36.         {
  37.             sCheck = 1;
  38.             continue;
  39.         }
  40.         else if( string[i] == '~' && sCheck == 1 )
  41.         {
  42.             sCheck = 0;
  43.             continue;
  44.         }
  45.         if( sCheck == 0 )
  46.         {
  47.             format(NewString,sizeof(NewString),"%s%c",NewString,string[i]);
  48.         }
  49.         continue;
  50.     }
  51.     return NewString;
  52. }
  53. /*============================================================================*/
  54. new TaxiCars[] = {  438,    420,  426,     445,     405,      409,  479,     580,      560 }
  55. //  Vehicle Name    Cabbie, Taxi, Premier, Admiral, Sentinel, Stretch, Huntley, Stafford, Sultan - 9 Total
  56. //  Rank           |Cabbie| Taxi |          Personal         |      Professional    | Transporter  |
  57. /*============================================================================*/
  58.  
  59. #define MAX_TDTIME  10
  60. #define MAX_TDY     294.000000
  61. /*------------------ */
  62. #define JOB_PIZZACARRIER        40
  63.     #define PIZZACARRIERMAXMISSION          3
  64.     #define PIZZACARRIERMAXCHECK            2400
  65.     #define PIZZACARRIERNAME                "Pizza Carrier"
  66. #define JOB_PIZZABOY            41
  67.     #define PIZZABOYHOURS                   15
  68.     #define PIZZABOYMAXMISSION              5
  69.     #define PIZZABOYMAXCHECK                4320
  70.     #define PIZZABOYNAME                    "PizzaBoy"
  71.     #define PIZZABOYPROMOTION               "~g~Congratulations, ~n~~w~you are now a~y~ PizzaBoy.~n~~w~Your new max paycheck is ~g~$2,000~n~~w~The maximum amount of missions you can take are ~r~5."
  72. #define JOB_MASTERPIZZABOY      42
  73.     #define MASTERPIZZABOYHOURS             24
  74.     #define MASTERPIZZABOYMAXMISSION        8
  75.     #define MASTERPIZZABOYMAXCHECK          8000
  76.     #define MASTERPIZZABOYNAME              "Master PizzaBoy"
  77.     #define MASTERPIZZABOYPROMOTION         "~g~Congratulations, ~n~~w~you are now a~y~ Master PizzaBoy.~n~~w~Your new max paycheck is ~g~$8,000~n~~w~The maximum amount of missions you can take are ~r~8~w~."
  78. #include "careers/PizzaBoy.pwn"
  79. /*---------------------------------------------------------------------------- */
  80. // JOB_DETECTIVE                    7
  81. #define JOB_PRIVATEINVESTIGATOR     50
  82.     #define PRIVATEINVESTIGATORHOURS            8
  83.     #define PRIVATEINVESTIGATORNAME             "Private Investigator"
  84.     #define PRIVATEINVESTIGATORPROMOTION        "~g~Congratulations, ~n~~w~you are now a~y~ Private Investigator.~n~~w~You now have access to:~y~~n~~h~-/molecheck"
  85. #define JOB_HEADDETECTIVE           51
  86.     #define HEADDETECTIVEHOURS                  17
  87.     #define HEADDETECTIVELINES                  20
  88.     #define HEADDETECTIVEPAYCHECK               10500
  89.     #define HEADDETECTIVENAME                   "Head Detective"
  90.     #define HEADDETECTIVEPROMOTION              "~g~Congratulations, ~n~~w~you are now a~y~ Head Detective.~n~~w~You now have access to:~y~~n~~h~-More(3) Moles~n~-More(5) Trackers~n~            ~w~You have received ~g~$10,500~w~ for your efforts in the agency."
  91. #define JOB_HEADPRIVATEINVESTIGATOR 52
  92.     #define HEADPRIVATEINVESTIGATORHOURS        24
  93.     #define HEADPRIVATEINVESTIGATORNAME         "Head Private Investigator"
  94.     #define HEADPRIVATEINVESTIGATORPROMOTION    "~g~Congratulations, ~n~~w~you are now a~y~ Head Private Investigator.~n~~w~You now have access to:~y~~n~~h~-/sellequip."
  95. #define JOB_SENIORDETECTIVE         53
  96.     #define SENIORDETECTIVEHOURS                30
  97.     #define SENIORDETECTIVELINES                20
  98.     #define SENIORDETECTIVEPAYCHECK             20500
  99.     #define SENIORDETECTIVENAME                 "Senior Detective"
  100.     #define SENIORDETECTIVEPROMOTION            "~g~Congratulations, ~n~~w~you are now a~y~ Senior Detective.~n~~w~You now have access to:~y~~n~~h~-More(10) Moles~n~-More(8) Trackers~n~            ~w~You have received ~g~$20,500~w~ for your efforts in the agency."
  101. #define JOB_SPECIALAGENT            54
  102.     #define SPECIALAGENTHOURS                   35
  103.     #define SPECIALAGENTNAME                    "Special Agent"
  104.     #define SPECIALAGENTPROMOTION               "~g~Congratulations, ~n~~w~you are now a~y~ Special Agent.~n~~w~You now have access to:~y~~n~~h~-Placing moles in vehicles/properties/businesses."
  105. #define JOB_FIELDAGENT              55
  106.     #define FIELDAGENTHOURS                     40
  107.     #define FIELDAGENTLINES                     10
  108.     #define FIELDAGENTNAME                      "Field Agent"
  109.     #define FIELDAGENTPROMOTION                 "~g~Congratulations, ~n~~w~you are now a~y~ Field Agent.~n~~w~You now have access to:~y~~n~~h~-RC Vehicles.~n~-Universal Moles"
  110. #define JOB_SECRETAGENT             56
  111.     #define SECRETAGENTHOURS                    40
  112.     #define SECRETAGENTLINES                    20
  113.     #define SECRETAGENTPAYCHECK                 25500
  114.     #define SECRETAGENTNAME                     "Secret Agent"
  115.     #define SECRETAGENTPROMOTION                "~g~Congratulations, ~n~~w~you are now a~y~ Field Agent.~n~~w~You now have access to:~y~~n~~h~-RC Vehicles.~n~-Universal Moles~n~            ~w~You have received ~g~$25,500~w~ for your efforts in the agency."
  116. /*---------------------------------------------------------------------------- */
  117. // JOB_TAXIDRIVER                       31
  118.  
  119. #define JOB_CABBIEDRIVER                60
  120.     #define CABBIEDRIVERCARS            1
  121.     #define CABBIEDRIVERMAXCHECK        2600
  122.     #define CABBIEDRIVERNAME            "Cabbie Driver"
  123. #define JOB_TAXIDRIVER                  61
  124.     #define TAXIDRIVERCARS              2
  125.     #define TAXIDRIVERHOURS             5
  126.     #define TAXIDRIVERMAXCHECK          3800
  127.     #define TAXIDRIVERPROMOTION         "~g~Congratulations, ~n~~w~you are now a~y~ Taxi Driver.~n~~w~You now have access to the:~y~~n~~h~-Taxi.~n~            ~w~Your new max paycheck is ~g~$3,800.~n~~w~"
  128. #define JOB_PERSONALDRIVER              62
  129.     #define PERSONALDRIVERCARS          5
  130.     #define PERSONALDRIVERHOURS         16
  131.     #define PERSONALDRIVERMAXCHECK      6300
  132.     #define PERSONALDRIVERPROMOTION     "~g~Congratulations, ~n~~w~you are now a~y~ Personal Driver.~n~~w~You now have access to the:~y~~n~~h~-Premier, Admiral & Sentinel~n~            ~w~Your new max paycheck is ~g~$6,300.~n~~w~"
  133. #define JOB_PROFESSIONALDRIVER          63
  134.     #define PROFESSIONALDRIVERCARS      8
  135.     #define PROFESSIONALDRIVERHOURS     30
  136.     #define PROFESSIONALDRIVERMAXCHECK  11800
  137.     #define PROFESSIONALDRIVERPROMOTION "~g~Congratulations, ~n~~w~you are now a~y~ Professional Driver.~n~~w~You now have access to the:~y~~n~~h~-Stretch, Huntley & Stafford~n~            ~w~Your new max paycheck is ~g~$1,1800.~n~~w~"
  138. #define JOB_TRANSPORTERDRIVER           64
  139.     #define TRANSPORTERDRIVERCARS       9
  140.     #define TRANSPORTERDRIVERHOURS      50
  141.     #define TRANSPORTERDRIVERMAXCHECK   18500
  142.     #define TRANSPORTERDRIVERPROMOTION  "~g~Congratulations, ~n~~w~you are now a~y~ Transporter Driver.~n~~w~You now have access to the:~y~~n~~h~-Sultan~n~            ~w~Your new max paycheck is ~g~$1,8500.~n~~w~"
  143.  
  144. /*============================================================================*/   
  145.  
  146.  
  147. public Career_EnterCP( playerid )
  148. {
  149.     if( OnPlayerEnterPizzaCP( playerid ) ) return 1;
  150.     return 0;
  151. }
  152.  
  153. public Career_PropUpdate( propid )
  154. {
  155.     PizzaProp_Update( propid );
  156.     return 1;
  157. }
  158.  
  159. public Career_BizUpdate( bizid )
  160. {
  161.     PizzaBiz_Update( bizid  );
  162.     return 1;
  163. }
  164.  
  165. public Career_Disconnect( playerid )
  166. {
  167.     return 1;
  168. }
  169.  
  170. public Career_Connect( playerid )
  171. {
  172.     TextDrawDestroy(Career_PlayerTD[playerid]);
  173.     Career_PlayerTD[playerid] = Text:INVALID_TEXT_DRAW;
  174.     return 1;
  175. }
  176.  
  177. public Career_OneSecond( playerid )
  178. {
  179.     if( GetPVarInt(playerid, "career_PTime") > 2 )
  180.     {
  181.         SetPVarInt(playerid, "career_PTime", GetPVarInt(playerid, "career_PTime")-1 );
  182.         return 1;
  183.     }
  184.     else if( GetPVarInt(playerid, "career_PTime") == 1 )
  185.     {
  186.         TextDrawDestroy(Career_PlayerTD[playerid]);
  187.         Career_PlayerTD[playerid] = Text:INVALID_TEXT_DRAW;
  188.         DeletePVar(playerid,"career_PTime");
  189.     }
  190.     return 1;
  191. }
  192.  
  193. public Career_TDCreate( playerid, career_string[], Float:career_extra_lines )
  194. {
  195.     new Float:C_TDY = MAX_TDY-career_extra_lines;
  196.     Career_PlayerTD[playerid] = TextDrawCreate(8.000000, C_TDY, career_string);
  197.     TextDrawBackgroundColor(Career_PlayerTD[playerid], 255);
  198.     TextDrawFont(Career_PlayerTD[playerid], 2);
  199.     TextDrawLetterSize(Career_PlayerTD[playerid], 0.230000, 1.100000);
  200.     TextDrawColor(Career_PlayerTD[playerid], -1);
  201.     TextDrawSetOutline(Career_PlayerTD[playerid], 1);
  202.     TextDrawSetProportional(Career_PlayerTD[playerid], 1);
  203.    
  204.     TextDrawShowForPlayer(playerid, Career_PlayerTD[playerid]);
  205.    
  206.     SetPVarInt(playerid, "career_PTime", MAX_TDTIME );
  207.     return 1;
  208. }
  209.  
  210. public Career_OneHour( playerid )
  211. {
  212.     if( PlayerInfo[playerid][pGun5] >= 1 )
  213.     {
  214.         new NEW_CAREER = -1;
  215.         switch( PlayerInfo[playerid][pGun5] )
  216.         {
  217.             case JOB_PIZZACARRIER:  if( PlayerInfo[playerid][pHoursOnCareer] == PIZZABOYHOURS                               )       NEW_CAREER  =   JOB_PIZZABOY,           Career_TDCreate( playerid, PIZZABOYPROMOTION, 0.0 );
  218.             case JOB_PIZZABOY:      if( PlayerInfo[playerid][pHoursOnCareer] == MASTERPIZZABOYHOURS                         )       NEW_CAREER  =   JOB_MASTERPIZZABOY,     Career_TDCreate( playerid, MASTERPIZZABOYPROMOTION, 0.0 );
  219.  
  220.             case JOB_DETECTIVE:                 if( PlayerInfo[playerid][pHoursOnCareer] == PRIVATEINVESTIGATORHOURS        )   NEW_CAREER  =   JOB_PRIVATEINVESTIGATOR,        Career_TDCreate( playerid, PRIVATEINVESTIGATORPROMOTION, 0.0 );
  221.             case JOB_PRIVATEINVESTIGATOR:       if( PlayerInfo[playerid][pHoursOnCareer] == HEADDETECTIVEHOURS              )   NEW_CAREER  =   JOB_HEADDETECTIVE,              Career_TDCreate( playerid, HEADDETECTIVEPROMOTION, HEADDETECTIVELINES );
  222.             case JOB_HEADDETECTIVE:             if( PlayerInfo[playerid][pHoursOnCareer] == HEADPRIVATEINVESTIGATORHOURS    )   NEW_CAREER  =   JOB_HEADPRIVATEINVESTIGATOR,    Career_TDCreate( playerid, HEADPRIVATEINVESTIGATORPROMOTION, 0.0 );
  223.             case JOB_HEADPRIVATEINVESTIGATOR:   if( PlayerInfo[playerid][pHoursOnCareer] == SENIORDETECTIVEHOURS            )   NEW_CAREER  =   JOB_SENIORDETECTIVE,            Career_TDCreate( playerid, SENIORDETECTIVEPROMOTION, SENIORDETECTIVELINES );
  224.             case JOB_SENIORDETECTIVE:           if( PlayerInfo[playerid][pHoursOnCareer] == SPECIALAGENTHOURS               )   NEW_CAREER  =   JOB_SPECIALAGENT,               Career_TDCreate( playerid, SPECIALAGENTPROMOTION, 0.0 );
  225.             case JOB_SPECIALAGENT:              if( PlayerInfo[playerid][pHoursOnCareer] == FIELDAGENTHOURS                 )   NEW_CAREER  =   JOB_FIELDAGENT,                 Career_TDCreate( playerid, FIELDAGENTPROMOTION, FIELDAGENTLINES );
  226.             case JOB_FIELDAGENT:                if( PlayerInfo[playerid][pHoursOnCareer] == SECRETAGENTHOURS                )   NEW_CAREER  =   JOB_SECRETAGENT,                Career_TDCreate( playerid, SECRETAGENTPROMOTION, SECRETAGENTLINES );
  227.            
  228.             case JOB_TAXIDRIVER:                if( PlayerInfo[playerid][pHoursOnCareer] == PERSONALDRIVERHOURS             )   NEW_CAREER  =   JOB_TAXIDRIVER,                 Career_TDCreate( playerid, PERSONALDRIVERPROMOTION, 0.0 );
  229.             case JOB_PERSONALDRIVER:            if( PlayerInfo[playerid][pHoursOnCareer] == PROFESSIONALDRIVERHOURS         )   NEW_CAREER  =   JOB_PROFESSIONALDRIVER,         Career_TDCreate( playerid, PROFESSIONALDRIVERPROMOTION, 0.0 );
  230.             case JOB_PROFESSIONALDRIVER:        if( PlayerInfo[playerid][pHoursOnCareer] == TRANSPORTERDRIVERHOURS          )   NEW_CAREER  =   JOB_TRANSPORTERDRIVER,          Career_TDCreate( playerid, TRANSPORTERDRIVERPROMOTION, 0.0 );
  231.             default: return 1;
  232.         }
  233.         if( NEW_CAREER > 0 )
  234.         {
  235.             PlayerInfo[playerid][pGun5] = NEW_CAREER;
  236.             PlayerInfo[playerid][pHoursOnCareer] = 0;
  237.         }
  238.         else
  239.         {
  240.             PlayerInfo[playerid][pHoursOnCareer]++;
  241.         }
  242.     }
  243.     return 1;
  244. }
  245.  
  246. public IsPlayerAtMayPayCheck( playerid )
  247. {
  248.     new career_return;
  249.     switch( PlayerInfo[playerid][pGun5] )
  250.     {
  251.         case JOB_PIZZACARRIER:      if( PlayerInfo[playerid][pPayCheck] > PIZZACARRIERMAXCHECK   )      career_return = 1;
  252.         case JOB_PIZZABOY:          if( PlayerInfo[playerid][pPayCheck] > PIZZABOYMAXCHECK       )      career_return = 1;
  253.         case JOB_MASTERPIZZABOY:    if( PlayerInfo[playerid][pPayCheck] > MASTERPIZZABOYMAXCHECK )      career_return = 1;
  254.        
  255.         case JOB_CABBIEDRIVER:      if( PlayerInfo[playerid][pPayCheck] > CABBIEDRIVERCHECK      )      career_return = 1;
  256.         case JOB_TAXIRIVER:         if( PlayerInfo[playerid][pPayCheck] > TAXIDRIVERCHECK        )      career_return = 1;
  257.         case JOB_PERSONALDRIVER:    if( PlayerInfo[playerid][pPayCheck] > PERSONALRIVERCHECK     )      career_return = 1;
  258.         case JOB_PROFESSIONALDRIVER:if( PlayerInfo[playerid][pPayCheck] > PROFESSIONALDRIVERCHECK)      career_return = 1;
  259.         case JOB_TRANSPORTERRIVER:  if( PlayerInfo[playerid][pPayCheck] > TRANSPORTERDRIVERCHECK )      career_return = 1;
  260.        
  261.     }
  262.     return career_return;
  263. }
  264.  
  265. /* Updated taxi command working with the ranks. Please replace the old taxi command with this one */
  266.  
  267. public ycmd_taxi(playerid, cmdtext[])
  268. {
  269.     if (cmdtext[0] == 1) cmdtext[0] = 0;
  270.     new gJob = PlayerInfo[playerid][pGun5];
  271.     if(!gPlayerLogged[playerid])
  272.     {
  273.         SendClientMessage(playerid, COLOR_RED, "You are not logged in.");
  274.         return 1;
  275.     }
  276.     if(gKilledWithGun[playerid] > 0 || gKnocked[playerid] == 1)
  277.     {
  278.         SendClientMessage(playerid, COLOR_RED, "You are unconcious.");
  279.         return 1;
  280.     }
  281.     if(gTied[playerid] == 1)
  282.     {
  283.         SendClientMessage(playerid, COLOR_RED, "You are tied up.");
  284.         return 1;
  285.     }
  286.     new tmp[256], idx;
  287.     tmp = strtok(cmdtext, idx);
  288.     if( !strlen(tmp) )
  289.     {
  290.         SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi [param]");
  291.         SendClientMessage(playerid, COLOR_WHITE, "CHECK |");
  292.         if( gJob == JOB_CABBIEDRIVER || gJob == JOB_TAXIDRIVER || gJob == JOB_PERSONALDRIVER || gJob == JOB_PROFESSIONALDRIVER || gJob == JOB_TRANSPORTERDRIVER)
  293.         {
  294.             SendClientMessage(playerid, COLOR_WHITE, "FARE | STOP  | ACCEPT");
  295.             SendClientMessage(playerid, COLOR_WHITE, "DUTY | START |");
  296.             SendClientMessage(playerid, COLOR_WHITE, "HINT: Stop ends the fare counter. Meaning you won't be paid.");
  297.         }
  298.         return 1;
  299.     }
  300.     if( strcmp(tmp, "check", true, strlen(tmp)) == 0 )
  301.     {
  302.         tmp = strtok(cmdtext, idx);
  303.         if( !strlen(tmp) )
  304.         {
  305.             SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi check playerid");
  306.             SendClientMessage(playerid, COLOR_WHITE, "HINT: This is how much the person is charging");
  307.             SendClientMessage(playerid, COLOR_WHITE, "the yard.");
  308.             return 1;
  309.         }
  310.         new taxiplayerid = strval(tmp);
  311.         new gJob2 = PlayerInfo[taxiplayerid][pGun5];
  312.         if( taxiplayerid == playerid )
  313.         {
  314.             SendClientMessage(playerid, COLOR_RED, "Yourself?");
  315.             return 1;
  316.         }
  317.         if( !IsPlayerConnected(taxiplayerid) )
  318.         {
  319.             SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
  320.             return 1;
  321.         }
  322.         if( gJob2 == JOB_CABBIEDRIVER || gJob2 == JOB_TAXIDRIVER || gJob2 == JOB_PERSONALDRIVER || gJob2 == JOB_PROFESSIONALDRIVER || gJob2 == JOB_TRANSPORTERDRIVER)
  323.         {
  324.             SendClientMessage(playerid, COLOR_RED, "He's not a taxi driver!");
  325.             return 1;
  326.         }
  327.         new taxistring[100];
  328.         format(taxistring,100,"This taxi driver is charging %d by the yard!",TaxiCharging[taxiplayerid]);
  329.         SendClientMessage(playerid, COLOR_YELLOW, taxistring );
  330.         return 1;
  331.     }
  332.     if( strcmp(tmp, "acceptfare", true, strlen(tmp)) == 0 )
  333.     {
  334.         if(!GetPVarInt(playerid, "CustomerFareRequested"))
  335.         {
  336.             SendClientMessage(playerid, COLOR_RED, "You have no fare to accept.");
  337.             return 1;
  338.         }
  339.         tmp = strtok(cmdtext, idx);
  340.         if( !strlen(tmp) )
  341.         {
  342.             SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi acceptfare playerid");
  343.             SendClientMessage(playerid, COLOR_WHITE, "HINT: Accept the fare offered by the taxi-driver.");
  344.             return 1;
  345.         }
  346.         new taxiplayerid = strval(tmp);
  347.         if( taxiplayerid == playerid )
  348.         {
  349.             SendClientMessage(playerid, COLOR_RED, "Yourself?");
  350.             return 1;
  351.         }
  352.         if(GetPVarInt(taxiplayerid, "DriverRequestedFare") != playerid+1)
  353.         {
  354.             SendClientMessage(playerid, COLOR_RED, "This person didn't offer you a taxi fare.");
  355.             return 1;
  356.         }  
  357.         new taxistring[100], isin;
  358.         if( gPlayerLogged[playerid] )
  359.         {
  360.             if( IsPlayerInVehicle(playerid, GetPlayerVehicleID(taxiplayerid)) )
  361.             {
  362.                 if( GetPlayerState( playerid ) == PLAYER_STATE_PASSENGER )
  363.                 {
  364.                     TotalFare[playerid] = 0;
  365.                     BeingFaredBy[playerid] = taxiplayerid;
  366.                     IsInTaxi[playerid] = GetPlayerVehicleID(taxiplayerid);
  367.                     TaxiFareComingIn[taxiplayerid] = 1;
  368.                     format(taxistring,100,"You are being charged by the yard [$%d]",TaxiCharging[taxiplayerid]);
  369.                     SendClientMessage(playerid,COLOR_WHITE,taxistring);
  370.                     DeletePVar(taxiplayerid, "DriverRequestedFare");
  371.                     DeletePVar(playerid, "CustomerFareRequested");
  372.                     isin++;
  373.                 }
  374.             }
  375.         }
  376.         if( isin )
  377.         {
  378.             format(taxistring,100,"You are charging $%d by the yard!",TaxiCharging[taxiplayerid]);
  379.             SendClientMessage(taxiplayerid,COLOR_WHITE,taxistring);
  380.         }
  381.         else SendClientMessage(playerid, COLOR_RED, "You need to be in the taxi.");
  382.         return 1;
  383.     }
  384.     if( gJob == JOB_CABBIEDRIVER || gJob == JOB_TAXIDRIVER || gJob == JOB_PERSONALDRIVER || gJob == JOB_PROFESSIONALDRIVER || gJob == JOB_TRANSPORTERDRIVER)
  385.     {
  386.         SendClientMessage(playerid, COLOR_RED, "You need to have the taxi job first.");
  387.         return 1;
  388.     }
  389.     new vehicleid=GetPlayerVehicleID(playerid);
  390.    
  391.     /* Below is the Rank Check to fit which car. */
  392.    
  393.     switch(PlayerInfo[playerid][pGun5])
  394.     {
  395.         new error = SendClientMessage(playerid, COLOR_RED, "You need to be in a car which your Rank allows you to use as a Taxi");
  396.         case JOB_CABBIEDRIVER:
  397.         {
  398.             for(new i = 0; i < CABBIEDRIVERCARS; i++)
  399.             {          
  400.                 if(GetVehicleModel(vehicleid) != TaxiCars[i])   return error;
  401.             }  
  402.         }  
  403.         case JOB_TAXIDRIVER:
  404.         {
  405.             for(new i = 0; i < TAXIDRIVERCARS; i++)
  406.             {          
  407.                 if(GetVehicleModel(vehicleid) != TaxiCars[i])   return error;
  408.             }  
  409.         }
  410.         case JOB_PERSONALDRIVER:
  411.         {
  412.             for(new i = 0; i < PERSONALDRIVERCARS; i++)
  413.             {          
  414.                 if(GetVehicleModel(vehicleid) != TaxiCars[i])   return error;
  415.             }  
  416.         }
  417.         case JOB_PROFESSIONALDRIVER:
  418.         {
  419.             for(new i = 0; i < PROFESSIONALDRIVERCARS; i++)
  420.             {          
  421.                 if(GetVehicleModel(vehicleid) != TaxiCars[i])   return error;
  422.             }  
  423.         }
  424.         case JOB_TRANSPORTERDRIVER:
  425.         {
  426.             for(new i = 0; i < TRANSPORTERDRIVERCARS; i++)
  427.             {          
  428.                 if(GetVehicleModel(vehicleid) != TaxiCars[i])   return error;
  429.             }  
  430.         }
  431.     }  
  432.         /* End of Check */
  433.            
  434.     if( strcmp(tmp, "duty", true, strlen(tmp)) == 0 )
  435.     {
  436.         if( IsOnTaxiDuty[playerid] != 1 )
  437.         {
  438.             SetPlayerColor(playerid,COLOR_BUSF);
  439.             IsOnTaxiDuty[playerid] = 1;
  440.             SendClientMessage(playerid, COLOR_YELLOW, "You are now on duty!");
  441.             return 1;
  442.         }
  443.         else
  444.         {
  445.             SetPlayerColor(playerid,TEAM_GREEN_COLOR);
  446.             IsOnTaxiDuty[playerid] = 0;
  447.             SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty!");
  448.             return 1;
  449.         }
  450.     }  
  451.     if( strcmp(tmp, "start", true, strlen(tmp)) == 0 )
  452.     {
  453.         if( IsOnTaxiDuty[playerid] != 1 )
  454.         {
  455.             SendClientMessage(playerid, COLOR_RED, "You are not on duty! (/taxi duty)");
  456.             return 1;
  457.         }
  458.         tmp = strtok(cmdtext, idx);
  459.         if( !strlen(tmp) )
  460.         {
  461.             SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi start playerid");
  462.             SendClientMessage(playerid, COLOR_WHITE, "HINT: Offer the customer a taxi fare.");
  463.             return 1;
  464.         }
  465.         new taxiplayerid = strval(tmp);
  466.         if( taxiplayerid == playerid )
  467.         {
  468.             SendClientMessage(playerid, COLOR_RED, "Yourself?");
  469.             return 1;
  470.         }
  471.         new taxistring[200]
  472.         if(IsPlayerInVehicle(playerid, GetPlayerVehicleID(taxiplayerid)))
  473.         {
  474.             if(GetPlayerState(taxiplayerid) == PLAYER_STATE_PASSENGER)
  475.             {
  476.                 new pname[32];
  477.                 pname = GetICName(playerid);
  478.                 GetPlayerName(taxiplayername, pname, sizeof(pname));
  479.                 SetPVarInt(playerid, "DriverRequestedFare", taxiplayerid+1); // I put +1 so that a bug won't come up with a taxidriver that has the playerid "0"
  480.                 SetPVarInt(taxiplayerid, "CustomerFareRequested", 1);
  481.                 format(taxistring, sizeof(taxistring), "You have sent a Fare Request to %s(%d).", pname, taxiplayerid);
  482.                 SendClientMessage(playerid, COLOR_GREEN, taxistring);
  483.                 GetPlayerName(playerid, pname, sizeof(pname));
  484.                 format(taxistring, sizeof(taxistring), "%s(%d) has sent you a fare request. He/she is charging %d by the yard. /taxi acceptfare %d to accept it.", pname, playerid, TaxiCharging[playerid], playerid);
  485.                 SendClientMessage(playerid, COLOR_WHITE, taxistring);
  486.             }
  487.         }  
  488.         else SendClientMessage(playerid, COLOR_RED, "There is no one in your taxi.");
  489.         return 1;
  490.     }
  491.     if( strcmp(tmp, "stop", true, strlen(tmp)) == 0 )
  492.     {
  493.         if( IsOnTaxiDuty[playerid] != 1 )
  494.         {
  495.             SendClientMessage(playerid, COLOR_RED, "You are not on duty! (/taxi duty)");
  496.             return 1;
  497.         }
  498.         for(new i=0; i<MAX_PLAYERS; i++)
  499.         {
  500.             if( gPlayerLogged[i] )
  501.             {
  502.                 if( BeingFaredBy[i] == playerid )
  503.                 {
  504.                     BeingFaredBy[i] = -1;
  505.                     TotalFare[i] = 0;
  506.                     SendClientMessage(i, COLOR_YELLOW, "Stopped the counter.");
  507.                 }
  508.             }
  509.         }
  510.         SendClientMessage(playerid, COLOR_YELLOW, "You stopped the fare counter.");
  511.         TaxiFareComingIn[playerid] = 0;
  512.         return 1;
  513.     }
  514.     if( strcmp(tmp, "accept", true, strlen(tmp)) == 0 )
  515.     {
  516.         if( IsOnTaxiDuty[playerid] != 1 )
  517.         {
  518.             SendClientMessage(playerid, COLOR_RED, "You are not on duty! (/taxi duty)");
  519.             return 1;
  520.         }
  521.         tmp = strtok(cmdtext, idx);
  522.         if( !strlen(tmp) )
  523.         {
  524.             SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi accept playerid");
  525.             SendClientMessage(playerid, COLOR_WHITE, "HINT: Accept the ones who just called.");
  526.             return 1;
  527.         }
  528.         new taxiplayerid = strval(tmp);
  529.         if( taxiplayerid == playerid )
  530.         {
  531.             SendClientMessage(playerid, COLOR_RED, "Yourself?");
  532.             return 1;
  533.         }
  534.         if( !IsPlayerConnected(taxiplayerid) )
  535.         {
  536.             SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
  537.             return 1;
  538.         }
  539.         if( !gNeedTaxi[taxiplayerid] )
  540.         {
  541.             SendClientMessage(playerid, COLOR_RED, "They've either been answered already or don't need one.");
  542.             return 1;
  543.         }
  544.         new taxistring[128], sendername[32];
  545.         sendername = GetICName(playerid);
  546.         format(taxistring,128,"%s is responding to your location! He/She charges %d.",sendername,TaxiCharging[playerid]);
  547.         SendClientMessage(taxiplayerid, COLOR_YELLOW, taxistring );
  548.         gNeedTaxi[taxiplayerid] = 0;
  549.         SendClientMessage(playerid, COLOR_WHITE, "You were the first to respond!");
  550.         SendClientMessage(playerid, COLOR_YELLOW, "|______________Taxi Call______________|");
  551.         format(taxistring,sizeof(taxistring),"Caller:(ID: %d)%s Ph:%d)",taxiplayerid, GetICName(taxiplayerid),GetPVarInt(taxiplayerid, "LSPCTPhone") );
  552.         SendClientMessage(playerid, COLOR_YELLOW, taxistring);
  553.         new pvarString[128];
  554.         GetPVarString(taxiplayerid,"LSPCTloc",pvarString,sizeof(pvarString));
  555.         format(taxistring,sizeof(taxistring),"Current Location: %s",pvarString);
  556.         SendClientMessage(playerid, COLOR_YELLOW, taxistring);
  557.         GetPVarString(taxiplayerid,"LSPCTto",pvarString,sizeof(pvarString));
  558.         format(taxistring,sizeof(taxistring),"Destination: %s",pvarString);
  559.         SendClientMessage(playerid, COLOR_YELLOW, taxistring);
  560.         return 1;
  561.     }
  562.     if( strcmp(tmp, "fare", true, strlen(tmp)) == 0 )
  563.     {
  564.         for(new i=0; i<MAX_PLAYERS; i++)
  565.         {
  566.             if( BeingFaredBy[i] == playerid )
  567.             {
  568.                 if( gPlayerLogged[i] )
  569.                 {
  570.                     BeingFaredBy[i] = -1;
  571.                     TotalFare[i] = 0;
  572.                     SendClientMessage(i, COLOR_YELLOW, "Stopped the counter.");
  573.                     SendClientMessage(i, COLOR_YELLOW, "The fare price has changed.");
  574.                 }
  575.             }
  576.         }
  577.         TaxiFareComingIn[playerid] = 0;
  578.         tmp = strtok(cmdtext, idx);
  579.         if( !strlen(tmp) )
  580.         {
  581.             SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi fare price");
  582.             SendClientMessage(playerid, COLOR_WHITE, "HINT: How much you want to charge the person by the mile.");
  583.             return 1;
  584.         }
  585.         if( 0 > strval(tmp) || strval(tmp) > 25 )
  586.         {
  587.             SendClientMessage(playerid, COLOR_RED, "Either too low or too high! 0-25 only.");
  588.             return 1;
  589.         }
  590.         TaxiCharging[playerid] = strval(tmp);
  591.         new taxistring[100];
  592.         format(taxistring,100,"You're charging %d by the yard!",TaxiCharging[playerid]);
  593.         SendClientMessage(playerid, COLOR_YELLOW, taxistring );
  594.         SendClientMessage(playerid, COLOR_WHITE, "Hint: /taxi start to get it back going." );
  595.         return 1;
  596.     }
  597.     return 1;
  598. }
  599.  
  600. /* The secs loop that uses the speed to add the fare - Please replace the old fare system with this one. */
  601.  
  602. public Dev_OneSecond() <dev:Giacomand>
  603. {
  604.     new Cost[MAX_PLAYERS];
  605.     new PassengerID;
  606.     for(new i = 0; i < MAX_PLAYERS; i++)
  607.     {
  608.         if(gPlayerLogged[i])
  609.         {
  610.             if(TaxiFareComingIn[i] == 1) // I think this is the variable used to see if a Taxi has a customer.
  611.             {
  612.                 new Float:X, Float:Y, Float:Z, Float:Sp;
  613.                 GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
  614.                 Sp = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 100.0);
  615.                 SetPVarInt(i, "Speed" floatround(floatdiv(Sp, 0.75), floatround_floor)); // Outputs speed in MPH
  616.                 if(10 < GetPVarInt(i, "Speed") && GetPVarInt(i, "Speed") < 200)
  617.                 {
  618.                     Cost[i] = GetPVarInt(i, "Speed");
  619.                     Cost[i] /= 15; // 15 was the perfect price in testing.
  620.                     Cost[i] *= TaxiCharging[i];
  621.                     for(new j=0; j<MAX_PLAYERS; j++)
  622.                     {
  623.                         if( BeingFaredBy[j] == i)
  624.                         {
  625.                             if( gPlayerLogged[j] )
  626.                             {
  627.                                 TotalFare[j] += Cost[i];
  628.                             }  
  629.                         }
  630.                     }
  631.                 }
  632.             }
  633.         }
  634.     }  
  635.     return 1;
  636. }
  637.  
  638. public Dev_OnPlayerExitVehicle(playerid, vehicleid) <dev:Giacomand>
  639. {
  640.     if(IsInTaxi[playerid] == vehicleid)
  641.     {
  642.         new gString[100];
  643.         SetUpPlayerMoney(playerid, GetPlayerRealMoney(playerid)-TotalFare[playerid]);
  644.         format(gString, sizeof(gString), "You have the taxi's fare of $%d. Have a nice day.", TotalFare[playerid]);
  645.     }  
  646.     return 1;
  647. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement