#define COLOR_TAXISTA 0xF68E00F6
//Taxi
forward IsATaxi(playerid);
forward IsATaxiCar(carid);
forward SendTaxiMessage(family, COLOR, string[]);
new TaxiDrivers = 0;
//Serviзo Taxi
new TaxiCall = 999;
new TaxiCallTime[MAX_PLAYERS];
new TaxiAccepted[MAX_PLAYERS];
//em OnPlayerConnect
TaxiCallTime[playerid] = 0;
TaxiAccepted[playerid] = 999;
//em OnPlayerDisconnect
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(TaxiAccepted[i] < 999)
{
if(TaxiAccepted[i] == playerid)
{
TaxiAccepted[i] = 999;
GameTextForPlayer(i, "~w~O Cliente~n~~r~Saiu do jogo", 5000, 1);
TaxiCallTime[i] = 0;
DisablePlayerCheckpoint(i);
}
}
//ainda em OnPlayerDisconnect ...mais um pouco abaixo ...
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
//em onplayerentercheckpoint
if(TaxiCallTime[playerid] > 0 && TaxiAccepted[playerid] < 999)
{
TaxiAccepted[playerid] = 999;
GameTextForPlayer(playerid, "~w~Chegou ao destino", 5000, 1);
TaxiCallTime[playerid] = 0;
DisablePlayerCheckpoint(playerid);
}
//em Onplayerstatechange
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
/*else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}*/
TransportDuty[playerid] = 0;
format(string, sizeof(string), "* Estб fora de serviзo, ganhou R$%d.", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoneyEx(playerid, TransportMoney[playerid]);
ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
}
if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
{
if(IsPlayerConnected(TransportDriver[playerid]))
{
TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
TransportTime[TransportDriver[playerid]] = 0;
TransportCost[TransportDriver[playerid]] = 0;
format(string, sizeof(string), "~w~Custo da corrida~n~~r~R$%d",TransportCost[playerid]);
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "~w~Passageiro saiu do taxi~n~~g~ganhou R$%d",TransportCost[playerid]);
GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
GivePlayerMoneyEx(playerid, -TransportCost[playerid]);
TransportCost[playerid] = 0;
TransportTime[playerid] = 0;
TransportDriver[playerid] = 999;
}
}
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
TextDrawDestroy(Speedo[playerid]);
}
if (newstate == 2 || newstate == 3)
{
if (oldnew == 0)
{
format(str, sizeof(str), "~g~%s",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
GameTextForPlayer(playerid, str, 6000, 1);
}
}
if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new vehicleid = GetPlayerVehicleID(playerid);
TextDrawDestroy(Speedo[playerid]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
{
if(GetPlayerMoneyEx(playerid) < TransportValue[i])
{
format(string, sizeof(string), "* Voce precisa de R$%d para entrar.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
RemovePlayerFromVehicle(playerid);
}
else
{
if(TransportDuty[i] == 1)
{
format(string, sizeof(string), "* Pagou R$%d para o taxista.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Passageiro %s entrou no Taxi.", name);
SendClientMessage(i, COLOR_LIGHTBLUE, string);
TransportTime[i] = 1;
TransportTime[playerid] = 1;
TransportCost[playerid] = TransportValue[i];
TransportCost[i] = TransportValue[i];
TransportDriver[playerid] = i;
}
else if(TransportDuty[i] == 2)
{
format(string, sizeof(string), "* Pagou R$%d para o Motorista De Onibus.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Passageiro %s entrou no Onibus.", name);
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
GivePlayerMoneyEx(playerid, - TransportValue[i]);
TransportMoney[i] += TransportValue[i];
}
}
}
}
}
//ainda em onplayerstatechange
else if(IsATaxiCar(newcar))
{
if(IsATaxi(playerid)) { }
else { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid, COLOR_WHITE, "Voce nгo й Taxista!"); TogglePlayerControllable(playerid, 1); }
}
//em playerunjail ???
if(TaxiCallTime[i] > 0)
{
if(TaxiAccepted[i] < 999)
{
if(IsPlayerConnected(TaxiAccepted[i]))
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(TaxiAccepted[i], X, Y, Z);
SetPlayerCheckpoint(i, X, Y, Z, 5);
}
}
}
//n sei :D (a org de taxista esta em "10")
public SendTaxiMessage(family, COLOR, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pMembro] == 10 || PlayerInfo[i][pLider] == 10)
{
if(!gFam[i])
{
SendClientMessage(i, COLOR, string);
}
}
}
}
}
//no comando /serviзo ...
if(strcmp(cmd, "/serviзo", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Service Names __________________|");
SendClientMessage(playerid, COLOR_WHITE, "USE: /servico [NOME]");
SendClientMessage(playerid, COLOR_GREY, "Nomes: Taxi, SAMU, Mecanico, Policia, Bombeiro");
SendClientMessage(playerid, COLOR_WHITE, "|________________________________________________|");
return 1;
}
if(strcmp(x_nr,"taxi",true) == 0)
{
if(TaxiDrivers < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Nao tem taxista online agora, espere algum entrar !");
return 1;
}
if(TransportDuty[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Voce nao pode ligar para um Taxi agora !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "** %s Necessita de um Taxista. (Use /aceitar taxi - Para Aceitar a Chamada)", sendername);
SendFamilyMessage(10, TEAM_AZTECAS_COLOR, string);
SendFamilyMessage(26, TEAM_AZTECAS_COLOR, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Voce chamou um Taxista... Agora espera a resposta.");
TaxiCall = playerid;
return 1;
}
if(strcmp(x_nr,"taxi",true) == 0)
{
if(TaxiDrivers < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Nao tem taxista online agora, espere algum entrar !");
return 1;
}
if(TransportDuty[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " Voce nao pode ligar para um Taxi agora !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "** %s Necessita de um Taxista. (Use /aceitar taxi - Para Aceitar a Chamada)", sendername);
SendFamilyMessage(10, TEAM_AZTECAS_COLOR, string);
SendFamilyMessage(26, TEAM_AZTECAS_COLOR, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Voce chamou um Taxista... Agora espera a resposta.");
TaxiCall = playerid;
return 1;
}
//no comando /corrida
if(strcmp(cmd,"/corrida",true)==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMembro] == 31 || PlayerInfo[playerid][pLider] == 31)
{
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
/*else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}*/
TransportDuty[playerid] = 0;
format(string, sizeof(string), "* Agora vocк estб de folga e ganhou $%d.", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoneyEx(playerid, TransportMoney[playerid]);
ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
return 1;
}
new Veh = GetPlayerVehicleID(playerid);
if(IsATaxiCar(Veh))
{
if(GetPlayerState(playerid) == 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USE: /corrida [preзo]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, " Tarifa de preзo deve ser um valor entre $1 e $1000!"); return 1; }
TaxiDrivers += 1; TransportDuty[playerid] = 1; TransportValue[playerid] = moneys;
GetPlayerName(playerid,sendername,sizeof(sendername));
format(string, sizeof(string), "Taxista %s Esta rodando por: $%d. /serviзo taxi", sendername, TransportValue[playerid]);
OOCNews(COLOR_RED,string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "voce nao esta em um taxi !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Voce nгo esta em um Taxi!");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY," Voce nao esta em um Taxi!");
return 1;
}
}
return 1;
}
//ai dps vem o /cancelar taxi e talz ....
enum pInfo
{
pSenha[128],
pNivel,
pAdmin,
pVIP,
pFREE,
gPupgrade,
pConnectTime,
pReg,
pSexo,
pFamily,
pAge,
pOrigem,
pCK,
pNovato,
pMuted,
pExp,
pCash,
pConta,
pCrimes,
pKills,
pDeaths,
pArrested,
pWantedDeaths,
pPhoneBook,
pLottoNr,
pFishes,
pBiggestFish,
pEmprego,//aki !!
pPayCheck,
pHeadValue,
pJailed,
pJailTime,
pMats,
pDrogas,
pLider,
pMembro,
pFMember,
pCargo,
pChar,
EM FIM ... COMO TROCO O [pMembro] = 10 , [pLider] = 10 ... por um [pEmprego] ? |