12.03.2016, 18:07
Here is the code,
My problem:
When it respawns the vehicles it respawns trailers that are being used at the moment and connected to a truck.I need the script to check if the trailer is connected to a truck,if not respawn it,if yes no respawn.I have no idea how to make this.Can someone help me out with this? PLEASE !!! I need this really bad on my server! I'will rep+1 anyone who helps me out with this...
PHP код:
#define RESPAWN_TIME 20 // Twenty minutes
public OnGameModeInit() {
SetTimer("VehicleRespawn", RESPAWN_TIME * 60000, 1);
return 1;
}
forward VehicleRespawn();
public VehicleRespawn() {
for(new i = 0; i < MAX_VEHICLES; i ++ ) {
for(new o = 0; o < GetMaxPlayers(); o ++ ) {
if(!IsPlayerConnected(o)) continue;
if(IsAnyBodyInVehicle(i)) continue;
SetVehicleToRespawn(i);
}
}
return 1;
}
stock IsAnyBodyInVehicle(vid) {
for(new i = 0; i < GetMaxPlayers(); i ++ ) {
if(IsPlayerInVehicle(i, vid)) return 1;
}
return 0;
}
When it respawns the vehicles it respawns trailers that are being used at the moment and connected to a truck.I need the script to check if the trailer is connected to a truck,if not respawn it,if yes no respawn.I have no idea how to make this.Can someone help me out with this? PLEASE !!! I need this really bad on my server! I'will rep+1 anyone who helps me out with this...