SA-MP Forums Archive
[Ajuda] respawnando trailer do caminhгo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] respawnando trailer do caminhгo (/showthread.php?tid=586498)



respawnando trailer do caminhгo - Killer21 - 22.08.2015

Galera, criei o comando de respawnar veiculos desocupados no server, mas se o player estiver trabalhando de caminhoeiro levando um trailer, o trailer tambem й respawnado :/

PHP код:
CMD:respawn(playeridparams[])
{
    if(
PlayerInfo[playerid][Admin] == 1)
    {
        new 
String[100], Nome[MAX_PLAYER_NAME];
        
GetPlayerName(playeridNomesizeof(Nome));
        
format(Stringsizeof(String), "[PL-ADMIN] O Administrador {1BA5E0}%s{00C2EC} deu respawn em todos os veнculos"Nome);
        
SendClientMessageToAll(AZUL_CLAROString);
        for(new 
0MAX_VEHICLESv++)
        {
        if(!
IsVehicleOccupied(v)) SetVehicleToRespawn(v);
        }
    }
    else
    {
         
SendClientMessage(playeridCRIMSON"[ERRO] Vocк nгo й um Administrador.");
    }
    return 
1;

PHP код:
IsVehicleOccupied(vehicleid)
{
for(new 
0MAX_PLAYERSi++) if(IsPlayerInVehicle(ivehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
return 
1; return 0;




Re: respawnando trailer do caminhгo - iTakelot - 22.08.2015

PHP код:
CMD:respawn(playeridparams[])
{
    if(
PlayerInfo[playerid][Admin] < 2) return SendClientMessage(playerid, -1"{ff0000}Vocк precisa ser admin nivel 2 para usar este comando!");
    for(new 
iMAX_VEHICLESi++)
    if(!
IsVehicleInUse(i))
    
SetVehicleToRespawn(i);
    return 
1;

Stock

PHP код:
stock IsVehicleInUse(vehicleid)
{
    new 
Veiculo;
    for(new 
iMAX_PLAYERSi++)
    {
        if(
GetPlayerVehicleID(i) == vehicleid)
        
Veiculo vehicleid;
        if(
GetVehicleTrailer(GetPlayerVehicleID(i)) == vehicleid)
        
Veiculo vehicleid;
    }
    return 
Veiculo;