Advertisement
Guest User

Pedagio LS/SF GTASA SAMP

a guest
Dec 20th, 2010
1,585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.80 KB | None | 0 0
  1. // Pedágio por Marcelo//
  2. // O FilterScript coloca pedágios em alguns pontos de SF,LS
  3. // LV Ainda não foi feito!
  4.  
  5. #define FILTERSCRIPT
  6. #include <a_samp>
  7. #include <cpstream>
  8. #define COLOR_MSG 0x33AA33AA
  9. // Custos
  10. new TxBike = 5; // Isso Significa q o jogador irá pagar 5 dolares quando passar utilizando uma bike
  11. new TxMotoBike = 15;// Isso Significa q o jogador irá pagar  15 dolares quando passar utilizando uma moto
  12. new TxCar = 20; // Isso Significa q o jogador irá pagar 20 dolares quando passar utilizando um carro
  13. new TxTruck = 85;// Isso Significa q o jogador irá pagar  85 dolares quando passar utilizando um caminhão, onibus
  14. // Porcentagem Adicional - Impostos - Aqi Voce Irá Definir o Impostos em CIma do Valor (Porcentagem) assim o jogador irá
  15. // pagar o valor + a porcentagem
  16. new TxPorcent = 15; // 15% do Valor
  17.  
  18. // Array dos CheckPoints dos Pedagios
  19. new Pedagios[10] = { };
  20. // Array das Catacras dos Pedagios
  21. new Catacras[10] = { };
  22.  
  23. forward PagaPedagio(playerid);
  24. forward SwTurnslide(turnslideid, mode);
  25. forward ValidIsATruck(vehicleid);
  26. forward ValidIsABike(vehicleid);
  27. forward ValidIsAMotorBike(vehicleid);
  28. forward ValidIsACar(vehicleid);
  29. forward SetTextDraw(playerid , money, imposto);
  30. forward GetCarType(vehicleid);
  31. forward Congelar(playerid);
  32. forward Descongelar(playerid);
  33.  
  34. public OnFilterScriptInit()
  35.  
  36. {
  37.     print("\n--------------------------------------");
  38.     print("Pedágio SF/LS. Script Vr1.0");
  39.     print("--------------------------------------\n");
  40.     // Objetos Utilizados nos Pedágios
  41.     // Catacras de San Fierro - pedágio 1
  42.     CreateObject(966, -2664.99, 1285.64, 54.45,   0.00, 0.00, 0.00);
  43.     Catacras[0] = CreateObject(968, -2664.9099, 1285.6200, 55.00,   0.00, -90.00, 0.00);
  44.     //-----------------------------------------------------------------
  45.     CreateObject(966, -2673.42, 1285.51, 54.45,   0.00, 0.00, 0.00);
  46.     Catacras[1] = CreateObject(968, -2673.3899, 1285.5200, 55.00,   0.00, -90.00, 0.00);
  47.     //-----------------------------------------------------------------
  48.     CreateObject(966, -2683.09, 1263.13, 54.45,   0.00, 0.00, 0.00);
  49.     Catacras[2] = CreateObject(968, -2683.1001, 1263.1300, 55.00,   0.00, -90.00, 0.00);
  50.     //-----------------------------------------------------------------
  51.     CreateObject(966, -2690.60, 1263.02, 54.45,   0.00, 0.00, 0.00);
  52.     Catacras[3] = CreateObject(968, -2690.5701, 1263.0200, 55.00,   0.00, -90.00, 0.00);
  53.     //-----------------------------------------------------------------
  54.     // CheckPoints Pedagios San Fiero
  55.     Pedagios[0] = CPS_AddCheckpoint(-2668.3137,1273.9611,54.9954, 5.5,5);
  56.     Pedagios[1] = CPS_AddCheckpoint(-2676.0156,1275.2318,54.9974, 5.5,5);
  57.     Pedagios[2] = CPS_AddCheckpoint(-2686.7061,1277.8212,54.9967, 5.5,5);
  58.     Pedagios[3] = CPS_AddCheckpoint(-2694.2705,1274.0186,54.9945, 5.5,5);
  59.     // Los Santos Pedagio 1
  60.     Pedagios[4] = CPS_AddCheckpoint(2806.9316,-421.0658,21.5625, 5.5,5);
  61.     Pedagios[5] = CPS_AddCheckpoint(2799.4644,-426.7913,21.5884, 5.5,5);
  62.     // Los Santos Pedagio 2
  63.     Pedagios[6] = CPS_AddCheckpoint(2791.8972,-438.3035,21.4490, 5.5,5);
  64.     Pedagios[7] = CPS_AddCheckpoint(2783.7698,-441.9258,21.6127, 5.5,5);
  65.     // Los Santos Pedagio 3
  66.     Pedagios[8] = CPS_AddCheckpoint(2851.6899,-702.9770,10.4049, 5.5,5);
  67.     Pedagios[9] = CPS_AddCheckpoint(2841.6714,-702.8436,10.3874, 5.5,5);
  68.     //-----------------------------------------------------------------
  69.     CreateObject(9623, 2804.64, -425.18, 23.40,   2.00, 0.00, 43.00);
  70.     //Pedagio Los Santos
  71.     CreateObject(966, 2795.94, -418.30, 21.10,   0.00, 0.00, 44.00);
  72.     Catacras[4] = CreateObject(968, 2802.67, -411.77, 21.80,   0.00, -90.00, 44.00);
  73.     //-----------------------------------------------------------------
  74.     CreateObject(966, 2802.70, -411.77, 21.10,   0.00, 0.00, 44.00);
  75.     Catacras[5] = CreateObject(968, 2795.96, -418.25, 21.80,   0.00, -90.00, 44.00);
  76.     //-----------------------------------------------------------------
  77.     // Pedagio 2 Los Santos
  78.     CreateObject(9623, 2788.99, -439.84, 23.40,   2.00, 0.00, 43.00);
  79.     //-----------------------------------------------------------------
  80.     CreateObject(966, 2801.49, -441.98, 20.10,   0.00, 0.00, 44.00);
  81.     Catacras[6] = CreateObject(968, 2801.52, -441.91, 20.80,   0.00, -90.00, 44.00);
  82.     //-----------------------------------------------------------------
  83.     CreateObject(966, 2794.54, -448.48, 20.10,   0.00, 0.00, 44.00);
  84.     Catacras[7] = CreateObject(968, 2794.66, -448.39, 20.80,   0.00, -90.00, 44.00);
  85.     // Pedagio 3 Los Santos
  86.     CreateObject(9623, 2846.98, -703.94, 12.50,   0.00, 0.00, 0.00);
  87.     //-----------------------------------------------------------------
  88.     CreateObject(966, 2854.03, -713.92, 9.79,   0.00, 0.00, 0.00);
  89.     Catacras[8] = CreateObject(968, 2854.29, -713.91, 10.50,   0.00, -90.00, 0.00);
  90.     //-----------------------------------------------------------------
  91.     CreateObject(966, 2845.63, -714.17, 9.79,   0.00, 0.00, 0.00);
  92.     Catacras[9] = CreateObject(968, 2845.77, -714.21, 10.50,   0.00, -90.00, 0.00);
  93.     //-----------------------------------------------------------------
  94.     return 1;
  95. }
  96.  
  97. public OnFilterScriptExit()
  98. {
  99.     return 1;
  100. }
  101.  
  102. public OnPlayerEnterCheckpoint(playerid)
  103. {
  104.     new resultPda;
  105.     if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[0]))
  106.     {
  107.         resultPda = PagaPedagio(playerid);
  108.         if (resultPda == 1)
  109.         {
  110.             SwTurnslide(1,1);
  111.             SetTimerEx("SwTurnslide",5000, false,"ii",1,0);
  112.         }
  113.         return 1;
  114.     }
  115.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[1]))
  116.     {
  117.         resultPda = PagaPedagio(playerid);
  118.         if (resultPda == 1)
  119.         {
  120.             SwTurnslide(2,1);
  121.             SetTimerEx("SwTurnslide",5000, false,"ii",2,0);
  122.         }
  123.         return 1;
  124.     }
  125.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[2]))
  126.     {
  127.         resultPda = PagaPedagio(playerid);
  128.         if (resultPda == 1)
  129.         {
  130.             SwTurnslide(3,1);
  131.             SetTimerEx("SwTurnslide",5000, false,"ii",3,0);
  132.         }
  133.         return 1;
  134.     }
  135.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[3]))
  136.     {
  137.         resultPda = PagaPedagio(playerid);
  138.         if (resultPda == 1)
  139.         {
  140.             SwTurnslide(4,1);
  141.             SetTimerEx("SwTurnslide",5000, false,"ii",4,0);
  142.         }
  143.         return 1;
  144.     }
  145.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[4]))
  146.     {
  147.         resultPda = PagaPedagio(playerid);
  148.         if (resultPda == 1)
  149.         {
  150.             SwTurnslide(5,1);
  151.             SetTimerEx("SwTurnslide",5000, false,"ii",5,0);
  152.         }
  153.         return 1;
  154.     }
  155.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[5]))
  156.     {
  157.         resultPda = PagaPedagio(playerid);
  158.         if (resultPda == 1)
  159.         {
  160.             SwTurnslide(6,1);
  161.             SetTimerEx("SwTurnslide",5000, false,"ii",6,0);
  162.         }
  163.         return 1;
  164.     }
  165.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[6]))
  166.     {
  167.         resultPda = PagaPedagio(playerid);
  168.         if (resultPda == 1)
  169.         {
  170.             SwTurnslide(7,1);
  171.             SetTimerEx("SwTurnslide",5000, false,"ii",7,0);
  172.         }
  173.         return 1;
  174.     }
  175.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[7]))
  176.     {
  177.         resultPda = PagaPedagio(playerid);
  178.         if (resultPda == 1)
  179.         {
  180.             SwTurnslide(8,1);
  181.             SetTimerEx("SwTurnslide",5000, false,"ii",8,0);
  182.         }
  183.         return 1;
  184.     }
  185.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[8]))
  186.     {
  187.         resultPda = PagaPedagio(playerid);
  188.         if (resultPda == 1)
  189.         {
  190.             SwTurnslide(9,1);
  191.             SetTimerEx("SwTurnslide",5000, false,"ii",9,0);
  192.         }
  193.         return 1;
  194.     }
  195.     else if (CPS_IsPlayerInCheckpoint(playerid, Pedagios[9]))
  196.     {
  197.         resultPda = PagaPedagio(playerid);
  198.         if (resultPda == 1)
  199.         {
  200.             SwTurnslide(10,1);
  201.             SetTimerEx("SwTurnslide",5000, false,"ii",10,0);
  202.         }
  203.         return 1;
  204.     }
  205.     return 1;
  206. }
  207.  
  208. public PagaPedagio(playerid)
  209. {
  210.     if ( IsPlayerInAnyVehicle(playerid) == 1 )
  211.     {
  212.         TogglePlayerControllable(playerid,0);
  213.         SetTimerEx("Descongelar",1000,false,"i",playerid);
  214.    
  215.         new CarModel;
  216.         new CarID;
  217.         new Taxa;
  218.         new TaxaPc;
  219.         new TotalAPagar;
  220.         CarID = GetPlayerVehicleID(playerid);
  221.         CarModel = GetVehicleModel(CarID);
  222.         Congelar(playerid);
  223.         new CarType;
  224.         CarType = GetCarType(CarModel);
  225.    
  226.         if ( CarType == 4 )
  227.         {
  228.             TaxaPc =  TxPorcent / 100;
  229.             TaxaPc = TaxaPc * TxTruck;
  230.             TotalAPagar = TxTruck + TaxaPc;
  231.             GivePlayerMoney(playerid, -TotalAPagar);
  232.             Taxa = TotalAPagar;
  233.         }
  234.         else if ( CarType == 3 )
  235.         {
  236.             TaxaPc =  TxPorcent / 100;
  237.             TaxaPc = TaxaPc * TxMotoBike;
  238.             TotalAPagar = TxMotoBike + TaxaPc;
  239.             GivePlayerMoney(playerid, -TotalAPagar);
  240.             Taxa = TotalAPagar;
  241.         }
  242.         else if ( CarType == 2 )
  243.         {
  244.             TaxaPc =  TxPorcent / 100;
  245.             TaxaPc = TaxaPc * TxBike;
  246.             TotalAPagar = TxBike + TaxaPc;
  247.             GivePlayerMoney(playerid, -TotalAPagar);
  248.             Taxa = TotalAPagar;
  249.         }
  250.         else if ( CarType == 1 )
  251.         {
  252.             TaxaPc =  TxPorcent / 100;
  253.             TaxaPc = TaxaPc * TxCar;
  254.             TotalAPagar = TxCar + TaxaPc;
  255.             GivePlayerMoney(playerid, -TotalAPagar);
  256.             Taxa = TotalAPagar;
  257.         }
  258.         SetTextDraw(playerid, Taxa, TaxaPc);
  259.         return 1;
  260.     }
  261.     return 0;
  262. }
  263.  
  264. public SwTurnslide(turnslideid, mode)
  265. {
  266.     switch(turnslideid)
  267.     {
  268.         case 1:
  269.         {
  270.             if (mode == 1) {    SetObjectRot(Catacras[0],0,0,0);}
  271.             else if (mode == 0){SetObjectRot(Catacras[0],0,-90.00,0);}
  272.         }
  273.         case 2:
  274.         {
  275.             if (mode == 1) {    SetObjectRot(Catacras[1],0,0,0);}
  276.             else if (mode == 0){SetObjectRot(Catacras[1],0,-90.00,0);}
  277.         }
  278.         case 3:
  279.         {
  280.             if (mode == 1) {    SetObjectRot(Catacras[2],0,0,0);}
  281.             else if (mode == 0){SetObjectRot(Catacras[2],0,-90.00,0);}
  282.         }
  283.         case 4:
  284.         {
  285.             if (mode == 1) {    SetObjectRot(Catacras[3],0,0,0);}
  286.             else if (mode == 0){SetObjectRot(Catacras[3],0,-90.00,0);}
  287.         }
  288.         case 5:
  289.         {
  290.             if (mode == 1) {    SetObjectRot(Catacras[4],0,0,0);}
  291.             else if (mode == 0){SetObjectRot(Catacras[4], 0.00, -90.00, 44.00);}
  292.         }
  293.         case 6:
  294.         {
  295.             if (mode == 1) {    SetObjectRot(Catacras[5],0,0,0);}
  296.             else if (mode == 0){SetObjectRot(Catacras[5], 0.00, -90.00, 44.00);}
  297.         }
  298.         case 7:
  299.         {
  300.             if (mode == 1) {    SetObjectRot(Catacras[6],0,0,0);}
  301.             else if (mode == 0){SetObjectRot(Catacras[6], 0.00, -90.00, 44.00);}
  302.         }
  303.         case 8:
  304.         {
  305.             if (mode == 1) {    SetObjectRot(Catacras[7],0,0,0);}
  306.             else if (mode == 0){SetObjectRot(Catacras[7], 0.00, -90.00, 44.00);}
  307.         }
  308.         case 9:
  309.         {
  310.             if (mode == 1) {    SetObjectRot(Catacras[8],0,0,0);}
  311.             else if (mode == 0){SetObjectRot(Catacras[8], 0.00, -90.00, 0);}
  312.         }
  313.         case 10:
  314.         {
  315.             if (mode == 1) {    SetObjectRot(Catacras[9],0,0,0);}
  316.             else if (mode == 0){SetObjectRot(Catacras[9], 0.00, -90.00, 0);}
  317.         }
  318.     }
  319. }
  320.  
  321. public ValidIsATruck(vehicleid)
  322. {
  323.     if (vehicleid == 403 || vehicleid == 406 || vehicleid == 408 || vehicleid == 414 || vehicleid == 423)
  324.     {
  325.         return true;
  326.     }
  327.     else if(vehicleid == 423 || vehicleid == 431 || vehicleid == 433 || vehicleid == 437 || vehicleid == 443)
  328.     {
  329.         return true;
  330.     }
  331.     else if( vehicleid == 455 || vehicleid == 456 || vehicleid == 478 || vehicleid == 498 || vehicleid == 499)
  332.     {
  333.         return true;
  334.     }
  335.     else if (vehicleid == 508 || vehicleid == 514 || vehicleid == 515 || vehicleid == 524 || vehicleid == 525)
  336.     {
  337.         return true;
  338.     }
  339.     else if(vehicleid == 552 || vehicleid == 573 || vehicleid == 578 || vehicleid == 588 || vehicleid == 609)
  340.     {
  341.         return true;
  342.     }
  343.     else { return false; }
  344. }
  345.  
  346. public ValidIsAMotorBike(vehicleid)
  347. {
  348.     if (vehicleid == 448 || vehicleid == 461 || vehicleid == 462 || vehicleid == 463 || vehicleid == 468)
  349.     {
  350.         return true;
  351.     }
  352.     else if(vehicleid == 471 || vehicleid == 521 || vehicleid == 522 || vehicleid == 523 || vehicleid == 581)
  353.     {
  354.         return true;
  355.     }
  356.     else if( vehicleid == 586)
  357.     {
  358.         return true;
  359.     }
  360.     else { return false; }
  361. }
  362.  
  363. public ValidIsABike(vehicleid)
  364. {
  365.     if (vehicleid == 481 || vehicleid == 509 || vehicleid == 510)
  366.     {
  367.         return true;
  368.     }
  369.     else { return false; }
  370. }
  371.  
  372. public ValidIsACar(vehicleid)
  373. {
  374.   if ( ValidIsATruck(vehicleid) )
  375.   {
  376.     return false;
  377.   }
  378.   else if ( ValidIsAMotorBike(vehicleid) )
  379.   {
  380.     return false;
  381.   }
  382.   else if ( ValidIsABike(vehicleid) )
  383.   {
  384.     return false;
  385.   }
  386.   else { return true; }
  387. }
  388.  
  389. public GetCarType(vehicleid)
  390. {
  391.   if ( ValidIsATruck(vehicleid) )
  392.   {
  393.     return 4;
  394.   }
  395.   else if ( ValidIsAMotorBike(vehicleid) )
  396.   {
  397.     return 3;
  398.   }
  399.   else if ( ValidIsABike(vehicleid) )
  400.   {
  401.     return 2;
  402.   }
  403.   else if ( ValidIsACar(vehicleid) )
  404.   {
  405.     return 1;
  406.   }
  407.   else { return 0; }
  408. }
  409.  
  410. public SetTextDraw(playerid , money, imposto)
  411. {
  412.     new moneystr[256];
  413.     format(moneystr, sizeof(moneystr),"Pago %i $ + %i De Imposto", money, imposto);
  414.     SendClientMessage(playerid, COLOR_MSG, moneystr);
  415.     new str[256];
  416.     new pName[256];
  417.     GetPlayerName(playerid, pName, sizeof(pName));
  418.     format(str, sizeof(str),"Obrigado Sr.%s Tenha um Bom Dia!", pName);
  419.     SendClientMessage(playerid, COLOR_MSG, str);
  420. }
  421.  
  422. public Congelar(playerid)
  423. {
  424.     TogglePlayerControllable(playerid,0);
  425. }
  426.  
  427. public Descongelar(playerid)
  428. {
  429.     TogglePlayerControllable(playerid,1);
  430. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement