Advertisement
Guest User

zeruel_angel

a guest
Sep 10th, 2007
3,831
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.34 KB | None | 0 0
  1. /*
  2. //------------------------------------------------------------------------------
  3. //
  4. //   TAXI miniMission Filter Script v1.0
  5. //   Designed for SA-MP v0.2.1
  6. //
  7. //   Created by zeruel_angel
  8. //
  9. //------------------------------------------------------------------------------
  10.  
  11. In order to make this Filter Script to work, you need to:
  12.  
  13. 1) Copy the content of "FILES" folder  into your FilterScritp folder
  14. 2) Add this filtescript into your server by opening "server.cfg" and adding "TAXI"
  15.    at the end of "filterscripts" line. It should look like this:
  16. "filterscripts adminspec actions TAXI"
  17. 3) Give me credits about this.
  18. //------------------------------------------------------------------------------
  19.  
  20. TO CHANGE TAXI FEE, YOU HAVE TO EDIT LINE 12 & 13
  21. #define BAJADA_DE_BANDERA 200
  22. #define PRECIO_FICHA 100
  23. 200 is the initial fee
  24. and 100 is the fee every 30 seconds
  25.  
  26. //------------------------------------------------------------------------------
  27. You can:
  28.  
  29. 1) Use this filterscript on your server
  30. 2) Copy, modified, reverse enginier, use part, and play with the source code
  31. 3) Redistribute it
  32.  
  33. //------------------------------------------------------------------------------
  34. You CAN'T
  35.  
  36. 1) Claim you are the owner
  37. 2) Ask money for it
  38. 3) Pay for it
  39. 4) Erase me from the credits
  40.  
  41. //------------------------------------------------------------------------------
  42.  
  43. PM me if you have any question "FORUM.SA-MP.COM" USER "zeruel_angel"
  44. */
  45. //------------------------------------------------------------------------------
  46. //
  47. //   TAXI miniMission Filter Script v1.0
  48. //   Designed for SA-MP v0.2.1
  49. //
  50. //   Created by zeruel_angel
  51. //
  52. //------------------------------------------------------------------------------
  53.  
  54. #include <a_samp>
  55.  
  56. #define BAJADA_DE_BANDERA 200
  57. #define PRECIO_FICHA 100
  58.  
  59. new OnTaxiAsPassenger[MAX_PLAYERS];
  60. new CostoDelViaje[MAX_PLAYERS];
  61. new contador[MAX_PLAYERS];
  62. new playerInMiniMission[MAX_PLAYERS];
  63. new avisado[MAX_PLAYERS];
  64. new caidadefichaTimer;
  65. new cantidadPasajeros;
  66.  
  67. forward terminarMission(playerid);
  68. forward caidadeficha();
  69.  
  70. public OnFilterScriptInit()
  71. {
  72.     print("\n TAXI Filter Script v1.0 Loading...\n**********************\n      (Zeruel_Angel)\n");
  73.     for (new i=0;i<MAX_PLAYERS;i++)
  74.         {
  75.         playerInMiniMission[i]=-1;
  76.         avisado[i]=-1;
  77.         OnTaxiAsPassenger[i]=-1;
  78.         }
  79.     caidadefichaTimer=-1;
  80.     cantidadPasajeros=0;
  81.     SetTimer("caidadeficha",30000,1);
  82.     print("TAXI Filter Script fully Loaded\n**********************************\n\n");
  83. }
  84.  
  85. public OnFilterScriptExit()
  86.     {
  87.     print("\n**********************\n*TAXI Script UnLoaded*\n**********************\n");
  88.     return 1;
  89.     }
  90. //------------------------------------------------------------------------------------------------------
  91. public terminarMission(playerid)
  92.     {
  93.     new msg[255];
  94.     format(msg,sizeof(msg),"~r~TAXI ~w~MiniMission cancelled~n~ You carried ~r~%d~w~ pasengers.",contador[playerid]);
  95.     GameTextForPlayer(playerid,msg,3000,4);
  96.     playerInMiniMission[playerid]=-1;
  97.     avisado[playerid]=-1;
  98.     new name[MAX_PLAYER_NAME];
  99.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  100.     format(msg,sizeof(msg),"***ATENTION: %s Is NOT a TAXI DRIVER anymore***",name);
  101.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  102.     for (new i=0;i<MAX_PLAYERS;i++)
  103.         {
  104.         if  (playerid!=i)
  105.             {
  106.             SendClientMessage(i,0xFFFF00AA," ");
  107.             SendClientMessage(i,0xFFFF00AA,msg);
  108.             }
  109.         }
  110.     for (new i=0;i<MAX_PLAYERS;i++)
  111.         {
  112.         if  (OnTaxiAsPassenger[i]==playerid)
  113.             {
  114.             new taxista = playerid;
  115.             OnTaxiAsPassenger[i]=-1;
  116.             new viaje=CostoDelViaje[i];
  117.             format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
  118.             GameTextForPlayer(i,msg,3000,4);
  119.             format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
  120.             GameTextForPlayer(taxista,msg,3000,4);
  121.             GivePlayerMoney(i,-viaje);
  122.             GivePlayerMoney(taxista,viaje);
  123.             cantidadPasajeros--;
  124.             if  (cantidadPasajeros==0)
  125.                 {
  126.                 KillTimer(caidadefichaTimer);
  127.                 }
  128.             }
  129.         }
  130.     contador[playerid]=0;
  131.     return 1;
  132.     }
  133. //------------------------------------------------------------------------------------------------------
  134. public caidadeficha()
  135.     {
  136.     for (new i=0;i<MAX_PLAYERS;i++)
  137.         {
  138.         CostoDelViaje[i]=CostoDelViaje[i]+PRECIO_FICHA;
  139.         }
  140.     }
  141. //------------------------------------------------------------------------------------------------------
  142. public OnPlayerStateChange(playerid, newstate, oldstate)
  143.     {
  144.     new msg[255];
  145.     if  (newstate==PLAYER_STATE_DRIVER)
  146.         {
  147.         if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
  148.             {
  149.             if  (avisado[playerid]==-1)
  150.                 {
  151.                 GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start the ~n~~r~TAXI~w~ Minimissions.",3000,5);
  152.                 }
  153.             else
  154.                 {
  155.                 KillTimer(avisado[playerid]);
  156.                 avisado[playerid]=-1;
  157.                 }
  158.             }
  159.         }
  160.     if  (newstate==PLAYER_STATE_ONFOOT)
  161.         {
  162.         if  ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
  163.             {
  164.             GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~TAXI",3000,4);
  165.             avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
  166.             }
  167.         if  (OnTaxiAsPassenger[playerid]!=-1)
  168.             {
  169.             new taxista = OnTaxiAsPassenger[playerid];
  170.             new name[MAX_PLAYER_NAME];
  171.             GetPlayerName(taxista,name,MAX_PLAYER_NAME);
  172.             OnTaxiAsPassenger[playerid]=-1;
  173.             new viaje = CostoDelViaje[playerid];
  174.             format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
  175.             GameTextForPlayer(playerid,msg,3000,4);
  176.             format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
  177.             GameTextForPlayer(taxista,msg,3000,4);
  178.             GivePlayerMoney(playerid,-viaje);
  179.             GivePlayerMoney(taxista,viaje);
  180.             cantidadPasajeros--;
  181.             if  (cantidadPasajeros==0)
  182.                 {
  183.                 KillTimer(caidadefichaTimer);
  184.                 }
  185.             }
  186.         }
  187.     if  (newstate==PLAYER_STATE_PASSENGER)
  188.         {
  189.         if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
  190.             {
  191.             new i=0;
  192.             while   (i<MAX_PLAYERS)
  193.                     {
  194.                     if  ((playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
  195.                         {
  196.                         if  (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
  197.                             {
  198.                             new name[MAX_PLAYER_NAME];
  199.                             GetPlayerName(i,name,MAX_PLAYER_NAME);
  200.                             contador[i]++;
  201.                             format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~TAXI~w~",name);
  202.                             GameTextForPlayer(playerid,msg,3000,4);
  203.                             format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
  204.                             GameTextForPlayer(playerid,msg,3000,4);
  205.                             OnTaxiAsPassenger[playerid]=i;
  206.                             CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
  207.                             if  (cantidadPasajeros==0)
  208.                                 {
  209.                                 caidadefichaTimer=SetTimer("caidadeficha",30000,1);
  210.                                 }
  211.                             cantidadPasajeros++;
  212.                             i=MAX_PLAYERS;
  213.                             }
  214.                         }
  215.                     i++;
  216.                     }
  217.             }
  218.         }
  219.     return 1;
  220.     }
  221. //------------------------------------------------------------------------------------------------------
  222.   MissionIni(playerid)
  223.     {
  224.     playerInMiniMission[playerid]=1;
  225.     GameTextForPlayer(playerid,"~r~TAXI ~w~MiniMision ~w~iniciada",3000,4);
  226.     new name[MAX_PLAYER_NAME];
  227.     GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  228.     new msg[255];
  229.     format(msg,sizeof(msg),"***ATENTION: %s is now a TAXI DRIVER***",name);
  230.     for (new i=0;i<MAX_PLAYERS;i++)
  231.         {
  232.         if  (playerid!=i)
  233.             {
  234.             SendClientMessage(i,0xFFFF00AA," ");
  235.             SendClientMessage(i,0xFFFF00AA,msg);
  236.             }
  237.         }
  238.     return 1;
  239.     }
  240. //------------------------------------------------------------------------------------------------------
  241. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  242.     {
  243.     if ((newkeys==KEY_SUBMISSION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
  244.         {
  245.         if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
  246.             {
  247.             if  (playerInMiniMission[playerid]<0)
  248.                 {
  249.                 MissionIni(playerid);
  250.                 }
  251.             else
  252.                 {
  253.                 terminarMission(playerid);
  254.                 }
  255.             }
  256.         }
  257.     }
  258. //------------------------------------------------------------------------------------------------------
  259. public OnPlayerDisconnect(playerid)
  260.     {
  261.     if  (playerInMiniMission[playerid]>0)
  262.         {
  263.         terminarMission(playerid);
  264.         }
  265.     OnTaxiAsPassenger[playerid]=-1;
  266.     return 1;
  267.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement