help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help (
/showthread.php?tid=185451)
help -
dark_clown - 24.10.2010
how can i make with this
Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}
set vehicle to respawn only if its empty?
Re: help -
boelie - 24.10.2010
copy and paste this and then you only need a command with RespawnEmptyCars(); in it
Код:
RespawnEmptyCars();
public RespawnEmptyCars()
{
for(new i=0; i<MAX_VEHICLES; i++)
{
for(new pl = 0; pl<MAX_PLAYERS; pl++)
{
if(IsPlayerConnected(pl))
{
if(!IsVehicleInUse(i))//if(!IsPlayerInVehicle(pl, i))
{
SetVehicleToRespawn(i);
}
}
}
}
}
stock IsVehicleInUse(vehicleid)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVehicleID(i) == vehicleid)
return true;
}
}
return false;
}
Re: help -
dark_clown - 24.10.2010
didnt help -.-
Re: help -
DeathOnaStick - 24.10.2010
Try this:
pawn Код:
for(new i=0; i<MAX_VEHICLES; i++)
{
new pcount=0;
for(new pl=0, tx=GetMaxPlayers(); pl<=tx; pl++)
{
if(IsPlayerConnected(pl))
{
if(GetPlayerVehicleID(pl)==i)
{
pcount++;
break;
}
}
}
if(pcount==0)SetVehicleToRespawn(i);
}