if (vehicleid == 200) //aqui e o id do carro que vai ter o neon.
{
//que funзao de neon meto aqui?
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (vehicleid == 44)
{
AttachObjectToVehicle(18648, 44, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(18648, 44, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (vehicleid == 44)
{
AttachObjectToVehicle(18648, 44, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(18648, 44, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
Tive a ver isso e coluquei assim porque nao funciona ?
PHP код:
|
//Coloque na public OnPlayerCommandText:
if(!strcmp("/teste",cmdtext,true,6))
{
new texto[50];
format(texto,50,"ID do Veнculo que estб com vocк dentro = %i",GetPlayerVehicleID(playerid));
SendClientMessage(playerid,0xFFFFFFAA,texto);
return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
#define vehicleid GetPlayerVehicleID(playerid)
if(newstate == PLAYER_STATE_DRIVER)
{
if (vehicleid == 44)
{
AttachObjectToVehicle(18648, 44, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(18648, 44, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "ii", playerid);
}
else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "ii", playerid);
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
{
PlayerInKart[playerid] = 0;
KartingPlayers --;
}
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}
TransportDuty[playerid] = 0;
format(string, sizeof(string), "* Vocк estб agora fora de serviзo $%d *", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, string);
SafeGivePlayerMoney(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~O custo de viagem~n~~r~$%d",TransportCost[playerid]);
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "~w~Passageiro saiu do tбxi~n~~g~Ganhaste: $%d",TransportCost[playerid]);
GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
SafeGivePlayerMoney(playerid, -TransportCost[playerid]);
TransportCost[playerid] = 0;
TransportTime[playerid] = 0;
TransportDriver[playerid] = 999;
}
}
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
}
if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
{
if(GetPlayerMoney(playerid) < TransportValue[i])
{
format(string, sizeof(string), "* Vocк precisa $%d para entrar.", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
RemovePlayerFromVehicle(playerid);
}
else
{
if(TransportDuty[i] == 1)
{
format(string, sizeof(string), "* Vocк pagou $%d ao taxista.", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "* Passageiro %s entrou no seu taxi.", name);
SendClientMessage(i, COLOR_GREEN, 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), "* Vocк pagou $%d ao camionista .", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "* Passageiro %s entrou no seu autocarro.", name);
SendClientMessage(i, COLOR_GREEN, string);
}
SafeGivePlayerMoney(playerid, - TransportValue[i]);
TransportMoney[i] += TransportValue[i];
}
}
}
}
}
if(newstate == PLAYER_STATE_WASTED)
{
if(WantedLevel[playerid] >= 1)
{
new price = WantedLevel[playerid] * 1000;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
{
count = 1;
format(string, sizeof(string), "~w~execuзгo suspeito~r~Assassinado~n~Bфnus~g~$%d", price);
GameTextForPlayer(i, string, 5000, 1);
//ConsumingMoney[i] = 1;
SafeGivePlayerMoney(i, price / 2);
PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
}
}
}
if(count == 1)
{
SafeGivePlayerMoney(playerid, - price);
PlayerInfo[playerid][pWantedDeaths] += 1;
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(600);
format(string, sizeof(string), "* Foste para a prisгo porque cometeste um crime", PlayerInfo[playerid][pJailTime], price);
SendClientMessage(playerid, COLOR_RED, string);
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{// 38 / 49 / 56 = SS
new newcar = GetPlayerVehicleID(playerid);
new oldcar = gLastCar[playerid];
new housecar = PlayerInfo[playerid][pPhousekey]+1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
if(IsABoat(newcar))
{
if(PlayerInfo[playerid][pBoatLic] < 1)
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem licenca de vela, diriga com cuidado ou a policia vai notar.");
TogglePlayerControllable(playerid, 1);
}
}
else if(IsAPlane(newcar))
{
if(PlayerInfo[playerid][pFlyLic] < 1)
{
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem licenca de voф, diriga com cuidado ou a policia vai notar.");
TogglePlayerControllable(playerid, 1); }
}
}
else
{
if(PlayerInfo[playerid][pCarLic] < 0)
{
if(PlayerDrunk[playerid] >= 5)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "Dirigir embriagado");
}
}
else if(PlayerDrunk[playerid] >= 5)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "dirigir embriagado");
}
if(PlayerInfo[playerid][pCarLic] < 1)
{
if(IsABike(newcar) || IsAOBike(newcar)) { }
else
{
/*if(PlayerInfo[playerid][pCarLic] < 1)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "Driving without License");
}*/
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem carta ainda, dirige com cuidado ou a polнcia vai notar");
}
}
}
}//Done with car check
if(IsACopCar(newcar))
{
if(IsACop(playerid)) { }
else { RemovePlayerFromVehicle(playerid); }
}
if(IsATank(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pLeader] == 3) { }
else { RemovePlayerFromVehicle(playerid); }
}
if(IsAnFbiCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsNgCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsAGovernmentCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3||PlayerInfo[playerid][pLeader] == 7||PlayerInfo[playerid][pMember] == 7) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsAHspdCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] > 2) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
else if(IsAnAmbulance(newcar))
{
if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4) { }
else { RemovePlayerFromVehicle(playerid); }
}
/*if(IsAGangCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 5||PlayerInfo[playerid][pMember] == 5) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar2(newcar))
{
if(PlayerInfo[playerid][pLeader] == 6||PlayerInfo[playerid][pMember] == 6) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar3(newcar))
{
if(PlayerInfo[playerid][pLeader] == 14||PlayerInfo[playerid][pMember] == 14) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar4(newcar))
{
if(PlayerInfo[playerid][pLeader] == 15||PlayerInfo[playerid][pMember] == 15) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar5(newcar))
{
if(PlayerInfo[playerid][pLeader] == 16||PlayerInfo[playerid][pMember] == 16) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}*/
if(IsAPizzabike(newcar))
{
if(PlayerInfo[playerid][pJob] == 17) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves desta moto.");}
}
if(IsABus(newcar))
{
if(PlayerInfo[playerid][pJob] == 14)
{
GameTextForPlayer(playerid, "~w~Usa /comecaraleste ou /comecaraoeste para comecar a sua rota de autocarro", 5000, 3);
SendClientMessage(playerid, COLOR_GREEN, "Vocк jб entrou num autocarro, usa /sair para cancelar a seleзгo de rota.");
//GangZoneShowForPlayer(playerid, buszonewest, COLOR_RED);
//GangZoneShowForPlayer(playerid, buszoneeast, COLOR_BLUE);
SendClientMessage(playerid, COLOR_GREEN, "Para comeзar a fazer a rota oeste, usa /comecaraoeste. Para comeзar a fazer a rota leste, usa /comecaraleste.");
new routezonecheck = IsInBusrouteZone(playerid);
if (routezonecheck == 0) SendClientMessage(playerid, COLOR_GREEN, "Nota: O prуximo caminho й o leste.");
else if (routezonecheck == 1) SendClientMessage(playerid, COLOR_GREEN, "Nota: O caminho mais prуximo fica a oeste.");
TogglePlayerControllable(playerid, 0);
}
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do autocarro.");}
}
if(IsATowcar(newcar))
{
if(PlayerInfo[playerid][pJob] == 7) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsATruck(newcar))
{
if(PlayerInfo[playerid][pJob] == 16)
{
format(string, sizeof(string), "Produtos: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
SendClientMessage(playerid, COLOR_GREEN, "INFO: Vocк pode fornecer produtos para as empresas.");
SendClientMessage(playerid, COLOR_GREEN, "INFO: Comandos sao: /carga /comprarprodutos /venderprodutos");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");
}
}
if(IsASweeper(newcar))
{
if(PlayerInfo[playerid][pJob] == 21)
{
if(PlayerIsSweeping[playerid] == 0)
{
}
else
{
}
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");
}
}
if(PlayerKarting[playerid] != 0)
{
new kart = GetPlayerVehicleID(playerid);
if(kart >=78 && kart <= 83)
{
PlayerInKart[playerid] = 1;
KartingPlayers ++;
}
}
if(newcar >= 131 && newcar <= 134)
{
SendClientMessage(playerid,COLOR_RED," (( O teste de conduзгo estб desativado )) ");
}
if(newcar == 167)
{
SendClientMessage(playerid,COLOR_RED," (( O teste de vфo estб desativado )) ");
RemovePlayerFromVehicle(playerid);
}
if(newcar == 166)
{
if(PlayerInfo[playerid][pMember] == 4) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do caminhгo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar == 38)
{
if(PlayerInfo[playerid][pRank] >= 3) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк deve estar pelo menos Rank 3 para fazer isso! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 96 && newcar <= 98)
{
if(PlayerInfo[playerid][pJob] != 16)
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do caminhгo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 61 && newcar <= 70)
{
if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do veiculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 71 && newcar <= 73)
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9){ }
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veiculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 78 && newcar <= 83)
{
if(PlayerKarting[playerid] != 1)
{
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 135 && newcar <= 154)
{
if (HireCar[playerid] != newcar)
{
format(string, sizeof(string), "~w~Vocк pode alugar este carro~n~Costo:~g~$500~n~~w~Para alugar usa ~g~/alugarveiculo~w~~n~Para sair usa ~r~/sair");
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
if(newcar >= 112 && newcar <= 130)
{
if (HireCar[playerid] != newcar)
{
format(string, sizeof(string), "~w~Vocк pode alugar esta bicicleta~n~Costo:~g~$%d~n~~w~Para alugar usa ~g~/alugarbicicleta~w~~n~Para sair usa ~r~/sair",SBizzInfo[0][sbEntranceCost]);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
if(newcar >= 56 && newcar <= 58)
{
if(PlayerInfo[playerid][pMember] == 8||PlayerInfo[playerid][pLeader] == 8) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsAHarvest(newcar))
{
if(PlayerInfo[playerid][pJob] == 18)
{
if(FarmerVar[playerid] == 0)
{
SendClientMessage(playerid, COLOR_BLUE, "___________Guia Agricultor______________________________");
SendClientMessage(playerid, COLOR_BLUE, "** Agricultor ** /iniciarcolheita, /pararcolheita, /sair");
SendClientMessage(playerid, COLOR_BLUE, "________________________________________________________");
TogglePlayerControllable(playerid, 0);
}
else { }
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsADrugHarvest(newcar))
{
if(PlayerInfo[playerid][pJob] == 19)
{
SendClientMessage(playerid, COLOR_BLUE, "___________________________Guia Fabricante de Droga_____________________________");
SendClientMessage(playerid, COLOR_BLUE, "** Fabricante de Droga ** /iniciarcolheitadedroga, /pararcolheitadedroga, /sair");
SendClientMessage(playerid, COLOR_BLUE, "________________________________________________________________________________");
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsASmuggleCar(newcar))
{
if(PlayerInfo[playerid][pJob] == 20)
{
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
SendClientMessage(playerid, COLOR_GREEN, "DICA: Vocк pode contrabandear drogas agora!");
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(oldcar != 301)
{
if((housecar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != housecar))
{
if(gLastDriver[oldcar] == playerid && oldcar != newcar)
{
gLastDriver[oldcar] = 300;
gCarLock[oldcar] = 0;
UnLockCar(oldcar);
}
}
}
if(IsAnOwnableCar(newcar))
{
if(CarInfo[newcar][cOwned]==0)
{
TogglePlayerControllable(playerid, 0);
format(string,sizeof(string),"~w~Veнculo: %s~n~Preзo: ~g~%d~n~~w~/v comprar para comprar este Veнculo~n~~r~/sair ~w~para sair do carro",CarInfo[newcar][cDescription],CarInfo[newcar][cValue]);
GameTextForPlayer(playerid,string,5000,5);
}
if(CarInfo[newcar][cOwned]==1)
{
format(string,sizeof(string),"Veнculo Registado por %s",CarInfo[newcar][cOwner]);
SendClientMessage(playerid, COLOR_BLUE, string);
/*if(keycar != vehicle)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You don't have a key of this vehicle");
}*/
if(PlayerInfo[playerid][pPcarkey] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }
else
{
if(PlayerInfo[playerid][pAdmin] >= 1 && AdminDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_BLUE, " Vocк pode conduzir este carro, porque vocк й o administrador/GameMaster ");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem a chave deste veнculo");
}
}
}
}
gLastCar[playerid] = newcar;
gLastDriver[newcar] = playerid;
}
if(newstate == PLAYER_STATE_SPAWNED)
{
new Float: lwx, Float:lwy, Float:lwz;
GetPlayerPos(playerid, lwx, lwy, lwz);
if((lwz > 530.0 && PlayerInfo[playerid][pInt] == 0) || PlayerToPoint(1000.0, playerid, -1041.9,-1868.4,79.1)) //the highest land point in sa = 526.8
{
SetPlayerSpawn(playerid);
}
if(WantedPoints[playerid] > 0)
{
new dstring[128];
new wanted = WantedPoints[playerid];
new diecash = 0;
while(WantedPoints[playerid] > 0)
{
diecash += 500;
WantedPoints[playerid] --;
}
format(dstring, sizeof(dstring), "Vocк perdeu $%d por morrer %d Pontos Espontвneos.", diecash, wanted);
SendClientMessage(playerid, COLOR_RED, dstring);
SafeGivePlayerMoney(playerid, - diecash);
PlayerInfo[playerid][pWantedDeaths] += 1;
}
if(PlayerOnMission[playerid] > 0)
{
GameTextForPlayer(playerid, "~r~Missгo falhada", 5000, 3);
PlayerOnMission[playerid] = 0;
PlayerInfo[playerid][pMissionNr] = 0;
}
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
if(PlayerInfo[playerid][pDonateRank] > 0) { SetPlayerHealth(playerid, 100.0); }
else { SetPlayerHealth(playerid, 50.0+PlayerInfo[playerid][pSHealth]); }
MedicBill[playerid] = 1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
gPlayerSpawned[playerid] = 1;
SafeTime[playerid] = 60;
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
#define vehicleid GetPlayerVehicleID(playerid)
if(newstate == PLAYER_STATE_DRIVER)
{
if (vehicleid == 44)
{
AttachObjectToVehicle(18648, 44, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(18648, 44, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "ii", playerid);
}
else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "ii", playerid);
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
{
PlayerInKart[playerid] = 0;
KartingPlayers --;
}
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}
TransportDuty[playerid] = 0;
format(string, sizeof(string), "* Vocк estб agora fora de serviзo $%d *", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, string);
SafeGivePlayerMoney(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~O custo de viagem~n~~r~$%d",TransportCost[playerid]);
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "~w~Passageiro saiu do tбxi~n~~g~Ganhaste: $%d",TransportCost[playerid]);
GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
SafeGivePlayerMoney(playerid, -TransportCost[playerid]);
TransportCost[playerid] = 0;
TransportTime[playerid] = 0;
TransportDriver[playerid] = 999;
}
}
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
}
if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
{
if(GetPlayerMoney(playerid) < TransportValue[i])
{
format(string, sizeof(string), "* Vocк precisa $%d para entrar.", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
RemovePlayerFromVehicle(playerid);
}
else
{
if(TransportDuty[i] == 1)
{
format(string, sizeof(string), "* Vocк pagou $%d ao taxista.", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "* Passageiro %s entrou no seu taxi.", name);
SendClientMessage(i, COLOR_GREEN, 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), "* Vocк pagou $%d ao camionista .", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "* Passageiro %s entrou no seu autocarro.", name);
SendClientMessage(i, COLOR_GREEN, string);
}
SafeGivePlayerMoney(playerid, - TransportValue[i]);
TransportMoney[i] += TransportValue[i];
}
}
}
}
}
if(newstate == PLAYER_STATE_WASTED)
{
if(WantedLevel[playerid] >= 1)
{
new price = WantedLevel[playerid] * 1000;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
{
count = 1;
format(string, sizeof(string), "~w~execuзгo suspeito~r~Assassinado~n~Bфnus~g~$%d", price);
GameTextForPlayer(i, string, 5000, 1);
//ConsumingMoney[i] = 1;
SafeGivePlayerMoney(i, price / 2);
PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
}
}
}
if(count == 1)
{
SafeGivePlayerMoney(playerid, - price);
PlayerInfo[playerid][pWantedDeaths] += 1;
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(600);
format(string, sizeof(string), "* Foste para a prisгo porque cometeste um crime", PlayerInfo[playerid][pJailTime], price);
SendClientMessage(playerid, COLOR_RED, string);
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{// 38 / 49 / 56 = SS
new newcar = GetPlayerVehicleID(playerid);
new oldcar = gLastCar[playerid];
new housecar = PlayerInfo[playerid][pPhousekey]+1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
if(IsABoat(newcar))
{
if(PlayerInfo[playerid][pBoatLic] < 1)
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem licenca de vela, diriga com cuidado ou a policia vai notar.");
TogglePlayerControllable(playerid, 1);
}
}
else if(IsAPlane(newcar))
{
if(PlayerInfo[playerid][pFlyLic] < 1)
{
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem licenca de voф, diriga com cuidado ou a policia vai notar.");
TogglePlayerControllable(playerid, 1); }
}
}
else
{
if(PlayerInfo[playerid][pCarLic] < 0)
{
if(PlayerDrunk[playerid] >= 5)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "Dirigir embriagado");
}
}
else if(PlayerDrunk[playerid] >= 5)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "dirigir embriagado");
}
if(PlayerInfo[playerid][pCarLic] < 1)
{
if(IsABike(newcar) || IsAOBike(newcar)) { }
else
{
/*if(PlayerInfo[playerid][pCarLic] < 1)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "Driving without License");
}*/
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem carta ainda, dirige com cuidado ou a polнcia vai notar");
}
}
}
}//Done with car check
if(IsACopCar(newcar))
{
if(IsACop(playerid)) { }
else { RemovePlayerFromVehicle(playerid); }
}
if(IsATank(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pLeader] == 3) { }
else { RemovePlayerFromVehicle(playerid); }
}
if(IsAnFbiCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsNgCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsAGovernmentCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3||PlayerInfo[playerid][pLeader] == 7||PlayerInfo[playerid][pMember] == 7) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsAHspdCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] > 2) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
else if(IsAnAmbulance(newcar))
{
if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4) { }
else { RemovePlayerFromVehicle(playerid); }
}
/*if(IsAGangCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 5||PlayerInfo[playerid][pMember] == 5) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar2(newcar))
{
if(PlayerInfo[playerid][pLeader] == 6||PlayerInfo[playerid][pMember] == 6) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar3(newcar))
{
if(PlayerInfo[playerid][pLeader] == 14||PlayerInfo[playerid][pMember] == 14) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar4(newcar))
{
if(PlayerInfo[playerid][pLeader] == 15||PlayerInfo[playerid][pMember] == 15) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar5(newcar))
{
if(PlayerInfo[playerid][pLeader] == 16||PlayerInfo[playerid][pMember] == 16) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}*/
if(IsAPizzabike(newcar))
{
if(PlayerInfo[playerid][pJob] == 17) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves desta moto.");}
}
if(IsABus(newcar))
{
if(PlayerInfo[playerid][pJob] == 14)
{
GameTextForPlayer(playerid, "~w~Usa /comecaraleste ou /comecaraoeste para comecar a sua rota de autocarro", 5000, 3);
SendClientMessage(playerid, COLOR_GREEN, "Vocк jб entrou num autocarro, usa /sair para cancelar a seleзгo de rota.");
//GangZoneShowForPlayer(playerid, buszonewest, COLOR_RED);
//GangZoneShowForPlayer(playerid, buszoneeast, COLOR_BLUE);
SendClientMessage(playerid, COLOR_GREEN, "Para comeзar a fazer a rota oeste, usa /comecaraoeste. Para comeзar a fazer a rota leste, usa /comecaraleste.");
new routezonecheck = IsInBusrouteZone(playerid);
if (routezonecheck == 0) SendClientMessage(playerid, COLOR_GREEN, "Nota: O prуximo caminho й o leste.");
else if (routezonecheck == 1) SendClientMessage(playerid, COLOR_GREEN, "Nota: O caminho mais prуximo fica a oeste.");
TogglePlayerControllable(playerid, 0);
}
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do autocarro.");}
}
if(IsATowcar(newcar))
{
if(PlayerInfo[playerid][pJob] == 7) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsATruck(newcar))
{
if(PlayerInfo[playerid][pJob] == 16)
{
format(string, sizeof(string), "Produtos: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
SendClientMessage(playerid, COLOR_GREEN, "INFO: Vocк pode fornecer produtos para as empresas.");
SendClientMessage(playerid, COLOR_GREEN, "INFO: Comandos sao: /carga /comprarprodutos /venderprodutos");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");
}
}
if(IsASweeper(newcar))
{
if(PlayerInfo[playerid][pJob] == 21)
{
if(PlayerIsSweeping[playerid] == 0)
{
}
else
{
}
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");
}
}
if(PlayerKarting[playerid] != 0)
{
new kart = GetPlayerVehicleID(playerid);
if(kart >=78 && kart <= 83)
{
PlayerInKart[playerid] = 1;
KartingPlayers ++;
}
}
if(newcar >= 131 && newcar <= 134)
{
SendClientMessage(playerid,COLOR_RED," (( O teste de conduзгo estб desativado )) ");
}
if(newcar == 167)
{
SendClientMessage(playerid,COLOR_RED," (( O teste de vфo estб desativado )) ");
RemovePlayerFromVehicle(playerid);
}
if(newcar == 166)
{
if(PlayerInfo[playerid][pMember] == 4) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do caminhгo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar == 38)
{
if(PlayerInfo[playerid][pRank] >= 3) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк deve estar pelo menos Rank 3 para fazer isso! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 96 && newcar <= 98)
{
if(PlayerInfo[playerid][pJob] != 16)
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do caminhгo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 61 && newcar <= 70)
{
if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do veiculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 71 && newcar <= 73)
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9){ }
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veiculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 78 && newcar <= 83)
{
if(PlayerKarting[playerid] != 1)
{
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 135 && newcar <= 154)
{
if (HireCar[playerid] != newcar)
{
format(string, sizeof(string), "~w~Vocк pode alugar este carro~n~Costo:~g~$500~n~~w~Para alugar usa ~g~/alugarveiculo~w~~n~Para sair usa ~r~/sair");
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
if(newcar >= 112 && newcar <= 130)
{
if (HireCar[playerid] != newcar)
{
format(string, sizeof(string), "~w~Vocк pode alugar esta bicicleta~n~Costo:~g~$%d~n~~w~Para alugar usa ~g~/alugarbicicleta~w~~n~Para sair usa ~r~/sair",SBizzInfo[0][sbEntranceCost]);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
if(newcar >= 56 && newcar <= 58)
{
if(PlayerInfo[playerid][pMember] == 8||PlayerInfo[playerid][pLeader] == 8) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsAHarvest(newcar))
{
if(PlayerInfo[playerid][pJob] == 18)
{
if(FarmerVar[playerid] == 0)
{
SendClientMessage(playerid, COLOR_BLUE, "___________Guia Agricultor______________________________");
SendClientMessage(playerid, COLOR_BLUE, "** Agricultor ** /iniciarcolheita, /pararcolheita, /sair");
SendClientMessage(playerid, COLOR_BLUE, "________________________________________________________");
TogglePlayerControllable(playerid, 0);
}
else { }
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsADrugHarvest(newcar))
{
if(PlayerInfo[playerid][pJob] == 19)
{
SendClientMessage(playerid, COLOR_BLUE, "___________________________Guia Fabricante de Droga_____________________________");
SendClientMessage(playerid, COLOR_BLUE, "** Fabricante de Droga ** /iniciarcolheitadedroga, /pararcolheitadedroga, /sair");
SendClientMessage(playerid, COLOR_BLUE, "________________________________________________________________________________");
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsASmuggleCar(newcar))
{
if(PlayerInfo[playerid][pJob] == 20)
{
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
SendClientMessage(playerid, COLOR_GREEN, "DICA: Vocк pode contrabandear drogas agora!");
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(oldcar != 301)
{
if((housecar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != housecar))
{
if(gLastDriver[oldcar] == playerid && oldcar != newcar)
{
gLastDriver[oldcar] = 300;
gCarLock[oldcar] = 0;
UnLockCar(oldcar);
}
}
}
if(IsAnOwnableCar(newcar))
{
if(CarInfo[newcar][cOwned]==0)
{
TogglePlayerControllable(playerid, 0);
format(string,sizeof(string),"~w~Veнculo: %s~n~Preзo: ~g~%d~n~~w~/v comprar para comprar este Veнculo~n~~r~/sair ~w~para sair do carro",CarInfo[newcar][cDescription],CarInfo[newcar][cValue]);
GameTextForPlayer(playerid,string,5000,5);
}
if(CarInfo[newcar][cOwned]==1)
{
format(string,sizeof(string),"Veнculo Registado por %s",CarInfo[newcar][cOwner]);
SendClientMessage(playerid, COLOR_BLUE, string);
/*if(keycar != vehicle)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You don't have a key of this vehicle");
}*/
if(PlayerInfo[playerid][pPcarkey] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }
else
{
if(PlayerInfo[playerid][pAdmin] >= 1 && AdminDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_BLUE, " Vocк pode conduzir este carro, porque vocк й o administrador/GameMaster ");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem a chave deste veнculo");
}
}
}
}
gLastCar[playerid] = newcar;
gLastDriver[newcar] = playerid;
}
if(newstate == PLAYER_STATE_SPAWNED)
{
new Float: lwx, Float:lwy, Float:lwz;
GetPlayerPos(playerid, lwx, lwy, lwz);
if((lwz > 530.0 && PlayerInfo[playerid][pInt] == 0) || PlayerToPoint(1000.0, playerid, -1041.9,-1868.4,79.1)) //the highest land point in sa = 526.8
{
SetPlayerSpawn(playerid);
}
if(WantedPoints[playerid] > 0)
{
new dstring[128];
new wanted = WantedPoints[playerid];
new diecash = 0;
while(WantedPoints[playerid] > 0)
{
diecash += 500;
WantedPoints[playerid] --;
}
format(dstring, sizeof(dstring), "Vocк perdeu $%d por morrer %d Pontos Espontвneos.", diecash, wanted);
SendClientMessage(playerid, COLOR_RED, dstring);
SafeGivePlayerMoney(playerid, - diecash);
PlayerInfo[playerid][pWantedDeaths] += 1;
}
if(PlayerOnMission[playerid] > 0)
{
GameTextForPlayer(playerid, "~r~Missгo falhada", 5000, 3);
PlayerOnMission[playerid] = 0;
PlayerInfo[playerid][pMissionNr] = 0;
}
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
if(PlayerInfo[playerid][pDonateRank] > 0) { SetPlayerHealth(playerid, 100.0); }
else { SetPlayerHealth(playerid, 50.0+PlayerInfo[playerid][pSHealth]); }
MedicBill[playerid] = 1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
gPlayerSpawned[playerid] = 1;
SafeTime[playerid] = 60;
}
return 1;
}
#define vehicleid GetPlayerVehicleID(playerid)
if(newstate == PLAYER_STATE_DRIVER)
{
if (vehicleid == 44)
{
AttachObjectToVehicle(18648, 44, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
AttachObjectToVehicle(18648, 44, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "ii", playerid);
}
else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid) && !IsAPlane(vehicle) && !IsAHarvest(vehicle) && !IsADrugHarvest(vehicle) && !IsASweeper(vehicle))
{
SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
SetTimerEx("engine2", 2500, false, "ii", playerid);
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
{
PlayerInKart[playerid] = 0;
KartingPlayers --;
}
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
}
else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}
TransportDuty[playerid] = 0;
format(string, sizeof(string), "* Vocк estб agora fora de serviзo $%d *", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_YELLOW, string);
SafeGivePlayerMoney(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~O custo de viagem~n~~r~$%d",TransportCost[playerid]);
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "~w~Passageiro saiu do tбxi~n~~g~Ganhaste: $%d",TransportCost[playerid]);
GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
SafeGivePlayerMoney(playerid, -TransportCost[playerid]);
TransportCost[playerid] = 0;
TransportTime[playerid] = 0;
TransportDriver[playerid] = 999;
}
}
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
}
if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
{
if(GetPlayerMoney(playerid) < TransportValue[i])
{
format(string, sizeof(string), "* Vocк precisa $%d para entrar.", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
RemovePlayerFromVehicle(playerid);
}
else
{
if(TransportDuty[i] == 1)
{
format(string, sizeof(string), "* Vocк pagou $%d ao taxista.", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "* Passageiro %s entrou no seu taxi.", name);
SendClientMessage(i, COLOR_GREEN, 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), "* Vocк pagou $%d ao camionista .", TransportValue[i]);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "* Passageiro %s entrou no seu autocarro.", name);
SendClientMessage(i, COLOR_GREEN, string);
}
SafeGivePlayerMoney(playerid, - TransportValue[i]);
TransportMoney[i] += TransportValue[i];
}
}
}
}
}
if(newstate == PLAYER_STATE_WASTED)
{
if(WantedLevel[playerid] >= 1)
{
new price = WantedLevel[playerid] * 1000;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == 2 && CrimInRange(30.0, playerid,i))
{
count = 1;
format(string, sizeof(string), "~w~execuзгo suspeito~r~Assassinado~n~Bфnus~g~$%d", price);
GameTextForPlayer(i, string, 5000, 1);
//ConsumingMoney[i] = 1;
SafeGivePlayerMoney(i, price / 2);
PlayerPlaySound(i, 1058, 0.0, 0.0, 0.0);
}
}
}
if(count == 1)
{
SafeGivePlayerMoney(playerid, - price);
PlayerInfo[playerid][pWantedDeaths] += 1;
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = (WantedLevel[playerid])*(600);
format(string, sizeof(string), "* Foste para a prisгo porque cometeste um crime", PlayerInfo[playerid][pJailTime], price);
SendClientMessage(playerid, COLOR_RED, string);
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{// 38 / 49 / 56 = SS
new newcar = GetPlayerVehicleID(playerid);
new oldcar = gLastCar[playerid];
new housecar = PlayerInfo[playerid][pPhousekey]+1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
if(IsABoat(newcar))
{
if(PlayerInfo[playerid][pBoatLic] < 1)
{
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem licenca de vela, diriga com cuidado ou a policia vai notar.");
TogglePlayerControllable(playerid, 1);
}
}
else if(IsAPlane(newcar))
{
if(PlayerInfo[playerid][pFlyLic] < 1)
{
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem licenca de voф, diriga com cuidado ou a policia vai notar.");
TogglePlayerControllable(playerid, 1); }
}
}
else
{
if(PlayerInfo[playerid][pCarLic] < 0)
{
if(PlayerDrunk[playerid] >= 5)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "Dirigir embriagado");
}
}
else if(PlayerDrunk[playerid] >= 5)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "dirigir embriagado");
}
if(PlayerInfo[playerid][pCarLic] < 1)
{
if(IsABike(newcar) || IsAOBike(newcar)) { }
else
{
/*if(PlayerInfo[playerid][pCarLic] < 1)
{
WantedPoints[playerid] += 1;
SetPlayerCriminal(playerid,255, "Driving without License");
}*/
if(TakingLesson[playerid] == 1) { }
else {
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem carta ainda, dirige com cuidado ou a polнcia vai notar");
}
}
}
}//Done with car check
if(IsACopCar(newcar))
{
if(IsACop(playerid)) { }
else { RemovePlayerFromVehicle(playerid); }
}
if(IsATank(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pLeader] == 3) { }
else { RemovePlayerFromVehicle(playerid); }
}
if(IsAnFbiCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsNgCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsAGovernmentCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 2||PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 3||PlayerInfo[playerid][pMember] == 3||PlayerInfo[playerid][pLeader] == 7||PlayerInfo[playerid][pMember] == 7) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsAHspdCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 1||PlayerInfo[playerid][pMember] == 1 && PlayerInfo[playerid][pRank] > 2) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
else if(IsAnAmbulance(newcar))
{
if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4) { }
else { RemovePlayerFromVehicle(playerid); }
}
/*if(IsAGangCar(newcar))
{
if(PlayerInfo[playerid][pLeader] == 5||PlayerInfo[playerid][pMember] == 5) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar2(newcar))
{
if(PlayerInfo[playerid][pLeader] == 6||PlayerInfo[playerid][pMember] == 6) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar3(newcar))
{
if(PlayerInfo[playerid][pLeader] == 14||PlayerInfo[playerid][pMember] == 14) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar4(newcar))
{
if(PlayerInfo[playerid][pLeader] == 15||PlayerInfo[playerid][pMember] == 15) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
if(IsAGangCar5(newcar))
{
if(PlayerInfo[playerid][pLeader] == 16||PlayerInfo[playerid][pMember] == 16) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}*/
if(IsAPizzabike(newcar))
{
if(PlayerInfo[playerid][pJob] == 17) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves desta moto.");}
}
if(IsABus(newcar))
{
if(PlayerInfo[playerid][pJob] == 14)
{
GameTextForPlayer(playerid, "~w~Usa /comecaraleste ou /comecaraoeste para comecar a sua rota de autocarro", 5000, 3);
SendClientMessage(playerid, COLOR_GREEN, "Vocк jб entrou num autocarro, usa /sair para cancelar a seleзгo de rota.");
//GangZoneShowForPlayer(playerid, buszonewest, COLOR_RED);
//GangZoneShowForPlayer(playerid, buszoneeast, COLOR_BLUE);
SendClientMessage(playerid, COLOR_GREEN, "Para comeзar a fazer a rota oeste, usa /comecaraoeste. Para comeзar a fazer a rota leste, usa /comecaraleste.");
new routezonecheck = IsInBusrouteZone(playerid);
if (routezonecheck == 0) SendClientMessage(playerid, COLOR_GREEN, "Nota: O prуximo caminho й o leste.");
else if (routezonecheck == 1) SendClientMessage(playerid, COLOR_GREEN, "Nota: O caminho mais prуximo fica a oeste.");
TogglePlayerControllable(playerid, 0);
}
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do autocarro.");}
}
if(IsATowcar(newcar))
{
if(PlayerInfo[playerid][pJob] == 7) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");}
}
if(IsATruck(newcar))
{
if(PlayerInfo[playerid][pJob] == 16)
{
format(string, sizeof(string), "Produtos: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
SendClientMessage(playerid, COLOR_GREEN, "INFO: Vocк pode fornecer produtos para as empresas.");
SendClientMessage(playerid, COLOR_GREEN, "INFO: Comandos sao: /carga /comprarprodutos /venderprodutos");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");
}
}
if(IsASweeper(newcar))
{
if(PlayerInfo[playerid][pJob] == 21)
{
if(PlayerIsSweeping[playerid] == 0)
{
}
else
{
}
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED,"Vocк nгo tem as chaves do veнculo.");
}
}
if(PlayerKarting[playerid] != 0)
{
new kart = GetPlayerVehicleID(playerid);
if(kart >=78 && kart <= 83)
{
PlayerInKart[playerid] = 1;
KartingPlayers ++;
}
}
if(newcar >= 131 && newcar <= 134)
{
SendClientMessage(playerid,COLOR_RED," (( O teste de conduзгo estб desativado )) ");
}
if(newcar == 167)
{
SendClientMessage(playerid,COLOR_RED," (( O teste de vфo estб desativado )) ");
RemovePlayerFromVehicle(playerid);
}
if(newcar == 166)
{
if(PlayerInfo[playerid][pMember] == 4) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do caminhгo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar == 38)
{
if(PlayerInfo[playerid][pRank] >= 3) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк deve estar pelo menos Rank 3 para fazer isso! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 96 && newcar <= 98)
{
if(PlayerInfo[playerid][pJob] != 16)
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do caminhгo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 61 && newcar <= 70)
{
if(PlayerInfo[playerid][pMember] == 10||PlayerInfo[playerid][pLeader] == 10) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do veiculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 71 && newcar <= 73)
{
if(PlayerInfo[playerid][pMember] == 9 || PlayerInfo[playerid][pLeader] == 9){ }
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veiculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 78 && newcar <= 83)
{
if(PlayerKarting[playerid] != 1)
{
RemovePlayerFromVehicle(playerid);
}
}
if(newcar >= 135 && newcar <= 154)
{
if (HireCar[playerid] != newcar)
{
format(string, sizeof(string), "~w~Vocк pode alugar este carro~n~Costo:~g~$500~n~~w~Para alugar usa ~g~/alugarveiculo~w~~n~Para sair usa ~r~/sair");
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
if(newcar >= 112 && newcar <= 130)
{
if (HireCar[playerid] != newcar)
{
format(string, sizeof(string), "~w~Vocк pode alugar esta bicicleta~n~Costo:~g~$%d~n~~w~Para alugar usa ~g~/alugarbicicleta~w~~n~Para sair usa ~r~/sair",SBizzInfo[0][sbEntranceCost]);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, string, 5000, 3);
}
}
if(newcar >= 56 && newcar <= 58)
{
if(PlayerInfo[playerid][pMember] == 8||PlayerInfo[playerid][pLeader] == 8) { }
else
{
SendClientMessage(playerid,COLOR_RED," Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsAHarvest(newcar))
{
if(PlayerInfo[playerid][pJob] == 18)
{
if(FarmerVar[playerid] == 0)
{
SendClientMessage(playerid, COLOR_BLUE, "___________Guia Agricultor______________________________");
SendClientMessage(playerid, COLOR_BLUE, "** Agricultor ** /iniciarcolheita, /pararcolheita, /sair");
SendClientMessage(playerid, COLOR_BLUE, "________________________________________________________");
TogglePlayerControllable(playerid, 0);
}
else { }
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsADrugHarvest(newcar))
{
if(PlayerInfo[playerid][pJob] == 19)
{
SendClientMessage(playerid, COLOR_BLUE, "___________________________Guia Fabricante de Droga_____________________________");
SendClientMessage(playerid, COLOR_BLUE, "** Fabricante de Droga ** /iniciarcolheitadedroga, /pararcolheitadedroga, /sair");
SendClientMessage(playerid, COLOR_BLUE, "________________________________________________________________________________");
TogglePlayerControllable(playerid, 0);
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(IsASmuggleCar(newcar))
{
if(PlayerInfo[playerid][pJob] == 20)
{
if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
SendClientMessage(playerid, COLOR_GREEN, "DICA: Vocк pode contrabandear drogas agora!");
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, " Vocк nгo tem as chaves do veнculo! ");
RemovePlayerFromVehicle(playerid);
}
}
if(oldcar != 301)
{
if((housecar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != housecar))
{
if(gLastDriver[oldcar] == playerid && oldcar != newcar)
{
gLastDriver[oldcar] = 300;
gCarLock[oldcar] = 0;
UnLockCar(oldcar);
}
}
}
if(IsAnOwnableCar(newcar))
{
if(CarInfo[newcar][cOwned]==0)
{
TogglePlayerControllable(playerid, 0);
format(string,sizeof(string),"~w~Veнculo: %s~n~Preзo: ~g~%d~n~~w~/v comprar para comprar este Veнculo~n~~r~/sair ~w~para sair do carro",CarInfo[newcar][cDescription],CarInfo[newcar][cValue]);
GameTextForPlayer(playerid,string,5000,5);
}
if(CarInfo[newcar][cOwned]==1)
{
format(string,sizeof(string),"Veнculo Registado por %s",CarInfo[newcar][cOwner]);
SendClientMessage(playerid, COLOR_BLUE, string);
/*if(keycar != vehicle)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You don't have a key of this vehicle");
}*/
if(PlayerInfo[playerid][pPcarkey] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey2] == vehicle) { }
else if(PlayerInfo[playerid][pPcarkey3] == vehicle) { }
else
{
if(PlayerInfo[playerid][pAdmin] >= 1 && AdminDuty[playerid] == 1)
{
SendClientMessage(playerid, COLOR_BLUE, " Vocк pode conduzir este carro, porque vocк й o administrador/GameMaster ");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, "Vocк nгo tem a chave deste veнculo");
}
}
}
}
gLastCar[playerid] = newcar;
gLastDriver[newcar] = playerid;
}
if(newstate == PLAYER_STATE_SPAWNED)
{
new Float: lwx, Float:lwy, Float:lwz;
GetPlayerPos(playerid, lwx, lwy, lwz);
if((lwz > 530.0 && PlayerInfo[playerid][pInt] == 0) || PlayerToPoint(1000.0, playerid, -1041.9,-1868.4,79.1)) //the highest land point in sa = 526.8
{
SetPlayerSpawn(playerid);
}
if(WantedPoints[playerid] > 0)
{
new dstring[128];
new wanted = WantedPoints[playerid];
new diecash = 0;
while(WantedPoints[playerid] > 0)
{
diecash += 500;
WantedPoints[playerid] --;
}
format(dstring, sizeof(dstring), "Vocк perdeu $%d por morrer %d Pontos Espontвneos.", diecash, wanted);
SendClientMessage(playerid, COLOR_RED, dstring);
SafeGivePlayerMoney(playerid, - diecash);
PlayerInfo[playerid][pWantedDeaths] += 1;
}
if(PlayerOnMission[playerid] > 0)
{
GameTextForPlayer(playerid, "~r~Missгo falhada", 5000, 3);
PlayerOnMission[playerid] = 0;
PlayerInfo[playerid][pMissionNr] = 0;
}
WantedPoints[playerid] = 0;
WantedLevel[playerid] = 0;
if(PlayerInfo[playerid][pDonateRank] > 0) { SetPlayerHealth(playerid, 100.0); }
else { SetPlayerHealth(playerid, 50.0+PlayerInfo[playerid][pSHealth]); }
MedicBill[playerid] = 1;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
gPlayerSpawned[playerid] = 1;
SafeTime[playerid] = 60;
}
return 1;
}