Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- pInfo:
- pHoursOnCareer:
- Hours online and part of
- the careers.
- pPayCheck:
- Money player has built up
- to go into their paycheck.
- pCredit:
- Credit info.
- pVars:
- career_PTime:
- Countdown to remove the
- promotion TD.
- */
- /*============================================================================*/
- forward Career_Disconnect ( playerid );
- forward Career_Connect ( playerid );
- forward Career_OneHour ( playerid );
- forward Career_OneSecond ( playerid );
- forward IsPlayerAtMayPayCheck ( playerid );
- forward Career_TDCreate ( playerid, career_string[], Float:career_extra_lines );
- forward Career_BizUpdate ( bizid );
- forward Career_PropUpdate ( propid );
- forward Career_EnterCP ( playerid );
- /*============================================================================*/
- new Text:Career_PlayerTD[MAX_PLAYERS];
- Str_gTxtStrip( const string[] )
- {
- new StringS = strlen(string);
- new NewString[128],
- sCheck;
- for( new i; i < StringS; i++ )
- {
- if( string[i] == '~' && sCheck == 0 )
- {
- sCheck = 1;
- continue;
- }
- else if( string[i] == '~' && sCheck == 1 )
- {
- sCheck = 0;
- continue;
- }
- if( sCheck == 0 )
- {
- format(NewString,sizeof(NewString),"%s%c",NewString,string[i]);
- }
- continue;
- }
- return NewString;
- }
- /*============================================================================*/
- new TaxiCars[] = { 438, 420, 426, 445, 405, 409, 479, 580, 560 }
- // Vehicle Name Cabbie, Taxi, Premier, Admiral, Sentinel, Stretch, Huntley, Stafford, Sultan - 9 Total
- // Rank |Cabbie| Taxi | Personal | Professional | Transporter |
- /*============================================================================*/
- #define MAX_TDTIME 10
- #define MAX_TDY 294.000000
- /*------------------ */
- #define JOB_PIZZACARRIER 40
- #define PIZZACARRIERMAXMISSION 3
- #define PIZZACARRIERMAXCHECK 2400
- #define PIZZACARRIERNAME "Pizza Carrier"
- #define JOB_PIZZABOY 41
- #define PIZZABOYHOURS 15
- #define PIZZABOYMAXMISSION 5
- #define PIZZABOYMAXCHECK 4320
- #define PIZZABOYNAME "PizzaBoy"
- #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."
- #define JOB_MASTERPIZZABOY 42
- #define MASTERPIZZABOYHOURS 24
- #define MASTERPIZZABOYMAXMISSION 8
- #define MASTERPIZZABOYMAXCHECK 8000
- #define MASTERPIZZABOYNAME "Master PizzaBoy"
- #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~."
- #include "careers/PizzaBoy.pwn"
- /*---------------------------------------------------------------------------- */
- // JOB_DETECTIVE 7
- #define JOB_PRIVATEINVESTIGATOR 50
- #define PRIVATEINVESTIGATORHOURS 8
- #define PRIVATEINVESTIGATORNAME "Private Investigator"
- #define PRIVATEINVESTIGATORPROMOTION "~g~Congratulations, ~n~~w~you are now a~y~ Private Investigator.~n~~w~You now have access to:~y~~n~~h~-/molecheck"
- #define JOB_HEADDETECTIVE 51
- #define HEADDETECTIVEHOURS 17
- #define HEADDETECTIVELINES 20
- #define HEADDETECTIVEPAYCHECK 10500
- #define HEADDETECTIVENAME "Head Detective"
- #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."
- #define JOB_HEADPRIVATEINVESTIGATOR 52
- #define HEADPRIVATEINVESTIGATORHOURS 24
- #define HEADPRIVATEINVESTIGATORNAME "Head Private Investigator"
- #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."
- #define JOB_SENIORDETECTIVE 53
- #define SENIORDETECTIVEHOURS 30
- #define SENIORDETECTIVELINES 20
- #define SENIORDETECTIVEPAYCHECK 20500
- #define SENIORDETECTIVENAME "Senior Detective"
- #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."
- #define JOB_SPECIALAGENT 54
- #define SPECIALAGENTHOURS 35
- #define SPECIALAGENTNAME "Special Agent"
- #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."
- #define JOB_FIELDAGENT 55
- #define FIELDAGENTHOURS 40
- #define FIELDAGENTLINES 10
- #define FIELDAGENTNAME "Field Agent"
- #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"
- #define JOB_SECRETAGENT 56
- #define SECRETAGENTHOURS 40
- #define SECRETAGENTLINES 20
- #define SECRETAGENTPAYCHECK 25500
- #define SECRETAGENTNAME "Secret Agent"
- #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."
- /*---------------------------------------------------------------------------- */
- // JOB_TAXIDRIVER 31
- #define JOB_CABBIEDRIVER 60
- #define CABBIEDRIVERCARS 1
- #define CABBIEDRIVERMAXCHECK 2600
- #define CABBIEDRIVERNAME "Cabbie Driver"
- #define JOB_TAXIDRIVER 61
- #define TAXIDRIVERCARS 2
- #define TAXIDRIVERHOURS 5
- #define TAXIDRIVERMAXCHECK 3800
- #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~"
- #define JOB_PERSONALDRIVER 62
- #define PERSONALDRIVERCARS 5
- #define PERSONALDRIVERHOURS 16
- #define PERSONALDRIVERMAXCHECK 6300
- #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~"
- #define JOB_PROFESSIONALDRIVER 63
- #define PROFESSIONALDRIVERCARS 8
- #define PROFESSIONALDRIVERHOURS 30
- #define PROFESSIONALDRIVERMAXCHECK 11800
- #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~"
- #define JOB_TRANSPORTERDRIVER 64
- #define TRANSPORTERDRIVERCARS 9
- #define TRANSPORTERDRIVERHOURS 50
- #define TRANSPORTERDRIVERMAXCHECK 18500
- #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~"
- /*============================================================================*/
- public Career_EnterCP( playerid )
- {
- if( OnPlayerEnterPizzaCP( playerid ) ) return 1;
- return 0;
- }
- public Career_PropUpdate( propid )
- {
- PizzaProp_Update( propid );
- return 1;
- }
- public Career_BizUpdate( bizid )
- {
- PizzaBiz_Update( bizid );
- return 1;
- }
- public Career_Disconnect( playerid )
- {
- return 1;
- }
- public Career_Connect( playerid )
- {
- TextDrawDestroy(Career_PlayerTD[playerid]);
- Career_PlayerTD[playerid] = Text:INVALID_TEXT_DRAW;
- return 1;
- }
- public Career_OneSecond( playerid )
- {
- if( GetPVarInt(playerid, "career_PTime") > 2 )
- {
- SetPVarInt(playerid, "career_PTime", GetPVarInt(playerid, "career_PTime")-1 );
- return 1;
- }
- else if( GetPVarInt(playerid, "career_PTime") == 1 )
- {
- TextDrawDestroy(Career_PlayerTD[playerid]);
- Career_PlayerTD[playerid] = Text:INVALID_TEXT_DRAW;
- DeletePVar(playerid,"career_PTime");
- }
- return 1;
- }
- public Career_TDCreate( playerid, career_string[], Float:career_extra_lines )
- {
- new Float:C_TDY = MAX_TDY-career_extra_lines;
- Career_PlayerTD[playerid] = TextDrawCreate(8.000000, C_TDY, career_string);
- TextDrawBackgroundColor(Career_PlayerTD[playerid], 255);
- TextDrawFont(Career_PlayerTD[playerid], 2);
- TextDrawLetterSize(Career_PlayerTD[playerid], 0.230000, 1.100000);
- TextDrawColor(Career_PlayerTD[playerid], -1);
- TextDrawSetOutline(Career_PlayerTD[playerid], 1);
- TextDrawSetProportional(Career_PlayerTD[playerid], 1);
- TextDrawShowForPlayer(playerid, Career_PlayerTD[playerid]);
- SetPVarInt(playerid, "career_PTime", MAX_TDTIME );
- return 1;
- }
- public Career_OneHour( playerid )
- {
- if( PlayerInfo[playerid][pGun5] >= 1 )
- {
- new NEW_CAREER = -1;
- switch( PlayerInfo[playerid][pGun5] )
- {
- case JOB_PIZZACARRIER: if( PlayerInfo[playerid][pHoursOnCareer] == PIZZABOYHOURS ) NEW_CAREER = JOB_PIZZABOY, Career_TDCreate( playerid, PIZZABOYPROMOTION, 0.0 );
- case JOB_PIZZABOY: if( PlayerInfo[playerid][pHoursOnCareer] == MASTERPIZZABOYHOURS ) NEW_CAREER = JOB_MASTERPIZZABOY, Career_TDCreate( playerid, MASTERPIZZABOYPROMOTION, 0.0 );
- case JOB_DETECTIVE: if( PlayerInfo[playerid][pHoursOnCareer] == PRIVATEINVESTIGATORHOURS ) NEW_CAREER = JOB_PRIVATEINVESTIGATOR, Career_TDCreate( playerid, PRIVATEINVESTIGATORPROMOTION, 0.0 );
- case JOB_PRIVATEINVESTIGATOR: if( PlayerInfo[playerid][pHoursOnCareer] == HEADDETECTIVEHOURS ) NEW_CAREER = JOB_HEADDETECTIVE, Career_TDCreate( playerid, HEADDETECTIVEPROMOTION, HEADDETECTIVELINES );
- case JOB_HEADDETECTIVE: if( PlayerInfo[playerid][pHoursOnCareer] == HEADPRIVATEINVESTIGATORHOURS ) NEW_CAREER = JOB_HEADPRIVATEINVESTIGATOR, Career_TDCreate( playerid, HEADPRIVATEINVESTIGATORPROMOTION, 0.0 );
- case JOB_HEADPRIVATEINVESTIGATOR: if( PlayerInfo[playerid][pHoursOnCareer] == SENIORDETECTIVEHOURS ) NEW_CAREER = JOB_SENIORDETECTIVE, Career_TDCreate( playerid, SENIORDETECTIVEPROMOTION, SENIORDETECTIVELINES );
- case JOB_SENIORDETECTIVE: if( PlayerInfo[playerid][pHoursOnCareer] == SPECIALAGENTHOURS ) NEW_CAREER = JOB_SPECIALAGENT, Career_TDCreate( playerid, SPECIALAGENTPROMOTION, 0.0 );
- case JOB_SPECIALAGENT: if( PlayerInfo[playerid][pHoursOnCareer] == FIELDAGENTHOURS ) NEW_CAREER = JOB_FIELDAGENT, Career_TDCreate( playerid, FIELDAGENTPROMOTION, FIELDAGENTLINES );
- case JOB_FIELDAGENT: if( PlayerInfo[playerid][pHoursOnCareer] == SECRETAGENTHOURS ) NEW_CAREER = JOB_SECRETAGENT, Career_TDCreate( playerid, SECRETAGENTPROMOTION, SECRETAGENTLINES );
- case JOB_TAXIDRIVER: if( PlayerInfo[playerid][pHoursOnCareer] == PERSONALDRIVERHOURS ) NEW_CAREER = JOB_TAXIDRIVER, Career_TDCreate( playerid, PERSONALDRIVERPROMOTION, 0.0 );
- case JOB_PERSONALDRIVER: if( PlayerInfo[playerid][pHoursOnCareer] == PROFESSIONALDRIVERHOURS ) NEW_CAREER = JOB_PROFESSIONALDRIVER, Career_TDCreate( playerid, PROFESSIONALDRIVERPROMOTION, 0.0 );
- case JOB_PROFESSIONALDRIVER: if( PlayerInfo[playerid][pHoursOnCareer] == TRANSPORTERDRIVERHOURS ) NEW_CAREER = JOB_TRANSPORTERDRIVER, Career_TDCreate( playerid, TRANSPORTERDRIVERPROMOTION, 0.0 );
- default: return 1;
- }
- if( NEW_CAREER > 0 )
- {
- PlayerInfo[playerid][pGun5] = NEW_CAREER;
- PlayerInfo[playerid][pHoursOnCareer] = 0;
- }
- else
- {
- PlayerInfo[playerid][pHoursOnCareer]++;
- }
- }
- return 1;
- }
- public IsPlayerAtMayPayCheck( playerid )
- {
- new career_return;
- switch( PlayerInfo[playerid][pGun5] )
- {
- case JOB_PIZZACARRIER: if( PlayerInfo[playerid][pPayCheck] > PIZZACARRIERMAXCHECK ) career_return = 1;
- case JOB_PIZZABOY: if( PlayerInfo[playerid][pPayCheck] > PIZZABOYMAXCHECK ) career_return = 1;
- case JOB_MASTERPIZZABOY: if( PlayerInfo[playerid][pPayCheck] > MASTERPIZZABOYMAXCHECK ) career_return = 1;
- case JOB_CABBIEDRIVER: if( PlayerInfo[playerid][pPayCheck] > CABBIEDRIVERCHECK ) career_return = 1;
- case JOB_TAXIRIVER: if( PlayerInfo[playerid][pPayCheck] > TAXIDRIVERCHECK ) career_return = 1;
- case JOB_PERSONALDRIVER: if( PlayerInfo[playerid][pPayCheck] > PERSONALRIVERCHECK ) career_return = 1;
- case JOB_PROFESSIONALDRIVER:if( PlayerInfo[playerid][pPayCheck] > PROFESSIONALDRIVERCHECK) career_return = 1;
- case JOB_TRANSPORTERRIVER: if( PlayerInfo[playerid][pPayCheck] > TRANSPORTERDRIVERCHECK ) career_return = 1;
- }
- return career_return;
- }
- /* Updated taxi command working with the ranks. Please replace the old taxi command with this one */
- public ycmd_taxi(playerid, cmdtext[])
- {
- if (cmdtext[0] == 1) cmdtext[0] = 0;
- new gJob = PlayerInfo[playerid][pGun5];
- if(!gPlayerLogged[playerid])
- {
- SendClientMessage(playerid, COLOR_RED, "You are not logged in.");
- return 1;
- }
- if(gKilledWithGun[playerid] > 0 || gKnocked[playerid] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "You are unconcious.");
- return 1;
- }
- if(gTied[playerid] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "You are tied up.");
- return 1;
- }
- new tmp[256], idx;
- tmp = strtok(cmdtext, idx);
- if( !strlen(tmp) )
- {
- SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi [param]");
- SendClientMessage(playerid, COLOR_WHITE, "CHECK |");
- if( gJob == JOB_CABBIEDRIVER || gJob == JOB_TAXIDRIVER || gJob == JOB_PERSONALDRIVER || gJob == JOB_PROFESSIONALDRIVER || gJob == JOB_TRANSPORTERDRIVER)
- {
- SendClientMessage(playerid, COLOR_WHITE, "FARE | STOP | ACCEPT");
- SendClientMessage(playerid, COLOR_WHITE, "DUTY | START |");
- SendClientMessage(playerid, COLOR_WHITE, "HINT: Stop ends the fare counter. Meaning you won't be paid.");
- }
- return 1;
- }
- if( strcmp(tmp, "check", true, strlen(tmp)) == 0 )
- {
- tmp = strtok(cmdtext, idx);
- if( !strlen(tmp) )
- {
- SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi check playerid");
- SendClientMessage(playerid, COLOR_WHITE, "HINT: This is how much the person is charging");
- SendClientMessage(playerid, COLOR_WHITE, "the yard.");
- return 1;
- }
- new taxiplayerid = strval(tmp);
- new gJob2 = PlayerInfo[taxiplayerid][pGun5];
- if( taxiplayerid == playerid )
- {
- SendClientMessage(playerid, COLOR_RED, "Yourself?");
- return 1;
- }
- if( !IsPlayerConnected(taxiplayerid) )
- {
- SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
- return 1;
- }
- if( gJob2 == JOB_CABBIEDRIVER || gJob2 == JOB_TAXIDRIVER || gJob2 == JOB_PERSONALDRIVER || gJob2 == JOB_PROFESSIONALDRIVER || gJob2 == JOB_TRANSPORTERDRIVER)
- {
- SendClientMessage(playerid, COLOR_RED, "He's not a taxi driver!");
- return 1;
- }
- new taxistring[100];
- format(taxistring,100,"This taxi driver is charging %d by the yard!",TaxiCharging[taxiplayerid]);
- SendClientMessage(playerid, COLOR_YELLOW, taxistring );
- return 1;
- }
- if( strcmp(tmp, "acceptfare", true, strlen(tmp)) == 0 )
- {
- if(!GetPVarInt(playerid, "CustomerFareRequested"))
- {
- SendClientMessage(playerid, COLOR_RED, "You have no fare to accept.");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if( !strlen(tmp) )
- {
- SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi acceptfare playerid");
- SendClientMessage(playerid, COLOR_WHITE, "HINT: Accept the fare offered by the taxi-driver.");
- return 1;
- }
- new taxiplayerid = strval(tmp);
- if( taxiplayerid == playerid )
- {
- SendClientMessage(playerid, COLOR_RED, "Yourself?");
- return 1;
- }
- if(GetPVarInt(taxiplayerid, "DriverRequestedFare") != playerid+1)
- {
- SendClientMessage(playerid, COLOR_RED, "This person didn't offer you a taxi fare.");
- return 1;
- }
- new taxistring[100], isin;
- if( gPlayerLogged[playerid] )
- {
- if( IsPlayerInVehicle(playerid, GetPlayerVehicleID(taxiplayerid)) )
- {
- if( GetPlayerState( playerid ) == PLAYER_STATE_PASSENGER )
- {
- TotalFare[playerid] = 0;
- BeingFaredBy[playerid] = taxiplayerid;
- IsInTaxi[playerid] = GetPlayerVehicleID(taxiplayerid);
- TaxiFareComingIn[taxiplayerid] = 1;
- format(taxistring,100,"You are being charged by the yard [$%d]",TaxiCharging[taxiplayerid]);
- SendClientMessage(playerid,COLOR_WHITE,taxistring);
- DeletePVar(taxiplayerid, "DriverRequestedFare");
- DeletePVar(playerid, "CustomerFareRequested");
- isin++;
- }
- }
- }
- if( isin )
- {
- format(taxistring,100,"You are charging $%d by the yard!",TaxiCharging[taxiplayerid]);
- SendClientMessage(taxiplayerid,COLOR_WHITE,taxistring);
- }
- else SendClientMessage(playerid, COLOR_RED, "You need to be in the taxi.");
- return 1;
- }
- if( gJob == JOB_CABBIEDRIVER || gJob == JOB_TAXIDRIVER || gJob == JOB_PERSONALDRIVER || gJob == JOB_PROFESSIONALDRIVER || gJob == JOB_TRANSPORTERDRIVER)
- {
- SendClientMessage(playerid, COLOR_RED, "You need to have the taxi job first.");
- return 1;
- }
- new vehicleid=GetPlayerVehicleID(playerid);
- /* Below is the Rank Check to fit which car. */
- switch(PlayerInfo[playerid][pGun5])
- {
- new error = SendClientMessage(playerid, COLOR_RED, "You need to be in a car which your Rank allows you to use as a Taxi");
- case JOB_CABBIEDRIVER:
- {
- for(new i = 0; i < CABBIEDRIVERCARS; i++)
- {
- if(GetVehicleModel(vehicleid) != TaxiCars[i]) return error;
- }
- }
- case JOB_TAXIDRIVER:
- {
- for(new i = 0; i < TAXIDRIVERCARS; i++)
- {
- if(GetVehicleModel(vehicleid) != TaxiCars[i]) return error;
- }
- }
- case JOB_PERSONALDRIVER:
- {
- for(new i = 0; i < PERSONALDRIVERCARS; i++)
- {
- if(GetVehicleModel(vehicleid) != TaxiCars[i]) return error;
- }
- }
- case JOB_PROFESSIONALDRIVER:
- {
- for(new i = 0; i < PROFESSIONALDRIVERCARS; i++)
- {
- if(GetVehicleModel(vehicleid) != TaxiCars[i]) return error;
- }
- }
- case JOB_TRANSPORTERDRIVER:
- {
- for(new i = 0; i < TRANSPORTERDRIVERCARS; i++)
- {
- if(GetVehicleModel(vehicleid) != TaxiCars[i]) return error;
- }
- }
- }
- /* End of Check */
- if( strcmp(tmp, "duty", true, strlen(tmp)) == 0 )
- {
- if( IsOnTaxiDuty[playerid] != 1 )
- {
- SetPlayerColor(playerid,COLOR_BUSF);
- IsOnTaxiDuty[playerid] = 1;
- SendClientMessage(playerid, COLOR_YELLOW, "You are now on duty!");
- return 1;
- }
- else
- {
- SetPlayerColor(playerid,TEAM_GREEN_COLOR);
- IsOnTaxiDuty[playerid] = 0;
- SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty!");
- return 1;
- }
- }
- if( strcmp(tmp, "start", true, strlen(tmp)) == 0 )
- {
- if( IsOnTaxiDuty[playerid] != 1 )
- {
- SendClientMessage(playerid, COLOR_RED, "You are not on duty! (/taxi duty)");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if( !strlen(tmp) )
- {
- SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi start playerid");
- SendClientMessage(playerid, COLOR_WHITE, "HINT: Offer the customer a taxi fare.");
- return 1;
- }
- new taxiplayerid = strval(tmp);
- if( taxiplayerid == playerid )
- {
- SendClientMessage(playerid, COLOR_RED, "Yourself?");
- return 1;
- }
- new taxistring[200]
- if(IsPlayerInVehicle(playerid, GetPlayerVehicleID(taxiplayerid)))
- {
- if(GetPlayerState(taxiplayerid) == PLAYER_STATE_PASSENGER)
- {
- new pname[32];
- pname = GetICName(playerid);
- GetPlayerName(taxiplayername, pname, sizeof(pname));
- SetPVarInt(playerid, "DriverRequestedFare", taxiplayerid+1); // I put +1 so that a bug won't come up with a taxidriver that has the playerid "0"
- SetPVarInt(taxiplayerid, "CustomerFareRequested", 1);
- format(taxistring, sizeof(taxistring), "You have sent a Fare Request to %s(%d).", pname, taxiplayerid);
- SendClientMessage(playerid, COLOR_GREEN, taxistring);
- GetPlayerName(playerid, pname, sizeof(pname));
- 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);
- SendClientMessage(playerid, COLOR_WHITE, taxistring);
- }
- }
- else SendClientMessage(playerid, COLOR_RED, "There is no one in your taxi.");
- return 1;
- }
- if( strcmp(tmp, "stop", true, strlen(tmp)) == 0 )
- {
- if( IsOnTaxiDuty[playerid] != 1 )
- {
- SendClientMessage(playerid, COLOR_RED, "You are not on duty! (/taxi duty)");
- return 1;
- }
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if( gPlayerLogged[i] )
- {
- if( BeingFaredBy[i] == playerid )
- {
- BeingFaredBy[i] = -1;
- TotalFare[i] = 0;
- SendClientMessage(i, COLOR_YELLOW, "Stopped the counter.");
- }
- }
- }
- SendClientMessage(playerid, COLOR_YELLOW, "You stopped the fare counter.");
- TaxiFareComingIn[playerid] = 0;
- return 1;
- }
- if( strcmp(tmp, "accept", true, strlen(tmp)) == 0 )
- {
- if( IsOnTaxiDuty[playerid] != 1 )
- {
- SendClientMessage(playerid, COLOR_RED, "You are not on duty! (/taxi duty)");
- return 1;
- }
- tmp = strtok(cmdtext, idx);
- if( !strlen(tmp) )
- {
- SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi accept playerid");
- SendClientMessage(playerid, COLOR_WHITE, "HINT: Accept the ones who just called.");
- return 1;
- }
- new taxiplayerid = strval(tmp);
- if( taxiplayerid == playerid )
- {
- SendClientMessage(playerid, COLOR_RED, "Yourself?");
- return 1;
- }
- if( !IsPlayerConnected(taxiplayerid) )
- {
- SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
- return 1;
- }
- if( !gNeedTaxi[taxiplayerid] )
- {
- SendClientMessage(playerid, COLOR_RED, "They've either been answered already or don't need one.");
- return 1;
- }
- new taxistring[128], sendername[32];
- sendername = GetICName(playerid);
- format(taxistring,128,"%s is responding to your location! He/She charges %d.",sendername,TaxiCharging[playerid]);
- SendClientMessage(taxiplayerid, COLOR_YELLOW, taxistring );
- gNeedTaxi[taxiplayerid] = 0;
- SendClientMessage(playerid, COLOR_WHITE, "You were the first to respond!");
- SendClientMessage(playerid, COLOR_YELLOW, "|______________Taxi Call______________|");
- format(taxistring,sizeof(taxistring),"Caller:(ID: %d)%s Ph:%d)",taxiplayerid, GetICName(taxiplayerid),GetPVarInt(taxiplayerid, "LSPCTPhone") );
- SendClientMessage(playerid, COLOR_YELLOW, taxistring);
- new pvarString[128];
- GetPVarString(taxiplayerid,"LSPCTloc",pvarString,sizeof(pvarString));
- format(taxistring,sizeof(taxistring),"Current Location: %s",pvarString);
- SendClientMessage(playerid, COLOR_YELLOW, taxistring);
- GetPVarString(taxiplayerid,"LSPCTto",pvarString,sizeof(pvarString));
- format(taxistring,sizeof(taxistring),"Destination: %s",pvarString);
- SendClientMessage(playerid, COLOR_YELLOW, taxistring);
- return 1;
- }
- if( strcmp(tmp, "fare", true, strlen(tmp)) == 0 )
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if( BeingFaredBy[i] == playerid )
- {
- if( gPlayerLogged[i] )
- {
- BeingFaredBy[i] = -1;
- TotalFare[i] = 0;
- SendClientMessage(i, COLOR_YELLOW, "Stopped the counter.");
- SendClientMessage(i, COLOR_YELLOW, "The fare price has changed.");
- }
- }
- }
- TaxiFareComingIn[playerid] = 0;
- tmp = strtok(cmdtext, idx);
- if( !strlen(tmp) )
- {
- SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /taxi fare price");
- SendClientMessage(playerid, COLOR_WHITE, "HINT: How much you want to charge the person by the mile.");
- return 1;
- }
- if( 0 > strval(tmp) || strval(tmp) > 25 )
- {
- SendClientMessage(playerid, COLOR_RED, "Either too low or too high! 0-25 only.");
- return 1;
- }
- TaxiCharging[playerid] = strval(tmp);
- new taxistring[100];
- format(taxistring,100,"You're charging %d by the yard!",TaxiCharging[playerid]);
- SendClientMessage(playerid, COLOR_YELLOW, taxistring );
- SendClientMessage(playerid, COLOR_WHITE, "Hint: /taxi start to get it back going." );
- return 1;
- }
- return 1;
- }
- /* The secs loop that uses the speed to add the fare - Please replace the old fare system with this one. */
- public Dev_OneSecond() <dev:Giacomand>
- {
- new Cost[MAX_PLAYERS];
- new PassengerID;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(gPlayerLogged[i])
- {
- if(TaxiFareComingIn[i] == 1) // I think this is the variable used to see if a Taxi has a customer.
- {
- new Float:X, Float:Y, Float:Z, Float:Sp;
- GetVehicleVelocity(GetPlayerVehicleID(i), X, Y, Z);
- Sp = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 100.0);
- SetPVarInt(i, "Speed" floatround(floatdiv(Sp, 0.75), floatround_floor)); // Outputs speed in MPH
- if(10 < GetPVarInt(i, "Speed") && GetPVarInt(i, "Speed") < 200)
- {
- Cost[i] = GetPVarInt(i, "Speed");
- Cost[i] /= 15; // 15 was the perfect price in testing.
- Cost[i] *= TaxiCharging[i];
- for(new j=0; j<MAX_PLAYERS; j++)
- {
- if( BeingFaredBy[j] == i)
- {
- if( gPlayerLogged[j] )
- {
- TotalFare[j] += Cost[i];
- }
- }
- }
- }
- }
- }
- }
- return 1;
- }
- public Dev_OnPlayerExitVehicle(playerid, vehicleid) <dev:Giacomand>
- {
- if(IsInTaxi[playerid] == vehicleid)
- {
- new gString[100];
- SetUpPlayerMoney(playerid, GetPlayerRealMoney(playerid)-TotalFare[playerid]);
- format(gString, sizeof(gString), "You have the taxi's fare of $%d. Have a nice day.", TotalFare[playerid]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement