29.05.2014, 13:56
There are many issues with it. Having "i" twice and increasing "vv" and then using "ii" which are both undefined symbols.
It will also remove (if you fix those I mentioned above) the vehicle if the player with ID 0 is not in that vehicle.
Vehicles starts from 1, not 0 and you should use foreach to reduce the times the loop for the players gets called.
It will also remove (if you fix those I mentioned above) the vehicle if the player with ID 0 is not in that vehicle.
Vehicles starts from 1, not 0 and you should use foreach to reduce the times the loop for the players gets called.
pawn Код:
CMD:removeucar(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 3 && !IsPlayerAdmin(playerid)) return SendClientMessage( playerid, -1, "You Must Be Higher Level To To Use This Command");
for (new v = 1; v < MAX_VEHICLES; v++)
{
if (!GetVehicleModel(v)) continue; // vehicle does not exist, skip the players loop
if (!IsVehicleOccupied(v)) DestroyVehicle(v);
}
return 1;
}
IsVehicleOccupied(vehicleid)
{
foreach(new i : Player)
{
if (IsPlayerInVehicle(i, vehicleid)) return 1;
}
return 0;
}