Advertisement
Paulo_AttacK

Via Fácil By. Paulo_TerroR V2.0

Feb 9th, 2012
1,205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.71 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define sleep2(%0);  for(new _@%0; _@%0 != (%0*50000000);) (_@%0++); //By. Rjjj
  4.  
  5. new ViaFacil[MAX_PLAYERS];
  6. new bool:Pedagio[MAX_PLAYERS] = {false, ...};
  7. new Cancela[MAX_PLAYERS][2];
  8.  
  9. public OnFilterScriptInit() {
  10.     print("                                        ");
  11.     print("         » Via Fácil By. Paulo «        ");
  12.     print("                                        ");
  13.  
  14.     Create3DTextLabel("Compre aqui o seu plano Via Fácil - /viafacil", 0xFFFFFFFF, 60.1402,-1533.1696,5.2082, 10 ,0);
  15.  
  16.     SetTimer("CheckViaFacil", 100, true);
  17.     return 1;
  18. }
  19.  
  20. public OnFilterScriptExit() {
  21.     return 1;
  22. }
  23.  
  24. public OnPlayerConnect(playerid) {
  25.     CreatePlayerObject(playerid, 8168, 55.97, -1532.31, 6.07,   0.00, 0.00, 8.00);
  26.     CreatePlayerObject(playerid, 966, 56.05, -1528.62, 3.93,   0.00, 0.00, 262.00);
  27.     CreatePlayerObject(playerid, 966, 56.05, -1535.86, 3.93,   0.00, 0.00, 82.00);
  28.  
  29.     Cancela[playerid][0] = CreatePlayerObject(playerid, 968, 56.05, -1528.62, 4.67,   0.00, 270.00, 262.00);
  30.     Cancela[playerid][1] = CreatePlayerObject(playerid, 968, 56.05, -1535.82, 4.71,   0.00, 90.00, 262.00);
  31.     Pedagio[playerid] = false;
  32.     return 1;
  33. }
  34.  
  35. public OnPlayerDisconnect(playerid, reason) {
  36.     for(new i; i != 5; i++) DestroyPlayerObject(playerid, i);
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerCommandText(playerid, cmdtext[]) {
  41.     if(!strcmp(cmdtext, "/viafacil", true)) {
  42.         if(IsPlayerInRangeOfPoint(playerid, 2, 60.1402, -1533.1696, 5.2082)) {
  43.             new string[] = "Plano 1 - 10 Pass   R$ 1.000,00\nPlano 2 - 20 Pass  R$ 1.900,00\nPlano 3 - 30 Pass  R$ 2.800,00\nPlano 4 - 50 Pass  R$ 5.000,00\nPlano 5 - 100 Pass R$ 9.000,00";
  44.             ShowPlayerDialog(playerid, 5416, DIALOG_STYLE_LIST, "Plano - Via Fácil", string, "Comprar", "Fechar");
  45.         } else SendClientMessage(playerid, 0xFF0000FF, "ERRO - Você não está no pedágio.");
  46.         return 1;
  47.     }
  48.     return 0;
  49. }
  50.  
  51. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  52.     if(dialogid == 5416) {
  53.         if(response) {
  54.             switch(listitem) {
  55.                 case 0: {
  56.                     SendClientMessage(playerid, 0xFFFFFFFF, "Você comprou 10 Pass Via Fácil!");
  57.                     ViaFacil[playerid] += 10;
  58.                     GivePlayerMoney(playerid, -1000);
  59.                 } case 1: {
  60.                     SendClientMessage(playerid, 0xFFFFFFFF, "Você comprou 20 Pass Via Fácil!");
  61.                     ViaFacil[playerid] += 20;
  62.                     GivePlayerMoney(playerid, -1900);
  63.                 } case 2: {
  64.                     SendClientMessage(playerid, 0xFFFFFFFF, "Você comprou 30 Pass Via Fácil!");
  65.                     ViaFacil[playerid] += 30;
  66.                     GivePlayerMoney(playerid, -2800);
  67.                 } case 3: {
  68.                     SendClientMessage(playerid, 0xFFFFFFFF, "Você comprou 50 Pass Via Fácil!");
  69.                     ViaFacil[playerid] += 50;
  70.                     GivePlayerMoney(playerid, -5000);
  71.                 } case 4: {
  72.                     SendClientMessage(playerid, 0xFFFFFFFF, "Você comprou 100 Pass Via Fácil!");
  73.                     ViaFacil[playerid] += 100;
  74.                     GivePlayerMoney(playerid, -9000);
  75.                 }
  76.             }
  77.         }
  78.     }
  79.     return 1;
  80. }
  81.  
  82. forward CheckViaFacil();
  83. public CheckViaFacil() {
  84.     for(new i; i != GetMaxPlayers(); i++) {
  85.         if(IsPlayerConnected(i)) {
  86.             if(IsPlayerInAnyVehicle(i)) {
  87.                 if(IsPlayerInRangeOfPoint(i, 5.0, 56.05, -1528.62, 4.67)) {
  88.                     if(ViaFacil[i] && !Pedagio[i]) {
  89.                         Pedagio[i] = true; //Evitar Flood
  90.                         if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
  91.                             SendClientMessage(i, 0xFFFFFFFF, "Via Fácil: Você possui o plano Via Fácil e não precisa parar! Boa Viagem.");
  92.                             ViaFacil[i] --;
  93.                         }
  94.                         MovePlayerObject(i, Cancela[i][0], 56.05, -1528.62, 4.67+0.0001, 0.0001, 0.0000, 0.0000, 262.0000);
  95.                     }
  96.                     if(!ViaFacil[i] && !Pedagio[i]) {
  97.                         Pedagio[i] = true; //Evitar Flood
  98.                         if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
  99.                             SendClientMessage(i, 0xFFFFFFFF, "Via Fácil: Você não possui o plano Via Fácil e precisa parar!");
  100.                             TogglePlayerControllable(i, false);
  101.                             sleep2(3);
  102.                             TogglePlayerControllable(i, true);
  103.                             GivePlayerMoney(i, -500);
  104.                         }
  105.                         MovePlayerObject(i, Cancela[i][0], 56.05, -1528.62, 4.67+0.0001, 0.0001, 0.0000, 0.0000, 262.0000);
  106.                     }
  107.                 } else if(IsPlayerInRangeOfPoint(i, 5.0, 56.05, -1535.82, 4.71)) {
  108.                     if(ViaFacil[i] && !Pedagio[i]) {
  109.                         Pedagio[i] = true; //Evitar Flood
  110.                         if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
  111.                             SendClientMessage(i, 0xFFFFFFFF, "Via Fácil: Você possui o plano Via Fácil e não precisa parar! Boa Viagem.");
  112.                             ViaFacil[i] --;
  113.                         }
  114.                         MovePlayerObject(i, Cancela[i][1], 56.05, -1535.82, 4.71+0.0001, 0.0001, 0.0000, 0.0000, 262.0000);
  115.                     } else if(!ViaFacil[i] && !Pedagio[i]) {
  116.                         Pedagio[i] = true; //Evitar Flood
  117.                         if(GetPlayerState(i) == PLAYER_STATE_DRIVER) {
  118.                             SendClientMessage(i, 0xFFFFFFFF, "Via Fácil: Você não possui o plano Via Fácil e precisa parar!");
  119.                             TogglePlayerControllable(i, false);
  120.                             sleep2(3);
  121.                             TogglePlayerControllable(i, true);
  122.                             GivePlayerMoney(i, -500);
  123.                         }
  124.                         MovePlayerObject(i, Cancela[i][1], 56.05, -1535.82, 4.71+0.0001, 0.0001, 0.0000, 0.0000, 262.0000);
  125.                     }
  126.                 }
  127.                 else {
  128.                     if(Pedagio[i]) {
  129.                         Pedagio[i] = false;
  130.                         MovePlayerObject(i, Cancela[i][0], 56.05, -1528.62, 4.67, 0.0001, 0.0000, 270.0000, 262.0000);
  131.                         MovePlayerObject(i, Cancela[i][1], 56.05, -1535.82, 4.71, 0.0001, 0.0000, 90.0000, 262.0000);
  132.                     }
  133.                 }
  134.             }
  135.         }
  136.     }
  137.     return 1;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement