15.07.2010, 01:19
also i need a code that the server respawns the car every 3 hours, automatically, please.
SetTimer("Rac",180000,false)
{
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 1; car <= 268; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "SERVER: All unused cars Automaticly respawned by The Server.", );
BroadCast(COLOR_WHITE,string);
}
return 1;
#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 ++ ) {
SetVehicleToRespawn(i);
}
return 1;
}
#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;
}
@Armada
pawn Код:
|