31.07.2010, 21:59
Alright, I'm making a RespawnAllVehicles function and the command basically stops once it gets to a certain line.
As you can see, I'm using prints to see which line to server gets to before the command stopped. I saw Loop, Format, Exists, Check but Move wasn't there. Therefore it's the SetVehiclePos command which is causing the server to stop. Any ideas how to fix this?
Any help would be appreciated,
-Conroy
pawn Код:
public RespawnAllVehicles()
{
new VehicleCannotBeRespawned[MAX_VEHICLES], VehiclePath[128];
for(new i; i <= MAX_PLAYERS; i++) {
if(IsPlayerInAnyVehicle(i)) {
VehicleCannotBeRespawned[GetPlayerVehicleID(i)] = 1;
}
}
for(new vehid; vehid <= MAX_VEHICLES; vehid++) {
print("Loop");
format(VehiclePath, sizeof(VehiclePath), "\\Vehicles\\%d.ini", vehid);
print("Format");
if(dini_Exists(VehiclePath)) {
print("Exists");
if(VehicleCannotBeRespawned[vehid] == 0) {
print("Check");
SetVehiclePos(vehid,
dini_Float(VehiclePath, "SpawnX"),
dini_Float(VehiclePath, "SpawnY"),
dini_Float(VehiclePath, "SpawnZ")), print("Move");
SetVehicleZAngle(vehid, dini_Float(VehiclePath, "SpawnA"));
print("Angle");
}
}
}
SendClientMessageToAll(COLOR_YELLOW, "[SERVER] - All unused vehicles have been respawned.");
AllVehiclesAreRespawning = 0;
return 1;
}
pawn Код:
SetVehiclePos(vehid, dini_Float(VehiclePath, "SpawnX"), dini_Float(VehiclePath, "SpawnY"), dini_Float(VehiclePath, "SpawnZ"));
-Conroy