new PlayerVehicleID1[MAX_PLAYERS];
new PlayerVehicleID2[MAX_PLAYERS];
PlayerVehicleID1[playerid]
PlayerVehicleID2[playerid]
new bool:VeiculoOcupado[MAX_VEHICLES];
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
VeiculoOcupado[vehicleid] = true;
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
VeiculoOcupado[vehicleid] = false;
return 1;
}
CMD:respawn(playerid)
{
for(new c = 0; c < MAX_VEHICLES; c++)
{
if(VeiculoOcupado[c] == false)
{
SetVehicleToRespawn(c);
}
}
return 1;
}
PHP код:
|
stock IsVehicleInUse(vehicleid)
{
new Veiculo;
for(new i; i < MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == vehicleid)
Veiculo = vehicleid;
if(GetVehicleTrailer(GetPlayerVehicleID(i)) == vehicleid)
Veiculo = vehicleid;
}
return Veiculo;
}
for(new i; i < MAX_VEHICLES; i++) if(!IsVehicleInUse(i)) SetVehicleToRespawn(i);
CMD:respawn(playerid)
{
for( new v = 0; v < MAX_VEHICLES; v++ )
{
if( !IsVehicleOccupied( v ) && NotTrailerAtached( v )) SetVehicleToRespawn( v );
{
SendClientMessage( playerid, 0x00FF66AA, "{FFFF00} Vocк respawnou todos os veнculos que estгo desocupados." );
}
}
return 1;
}
stock IsVehicleOccupied( vehicleid )
{
foreach(Player, i ) if( IsPlayerInVehicle( i, vehicleid ) && GetPlayerState( i ) == PLAYER_STATE_DRIVER )
return 1; return 0;
}
stock NotTrailerAtached( vehicle )
{
foreach(Player, i )
{
new
v = GetPlayerVehicleID( i )
;
if( IsPlayerInAnyVehicle( i ) && GetVehicleModel( v ) == 515 )
{
if( vehicle == GetVehicleTrailer( GetPlayerVehicleID( i )) )
{
return 0;
}
}
}
return 1;
}
stock Respawn_Go() { GameTextForAll("~g~Veiculos do server resetados!", 5000, 3); for(new i; i < MAX_VEHICLES; i++) { if(!IsVehicleInUse(i)) SetVehicleToRespawn(i); } return 1; } stock IsVehicleInUse(vehicleid) { new Veiculo; for(new i; i < MAX_PLAYERS; i++) { if(GetPlayerVehicleID(i) == vehicleid) Veiculo = vehicleid; if(GetVehicleTrailer(GetPlayerVehicleID(i)) == vehicleid) Veiculo = vehicleid; new norespawn = CarroDosPlayers[PlayerInfo[i][pID]]; if(norespawn == vehicleid) Veiculo = vehicleid; } return Veiculo; }
uso esta stock, nгo reseta os trailer quando estгo engatados...
PHP код:
Код:
for(new i; i < MAX_VEHICLES; i++) if(!IsVehicleInUse(i)) SetVehicleToRespawn(i); |
foreach(new i : Player)}
if(GetPlayerVehicleID(i) == vehicleid) return true;
return false;