Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------------------------------------------------------------
- //
- // Bus Mission Filter Script v1.0
- //
- // By SamSung
- //------------------------------------------------------------------------------
- #include <a_samp>
- #define BAJADA_DE_BANDERA 200
- #define PRECIO_FICHA 100
- new OnBusAsPassenger[MAX_PLAYERS];
- new CostoDelViaje[MAX_PLAYERS];
- new contador[MAX_PLAYERS];
- new playerInMiniMission[MAX_PLAYERS];
- new avisado[MAX_PLAYERS];
- new caidadefichaTimer;
- new cantidadPasajeros;
- forward terminarMission(playerid);
- forward caidadeficha();
- public OnFilterScriptInit()
- {
- print("\n Bus Filter Script v1.0 Loading...\n**********************\n (SamSung)\n");
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- playerInMiniMission[i]=-1;
- avisado[i]=-1;
- OnBusAsPassenger[i]=-1;
- }
- caidadefichaTimer=-1;
- cantidadPasajeros=0;
- SetTimer("caidadeficha",30000,1);
- print("Bus Filter Script fully Loaded\n**********************************\n\n");
- }
- public OnFilterScriptExit()
- {
- print("\n**********************\n*Bus Script UnLoaded*\n**********************\n");
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public terminarMission(playerid)
- {
- new msg[255];
- format(msg,sizeof(msg),"~r~Bus ~w~MiniMission cancelled~n~ You carried ~r~%d~w~ pasengers.",contador[playerid]);
- GameTextForPlayer(playerid,msg,3000,4);
- playerInMiniMission[playerid]=-1;
- avisado[playerid]=-1;
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- format(msg,sizeof(msg),"[***] %s Is NOT a Bus driver anymore",name);
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- if (playerid!=i)
- {
- SendClientMessage(i,0xFFFF00AA," ");
- SendClientMessage(i,0xFFFF00AA,msg);
- }
- }
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- if (OnBusAsPassenger[i]==playerid)
- {
- new Bussta = playerid;
- OnBusAsPassenger[i]=-1;
- new viaje=CostoDelViaje[i];
- format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~Bus~w~ ride.",name,viaje);
- GameTextForPlayer(i,msg,3000,4);
- format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~Bus~w~ ride.",viaje);
- GameTextForPlayer(Bussta,msg,3000,4);
- GivePlayerMoney(i,-viaje);
- GivePlayerMoney(Bussta,viaje);
- cantidadPasajeros--;
- if (cantidadPasajeros==0)
- {
- KillTimer(caidadefichaTimer);
- }
- }
- }
- contador[playerid]=0;
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public caidadeficha()
- {
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- CostoDelViaje[i]=CostoDelViaje[i]+PRECIO_FICHA;
- }
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- new msg[255];
- if (newstate==PLAYER_STATE_DRIVER)
- {
- if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 431)
- {
- if (avisado[playerid]==-1)
- {
- GameTextForPlayer(playerid,"~w~Press ~b~Button 2~n~~w~to start the ~n~~r~Bus~w~ Minimission.",3000,5);
- }
- else
- {
- KillTimer(avisado[playerid]);
- avisado[playerid]=-1;
- }
- }
- }
- if (newstate==PLAYER_STATE_ONFOOT)
- {
- if ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
- {
- GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~Bus",3000,4);
- avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
- }
- if (OnBusAsPassenger[playerid]!=-1)
- {
- new Bussta = OnBusAsPassenger[playerid];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(Bussta,name,MAX_PLAYER_NAME);
- OnBusAsPassenger[playerid]=-1;
- new viaje = CostoDelViaje[playerid];
- format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~Bus~w~ ride.",name,viaje);
- GameTextForPlayer(playerid,msg,3000,4);
- format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~Bus~w~ ride.",viaje);
- GameTextForPlayer(Bussta,msg,3000,4);
- GivePlayerMoney(playerid,-viaje);
- GivePlayerMoney(Bussta,viaje);
- cantidadPasajeros--;
- if (cantidadPasajeros==0)
- {
- KillTimer(caidadefichaTimer);
- }
- }
- }
- if (newstate==PLAYER_STATE_PASSENGER)
- {
- if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 431)
- {
- new i=0;
- while (i<MAX_PLAYERS)
- {
- if ((playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
- {
- if (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(i,name,MAX_PLAYER_NAME);
- contador[i]++;
- format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~Bus~w~",name);
- GameTextForPlayer(playerid,msg,3000,4);
- format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
- GameTextForPlayer(playerid,msg,3000,4);
- OnBusAsPassenger[playerid]=i;
- CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
- if (cantidadPasajeros==0)
- {
- caidadefichaTimer=SetTimer("caidadeficha",30000,1);
- }
- cantidadPasajeros++;
- i=MAX_PLAYERS;
- }
- }
- i++;
- }
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- MissionIni(playerid)
- {
- playerInMiniMission[playerid]=1;
- GameTextForPlayer(playerid,"~r~Bus ~w~MiniMision ~w~Started!",3000,4);
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- new msg[255];
- format(msg,sizeof(msg),"[***] %s is now a Bus driver",name);
- for (new i=0;i<MAX_PLAYERS;i++)
- {
- if (playerid!=i)
- {
- SendClientMessage(i,0xFFFF00AA," ");
- SendClientMessage(i,0xFFFF00AA,msg);
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if ((newkeys==KEY_SUBMISSION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
- {
- if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 431)
- {
- if (playerInMiniMission[playerid]<0)
- {
- MissionIni(playerid);
- }
- else
- {
- terminarMission(playerid);
- }
- }
- }
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDisconnect(playerid)
- {
- if (playerInMiniMission[playerid]>0)
- {
- terminarMission(playerid);
- }
- OnBusAsPassenger[playerid]=-1;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment