11.05.2015, 18:26
(
Последний раз редактировалось KingPersona; 16.05.2015 в 10:21.
)
FIXED.
forward RACtime(); public RACtime()
{
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 <= 420; car++) if(!unwanted[car] || IsTrailerAttachedToVehicle(player))
SetVehicleToRespawn(car);
}
forward RACtime(); public RACtime()
{
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player < GetPlayerPoolSize(); player++) if(IsPlayerInAnyVehicle(player))
unwanted[GetPlayerVehicleID(player)]=true;
for(new car; car < GetVehiclePoolSize(); car++) if(!unwanted[car] || IsTrailerAttachedToVehicle(player))
SetVehicleToRespawn(car);
}
pawn Код:
pawn Код:
|
error 017: undefined symbol "player"
for(new car; car < GetVehiclePoolSize(); car++) if(!unwanted[car] || IsTrailerAttachedToVehicle(player))
warning 201: redefinition of constant/macro (symbol "MAX_VEHICLES")
#define MAX_VEHICLES 600
#undef MAX_VEHICLES
#define MAX_VEHICLES 600
for(new car; car < GetVehiclePoolSize(); car++) if(!unwanted[car] || IsTrailerAttachedToVehicle(car))
1.
pawn Код:
pawn Код:
|
pawn Код:
|
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] <= 6)
{
SendClientMessage(playerid, COLOR_GREEN, "Error: You are not authorized to use this command.");
return 1;
}
for(new i;i<MAX_VEHICLES;i++)
{
if(IsUnusedVehicle(i) && IsVehicleConnected(i) && OwnedMashin[i] == 0 && OwnedMashin_2[i] == 0) SetVehicleToRespawn(i);
}
format(string,256,"All Vehicles Respawned By Owner %s",PINFO[playerid][pName]);
AdminWarn(string);
}
return 1;
}
stock RespawnAllVehicles( )
{
for( new i = 1; i <= GetVehiclePoolSize( ); i++ ) //vehicle IDs start at 1.
{
for( new p = 0; p <= GetPlayerPoolSize( ); p++ ) // looping through connected players
{
if( IsPlayerInVehicle( p, i ) ) // if someone's driving the current vehicle we're checking
continue; // exit the player loop as we don't need to check any further
}
if( IsVehicleTrailer( i ) && IsVehicleAttachedToTrailer( i ) ) // if it's a trailer, and if it's attached to some vehicle
continue; // tell the loop to continue on to the next vehicle as this one is a trailer attached to a vehicle
SetVehicleToRespawn( i ); // respawn the vehicle if it's unoccupied and not attached to any vehicle
}
return 1;
}
IsVehicleTrailer( vehicleid )
{
switch( GetVehicleModel( vehicleid ) )
{
case 435, 450, 584, 591: return true; // if it's a trailer
default: return false; // if not
}
return false; // return false by default
}
IsVehicleAttachedToTrailer( trailerid )
{
for( new i = 1; i < GetVehiclePoolSize( ); i++ )
{
if( GetVehicleTrailer( i ) == trailerid ) // if the trailer attached to this vehicle is the trailer
return true;
}
return false;
}