[Ajuda] Sistema de taxi ta doidao
#1

Ola, eu denovo pedindo ajuda kk..

Faz uns 3 dias estou tentando criar um sistema de taximetro eu atй consegui fazer com que debitasse e creditasse o valor da forma correta porem nгo consegui fazer um "taximetro" ou seja a cada tantos segundos o valor aumenta e tambйm o valor que estava debitando era um valor definido e que era altissimo, fiz, refiz e sу piorei o que estava, acabou ficando assim:
OnPlayerEnterVehicle
pawn Код:
new cTaxista[MAX_PLAYER_NAME] = PLAYER_STATE_DRIVER;
      new tPassageiro[MAX_PLAYER_NAME];
      new string[56];
      if(ispassenger)
      {
      if(vehicleid >= 44)
      {
      if(Taximetro == 1)
      {
      GetPlayerName(playerid, cTaxista, sizeof(cTaxista));
      format(string, sizeof(string), "%i Entrou no seu taxi!", ispassenger);
      SendClientMessage(cTaxista[playerid], Azul, cTaxista);
      GetPlayerName(ispassenger, tPassageiro, MAX_PLAYER_NAME);
      format(string, sizeof(string), "Vocк entrou no taxi do %s e esta pagando %s a cada 15segundos", cTaxista, valor);
      SendClientMessage(playerid, Azul, string);

      }
      }
      }




/*
     new string[80];

     if(ispassenger)
     {
     if(Taximetro == 1)
     {

     GetPlayerName(playerid, Motorista, sizeof(Motorista));
     format(string, sizeof(string), "Vocк entrou no taxi do %s e o valor da corrida й R$%i", Motorista, valor);
     SendClientMessage(playerid, Cyan, string);
     }
     }
OnPlayerExitVehicle
pawn Код:
/* new string[80];
     new stateplayer = GetPlayerState(playerid);
     if(stateplayer == PLAYER_STATE_PASSENGER)
     {
     if(Taximetro == 1)
     {
     format(string, sizeof(string), "O taxista %i levou vocк atй seu destino e vocк pagou %i", playerid, valor);
     SendClientMessage(playerid, Cyan, string);
     GivePlayerMoney(playerid, -valor);
     GivePlayerMoney(Motorista[playerid], valor);
     KillTimer(TempoCorrida);
     }
     }

     if(stateplayer == PLAYER_STATE_DRIVER)
     {
     if(Taximetro == 1)
     {

     format(string, sizeof(string), "O taxista %i esta fora do trabalho", playerid);
     SendClientMessageToAll(Cyan, string);
     Taximetro = 0;
     KillTimer(TempoCorrida);
     }
     }
     */



      new cTaxista[MAX_PLAYER_NAME] = PLAYER_STATE_DRIVER;
      new tPassageiro[MAX_PLAYER_NAME] = PLAYER_STATE_PASSENGER;
      new string[56];
      if(playerid == tPassageiro[playerid])
      {
      if(vehicleid >= 44)
      {
      if(Taximetro == 1)
      {
      GetPlayerName(playerid, cTaxista[playerid], sizeof(cTaxista));
      format(string, sizeof(string), "%i Saiu do seu taxi e lhe pagou %i", tPassageiro, valor);
      SendClientMessage(cTaxista[playerid], Azul, string);
      GetPlayerName(playerid, tPassageiro, MAX_PLAYER_NAME);
      format(string, sizeof(string), "Vocк terminou a corrida com o %s e pagou R$ %s", cTaxista, valor);
      SendClientMessage(playerid, Azul, string);
      valor = GetPlayerMoney(playerid);
      GivePlayerMoney(cTaxista[playerid], valor);
      GivePlayerMoney(playerid, -valor);
      KillTimer(TempoCorrida);
      return 1;
      }
      }
      }
      if(playerid == cTaxista[playerid])
      {
      if(Taximetro == 1)
      {
      if(vehicleid >= 44)
      {
      GetPlayerName(playerid, cTaxista[playerid], sizeof(cTaxista));
      format(string, sizeof(string), "Taxista %i nгo esta mais em corrida ", tPassageiro[playerid]);
      SendClientMessageToAll(Cyan, string);
      KillTimer(TempoCorrida);
      return 1;
      }
      }
      }
CMD
pawn Код:
CMD:corrida(playerid, params[])
{
new carid = GetPlayerVehicleID(playerid);
new anuncio[256];
if(pDados[playerid][Organizacao] == 15) {
if(carid <= 44 ) return SendClientMessage(playerid, Cyan, "Vocк nгo esta no taxi!");
if(sscanf(params, "s", valor)) return SendClientMessage(playerid, Cyan, "[USE]: /corrida valor");
if(valor < 1 || valor > 999) return SendClientMessage(playerid, Cyan, "A corrida deve estar entre 1 e 999");
GetPlayerName(playerid, Motorista, sizeof(Motorista));
format(anuncio, sizeof(anuncio), "O taxista %s esta em uma corrida e o taximetro inicial й R$ %s", Motorista,valor);
SendClientMessageToAll(Laranja, anuncio);
Taximetro = 1;
TempoCorrida = SetTimerEx("PagarCorridaTaxi", 1000, true, "i", playerid);
}
else if(pDados[playerid][Organizacao] != 15) {
SendClientMessage(playerid, Azul, "voce nao e taxista");
}
return 1;
}
realmente agora estou mais perdido que nunca =\

@edit

na minha ultima tentativa criei a forward:
pawn Код:
forward PagarCorridaTaxi(playerid);
public PagarCorridaTaxi(playerid)
{
if(Taximetro == 1)
{
valor = GetPlayerMoney(playerid);
GivePlayerMoney(Motorista[playerid], valor);
GivePlayerMoney(Passageiro[playerid], valor);

}
return 1;
}
Reply


Messages In This Thread
Sistema de taxi ta doidao - by johntrybescripter - 16.01.2017, 21:22
Re: Sistema de taxi ta doidao - by Meck - 17.01.2017, 04:35
Re: Sistema de taxi ta doidao - by johntrybescripter - 17.01.2017, 13:22
Re: Sistema de taxi ta doidao - by johntrybescripter - 17.01.2017, 15:13

Forum Jump:


Users browsing this thread: 1 Guest(s)