20.03.2011, 19:08
Ofcourse not, you didn't make a loop, you made it check for the player who types /vrespawn only.
Try this:
Try this:
pawn Код:
CMD:vrespawn(playerid, params[])
{
new Unusedcar[MAX_VEHICLES];
if(PlayerData[playerid][AdminLevel] > 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInAnyVehicle(i))
{
Unused[GetPlayerVehicleID(i)]=1; // 1 = false, which means it's used
}
}
}
for(new carid = 0; carid < MAX_VEHICLES; carid++)
{
if(unused[carid]==0) // 0 = true which means it's unused.
{
SetVehicleToRespawn(carid);
}
}
}
return 1;
}