Spawn de Veiculos - welmateus - 12/05/2024
Estou com um problema no respawn de veiculos automaticos do servidor.
Os veiculos de corporações são criados dentro de um interior e em outro mundo, pra não ficar spawnando na rua naquele famoso bug do mobile.
Porém, quando uso o comando /rc ou o respawn automatico é chamado, os carros mesmo ocupados re-spawnam(somente os criados em interior).
OnGameModeInit
Código: CarrosPM[0] = AddStaticVehicleEx(596,1415.2000000,-45.1000000,1000.7000000,0.0000000,1,2,TEMPO_RESPAWN); //Police Car (LSPD)
CarrosPM[1] = AddStaticVehicleEx(596,1410.2000000,-45.1000000,1000.7000000,0.0000000,1,2,TEMPO_RESPAWN); //Police Car (LSPD)
CarrosPM[2] = AddStaticVehicleEx(596,1394.8000000,-45.2000000,1000.7000000,0.0000000,1,2,TEMPO_RESPAWN); //Police Car (LSPD)
CarrosPM[3] = AddStaticVehicleEx(596,1405.0996000,-45.2001900,1000.7000000,0.0000000,1,2,TEMPO_RESPAWN); //Police Car (LSPD)
CarrosPM[4] = AddStaticVehicleEx(596,1399.7000000,-45.0000000,1000.7000000,0.0000000,1,2,TEMPO_RESPAWN); //Police Car (LSPD)
CarrosPM[5] = AddStaticVehicleEx(427,1383.8000000,-43.3000000,1001.2000000,0.0000000,1,2,TEMPO_RESPAWN); //Enforcer
CarrosPM[6] = AddStaticVehicleEx(427,1388.9004000,-43.4003900,1001.2000000,0.0000000,1,2,TEMPO_RESPAWN); //Enforcer
CarrosPM[7] = AddStaticVehicleEx(490,1378.2000000,-44.3000000,1001.2000000,0.0000000,1,2,TEMPO_RESPAWN); //FBI Rancher
CarrosPM[8] = AddStaticVehicleEx(490,1372.7000000,-44.3000000,1001.2000000,0.0000000,1,2,TEMPO_RESPAWN); //FBI Rancher
CarrosPM[9] = AddStaticVehicleEx(523,1363.7000000,-44.5000000,1000.6000000,0.0000000,1,2,TEMPO_RESPAWN); //HPV1000
CarrosPM[10] = AddStaticVehicleEx(523,1366.2998000,-44.5000000,1000.6000000,0.0000000,1,2,TEMPO_RESPAWN); //HPV1000
CarrosPM[11] = AddStaticVehicleEx(523,1360.9000000,-44.3000000,1000.6000000,0.0000000,1,2,TEMPO_RESPAWN); //HPV1000
CarrosPM[12] = AddStaticVehicleEx(523,1368.8000000,-44.5000000,1000.6000000,0.0000000,1,2,TEMPO_RESPAWN); //HPV1000
for(new i; i < 13; i++)
{
SetVehicleVirtualWorld(CarrosPM[i], 102);
LinkVehicleToInterior(CarrosPM[i], 1);
}
OnVehicleSpawn
Código: public OnVehicleSpawn(vehicleid)
{
for(new i; i < 13; i++)
{
SetVehicleVirtualWorld(CarrosPM[i], 102);
LinkVehicleToInterior(CarrosPM[i], 1);
}
Callback do respawn
Código: CallBack:: ttrespawn()
{
SendClientMessageToAll(COLOR_LIGHTRED,"RC: Todos os Veiculos do Servidor Voltaram Para o Seu Local");
foreach(new car : Vehicle)
{
if(GetVehicleDriver(car) == INVALID_PLAYER_ID)
{
SetVehicleToRespawn(car);
PassageirosMt[car] = 0;
PassageirosAv[car] = 0;
}
}
return 1;
}
GetVehicleDriver
Código: stock GetVehicleDriver(vehicleid){
foreach(new i : Player){
if(IsPlayerInAnyVehicle(i)){
if(GetPlayerVehicleID(i) == vehicleid){
return i;
}
}
}
return INVALID_PLAYER_ID;
}
RE: Spawn de Veiculos - welmateus - 13/05/2024
RESOLVIDO
RE: Spawn de Veiculos - Carlos Victor - 18/05/2024
Comente qual foi a solução, talvez outro jogador com o mesmo problema, pode corrigir usando sua experiência!
|