[Ajuda] Respawn Carros - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Respawn Carros (
/showthread.php?tid=488932)
Respawn Carros -
lHesoyaml - 19.01.2014
Bom galera o meu comando de respawncarros (carros sem uso) funciona, mais ele respawna os trailers tambem.Como faзo para ele nгo respawnar os trailers em uso.Obg.
pawn Код:
COMMAND:respawncarros(playerid, params[])
{
SendAdminText(playerid, "/respawncarros", params);
if (APlayerData[playerid][PlayerLevel] < 3) return 0;
ResetarVeiculos();
new Msg[300], Name[24];
GetPlayerName(playerid, Name, sizeof(Name));
format(Msg, 300, "{00BFFF}O Adminstrador {FFFFFF}%s {00BFFF}resetou todos os veiculos desocupados.",Name);
SendClientMessageToAll(0xFF99AADD, Msg);
return true;
}
stock ResetarVeiculos()
{
new inVeh;
for( new i = 0; i < MAX_VEHICLES; i++ )
{
inVeh = false;
for( new j = 0; j < GetMaxPlayers(); j++ )
{
if(IsPlayerInVehicle( j, i ))
{
inVeh = true;
break;
}
}
if(!inVeh)
{
SetVehicleToRespawn(i);
}
}
return true;
}
Re: Respawn Carros -
Kmatsu - 19.01.2014
Acho que й isso:
IsTrailerAttachedToVehicle
PS: diminui o 'new Msg[300]' pra 128 (ou menos) vocк nгo usa mais que isso ._.
Re: Respawn Carros -
JonathanFeitosa - 19.01.2014
@edit2 eu nгo sabia o que era trailer, pra mim era um carro, nгo gosto de caminhoneiro kk' Faz o que o dono do BCF falou
Re: Respawn Carros -
lHesoyaml - 19.01.2014
Poderia dar um exemplo do 1є metodo?
Re: Respawn Carros -
rjjj - 19.01.2014
Isto deve resolver o seu problema

:
pawn Код:
stock ResetarVeiculos()
{
static bool:TrailerEmUso[MAX_VEHICLES];
new Ciclo = 1;
for(new x = 1; x <= MAX_VEHICLES; x++)
{
switch(Ciclo)
{
case 1:
{
if(IsTrailerAttachedToVehicle(x))
{
TrailerEmUso[GetVehicleTrailer(x) - 1] = true;
}
}
case 2:
{
new bool:Ocupado;
for(new y = 0, z = GetMaxPlayers(); y != z; y++)
{
if(IsPlayerInVehicle(y, x))
{
Ocupado = true;
}
}
if(!Ocupado && !TrailerEmUso[x - 1])
{
SetVehicleToRespawn(x);
}
}
case 3:
{
TrailerEmUso[x - 1] = false;
}
}
if(x == MAX_VEHICLES && Ciclo < 3)
{
x = 0;
Ciclo++;
}
}
return true;
}
Espero ter ajudado

.
Re: Respawn Carros -
lHesoyaml - 19.01.2014
Vlw rjjj funciono perfeitamente +REP