30.04.2015, 22:53
No RespawnCivil Quando Pegar o Carro , e ligar motor , qeria q nao precisa-se de Licenca . alguem me ajuda ?
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[300];
new gstring[128];
new vehicleid = GetPlayerVehicleID(playerid);
s_tate[playerid] = newstate;
if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
if(GetPVarInt(playerid, "VarFPS"))
{
if(IsValidObject(dcObject[playerid])==1)DestroyObject(dcObject[playerid]);
SetCameraBehindPlayer(playerid);
SetPVarInt(playerid, "VarFPS", 0);
}
}
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(!TextShow[playerid])
{
ShowVelo(playerid);
TextShow[playerid] = true;
}
}
else
{
if(TextShow[playerid])
{
HideVelo(playerid);
TextShow[playerid] = false;
}
}
if(newstate == PLAYER_STATE_PASSENGER)
{
if (GetVehicleModel(vehicleid) == 431 || GetVehicleModel(vehicleid) == 437)
{
SendClientMessage(playerid, COLOR_YELLOW, "*Para ir ao Fundo do Onibus use /fundoonibus");
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
CheckChave(playerid, vehicleid);
if(PlayerHaul[vehicleid][pCapasity] > 49)
{
format(string, sizeof(string), "%d",PlayerHaul[vehicleid][pLoad]);
PlayerTextDrawSetString(playerid,Produtosnb[playerid], string);
format(string, sizeof(string), "%d",PlayerHaul[vehicleid][pCapasity]);
PlayerTextDrawSetString(playerid,MaxProdutosnb[playerid], string);
ShowCami(playerid);
}
if(IsAAlugHeli(GetPlayerVehicleID(playerid)))
{
if (HireCar[playerid] != vehicleid)
{
new Aluguelbox[256];
format(Aluguelbox, sizeof(Aluguelbox),"Esta Aeronave pode ser alugada Preзo:R$%d\nDeseja Aluga-la ?", SBizzInfo[15][sbEntranceCost]);
Controle(playerid, 0);
ShowPlayerDialog(playerid, DIALOG_ALUGAR2, DIALOG_STYLE_MSGBOX, "Aluguel de Aeronaves", Aluguelbox, "Sim", "Nгo");
}
}
if(IsARespCar(GetPlayerVehicleID(playerid)))
{
empmoney(playerid, 20, 50);
}
}
if(IsPlayerNPC(playerid)) return 1;
if(newstate != PLAYER_STATE_DRIVER)
{
SetPlayerTeam(playerid, GetPlayerOrg(playerid));
pvehicleid[playerid] = 0;
pmodelid[playerid] = 0;
if(MecanicMission[playerid])
EndMission(playerid);
if(PlayerInCorrida[playerid])
{
format(string, sizeof string, "*** %s saiu de seu carro de corrida e foi desclassificado.",NomePlayer(playerid));
foreach(Player, i)
{
if(PlayerInCorrida[i])
{
SendClientMessage(i, COLOR_LIGHTRED, string);
}
}
PlayerInCorrida[playerid] = false;
SetVehicleToRespawn(gLastCar[playerid]);
DisablePlayerRaceCheckpoint(playerid);
SetPlayerPos(playerid, SBizzInfo[25][sbEntranceX],SBizzInfo[25][sbEntranceY], SBizzInfo[25][sbEntranceZ]);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
}
}
if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 427)
{
if(GetPlayerVehicleSeat(playerid) == 2 || GetPlayerVehicleSeat(playerid) == 3)
{
if(Watching[playerid] == 0)
{
Inenforcer[playerid] = GetPlayerVehicleID(playerid);
SetPlayerVirtualWorld(playerid, Inenforcer[playerid]);
SetPlayerPos(playerid, 2084.479980, -1374.825928, 3000.628052);
SetPlayerFacingAngle(playerid, 0);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, 1);
}
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
HideCami(playerid);
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] && Spectate[i] == playerid)
{
PlayerSpectatePlayer(i, playerid);
}
}
if(Watching[playerid] > 0)
{
Watching[playerid] = 0;
}
if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
{
PlayerInKart[playerid] = 0;
KartingPlayers --;
}
if(TransportDuty[playerid] > 0)
{
if(TransportDuty[playerid] == 1)
{
TaxiDrivers -= 1;
HideTaxi(playerid);
}
else if(TransportDuty[playerid] == 2)
{
BusDrivers -= 1;
}
TransportDuty[playerid] = 0;
format(gstring, sizeof(gstring), "* Estб fora de serviзo, ganhou R$%d.", TransportMoney[playerid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, gstring);
GiveDinheiro(playerid, TransportMoney[playerid]);
PLO += TransportMoney[playerid];
DepositarOrgGrana(7,TransportMoney[playerid]);
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(gstring, sizeof(gstring), "~w~Custo da corrida~n~~r~R$%d",TransportCost[playerid]);
GameTextForPlayer(playerid, gstring, 5000, 1);
HideTaxi(playerid);
format(gstring, sizeof(gstring), "Taximetro:~r~0/0");
PlayerTextDrawSetString(TransportDriver[playerid],Taxim[TransportDriver[playerid]], gstring);
format(gstring, sizeof(gstring), "$00000");
PlayerTextDrawSetString(TransportDriver[playerid],ValorTaxi[TransportDriver[playerid]], gstring);
format(gstring, sizeof(gstring), "Passageiro:~n~~w~Ninguem");
PlayerTextDrawSetString(TransportDriver[playerid],passtaxi[TransportDriver[playerid]], gstring);
format(gstring, sizeof(gstring), "~w~Passageiro saiu do taxi~n~~g~ganhou R$%d",TransportCost[playerid]);
GameTextForPlayer(TransportDriver[playerid], gstring, 5000, 1);
GiveDinheiro(playerid, -TransportCost[playerid]);
TransportCost[playerid] = 0;
TransportTime[playerid] = 0;
TransportDriver[playerid] = 999;
}
}
}
if(newstate == PLAYER_STATE_PASSENGER) // TAXI, BUSSES, BOTS
{
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] && Spectate[i] == playerid)
{
PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
}
}
pvehicleid[playerid] = GetPlayerVehicleID(playerid);
pmodelid[playerid] = GetVehicleModel(pvehicleid[playerid]);
format(string, sizeof(string), "%s", veehName[GetVehicleModel(pvehicleid[playerid])-400]);
PlayerTextDrawSetString(playerid, NomeVehicle[playerid], string);
PlayerTextDrawSetString(playerid, Textaviao11[playerid], string);
new name[MAX_PLAYER_NAME];
new arma = GetPlayerWeapon(playerid);
GetPlayerName(playerid, name, sizeof(name));
if(arma == 24 || arma == 25)
{
SetPlayerArmedWeapon(playerid, 29);
SendClientMessage(playerid, COLOR_GRAD1, "Proibido entrar de passageiro com esta arma, ela foi retirada de sua mгo!");
}
foreach(Player, i)
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
{
if(GetPlayerMoney(playerid) < TransportValue[i])
{
format(gstring, sizeof(gstring), "* Vocк precisa de R$%d para entrar.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, gstring);
RemovePlayerFromVehicleEx(playerid);
}
else
{
if(TransportDuty[i] == 1)
{
format(gstring, sizeof(gstring), "* Pagou R$%d para o taxista.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, gstring);
ShowTaxi(playerid);
format(gstring, sizeof(gstring), "* Passageiro %s entrou no Taxi.", name);
SendClientMessage(i, COLOR_LIGHTBLUE, gstring);
TransportTime[i] = 1;
TransportPlayer[playerid] = i;
TransportPlayer[i] = playerid;
TransportTime[playerid] = 1;
TransportCost[playerid] = TransportValue[i];
TransportCost[i] = TransportValue[i];
TransportDriver[playerid] = i;
format(gstring, sizeof(gstring), "Passageiro:~n~%s", name);
PlayerTextDrawSetString(i,passtaxi[i], gstring);
format(gstring, sizeof(gstring), "Motorista:~n~%s", NomePlayer(i));
PlayerTextDrawSetString(playerid,passtaxi[playerid], gstring);
}
else if(TransportDuty[i] == 2)
{
format(gstring, sizeof(gstring), "* Pagou R$%d para o Motorista De Onibus.", TransportValue[i]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, gstring);
format(gstring, sizeof(gstring), "* Passageiro %s entrou no Onibus.", name);
SendClientMessage(i, COLOR_LIGHTBLUE, gstring);
}
GiveDinheiro(playerid, - TransportValue[i]);
TransportMoney[i] += TransportValue[i];
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] && Spectate[i] == playerid)
{
PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
}
}
pvehicleid[playerid] = GetPlayerVehicleID(playerid);
pmodelid[playerid] = GetVehicleModel(pvehicleid[playerid]);
format(string, sizeof(string), "%s", veehName[GetVehicleModel(pvehicleid[playerid])-400]);
PlayerTextDrawSetString(playerid, NomeVehicle[playerid], string);
PlayerTextDrawSetString(playerid, Textaviao11[playerid], string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "» Vocк pode ver alguns comandos do veiculo digitando {FFFFFF}/ajudaveh");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "» Para ligar ou desligar o veiculo, aperte a tecla {FFFFFF}Y {33CCFF}do seu teclado.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "» Use {FFFFFF}/CAMERA {33CCFF}dentro do carro para ligar a camera em primeira pessoa!");
new meuid = GetOwnedVehicleID(playerid);
if (meuid == GetPlayerVehicleID(playerid))
{
SendClientMessage(playerid, 0xF4FC00FF, "» Use {FFFFFF}/menuvei{F4FC00} ou use {FFFFFF}N {F4FC00}Para Acessar o Painel de seu Veнculo!");
}
new newcar = GetPlayerVehicleID(playerid);
new oldcar = gLastCar[playerid];
new HouseCar = PlayerInfo[playerid][pPHouseCarKey];
if(IsABombCar(newcar))
{
if(TendoGuerra)
{
SetPlayerTeam(playerid, GetPlayerOrg(playerid));
}
}
if(PlayerKarting[playerid] != 0)
{
new kart = GetVehicleModel(GetPlayerVehicleID(playerid));
if(kart==571)
{
PlayerInKart[playerid] = 1;
KartingPlayers ++;
}
}
if(oldcar != 301)
{
if((HouseCar != oldcar && oldcar != 0) && (HireCar[playerid] != oldcar && newcar != HouseCar))
{
if(gLastDriver[oldcar] == playerid && oldcar != newcar)
{
gLastDriver[oldcar] = 300;
VTrancado[oldcar] = 0;
UnLockCar(oldcar);
}
}
}
gLastCar[playerid] = newcar;
gLastDriver[newcar] = playerid;
}
if(newstate == PLAYER_STATE_SPAWNED && logouagora[playerid] ==0 )
{
if(sincronizando[playerid] == 1)
{
return true;
}
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
{
if(sincronizando[playerid] == 1)
{
return true;
}
SetPlayerSpawn(playerid);
}
gPlayerSpawned[playerid] = 1;
SafeTime[playerid] = 60;
}
return true;
}
BPS::CheckVehicle(playerid, vehicleid)
{
if(GetPlayerVehicleID(playerid) == vehicleid &&
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+2.0);
}
return true;
}
BPS::HireCost(carid)
{
switch (carid)
{
case 69:
{
return 90000; //Ford-GT
}
case 70:
{
return 130000; //infernus
}
case 71:
{
return 100000; //Diablo
}
case 72:
{
return 80000;
}
case 73:
{
return 70000;
}
case 74:
{
return 60000;
}
}
return 0;
}
BPS::CarCheck()//ATUAL
{
foreach(Player, j)
{
new Float:health;
GetPlayerHealth(j, health);
if(PlayerInfo[j][pDoenca]==1)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 4.0);
SendClientMessage(j, COLOR_LIGHTBLUE, "* Perdeu 4 de Saъde por DST - Vб atй um hospital ou procure um mйdico para se curar");
}
else if(PlayerInfo[j][pDoenca]==2)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 8.0);
SendClientMessage(j, COLOR_LIGHTBLUE, "* Perdeu 8 de Saъde por DST - Vб atй um hospital ou procure um mйdico para se curar");
}
else if(PlayerInfo[j][pDoenca]==3)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 12.0);
SendClientMessage(j, COLOR_LIGHTBLUE, "* Perdeu 12 de Saъde por DST - Vб atй um hospital ou procure um mйdico para se curar");
}
else if(PlayerInfo[j][pDoenca]==4)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 5.0);
SendClientMessage(j, COLOR_LIGHTBLUE, "* Perdeu 5 de Saъde por Cirrose - Vб atй um hospital ou procure um mйdico para se curar.");
}
else if(PlayerInfo[j][pDoenca]==5)
{
GetPlayerHealth(j, health);
SetPlayerHealth(j, health - 5.0);
SendClientMessage(j, COLOR_LIGHTBLUE, "* Perdeu 5 de Saъde por Cвncer de Pulmгo - Vб atй um hospital ou procure um mйdico para se curar.");
}
if(GetPlayerMoney(j) < 0)
{
if(MoneyMessage[j]==0)
{
new gstring[128];
format(gstring, sizeof(gstring), "Vocк esta devendo: R$%d Se nгo tiver essa grana vocк serб preso no proximo payday", GetPlayerMoney(j));
SendClientMessage(j, COLOR_LIGHTRED, gstring);
MoneyMessage[j] = 1;
}
}
else
{
MoneyMessage[j] = 0;
}
}
for(new c = 1; c < 254; c++)
{
if (gLastDriver[c] >= 300)
{
gLastDriver[c]++;
}
//forndowner = -1;
}
return true;
}
BPS::CarInit()
{
for(new c = 1; c < 254; c++)
{
gLastDriver[c] = 299;
}
gLastDriver[301]=255;
return true;
}
BPS::CarRespawn(carid)
{
foreach(Player, i)
{
if(IsPlayerInVehicle(i, carid) || HireCar[i] == carid)
{
gLastDriver[carid] = 255;
return 0;
}
}
SetVehicleToRespawn(carid);
gLastDriver[carid] = 299;
return true;
}