[Ajuda] Como limpar veнculos sem uso.
#1

Bom galera, venho aqui para pedir uma ajuda. Como eu crio o comando /limparcarros que limpe os carros criados sem uso que foram criados por algum Administrador ou VIP? Mas por exemplo, se o player estiver dentro do carro, ele nгo й apagado.
Reply
#2

Veja este tуpico e vк se ajuda: https://sampforum.blast.hk/showthread.php?tid=406017
Reply
#3

PHP код:
cmd:resetarveiculos(playerid)
{
    for (new 
i;MAX_VEHICLEi++)
    {
        if(!
IsVehicleInUse(i))
          
SetVehicleToRespawn(i);
    }
    
SendClientMessageToAll(-1"Veнculos resetados");
    return 
1;
}
stock IsVehicleInUse(vehicleid)
{
    new 
Veiculo;
    for(new 
iMAX_PLAYERSi++)
    {
        if(
GetPlayerVehicleID(i) == vehicleid)
            
Veiculo vehicleid;
        if(
GetVehicleTrailer(GetPlayerVehicleID(i)) == vehicleid)
            
Veiculo vehicleid;
    }
    return 
Veiculo;

Reply
#4

PHP код:
CMD:resetar(playerid)
{
    for(new 
vMAX_VEHICLES; ++v){
        if(!
IsVehicleOccupied(v)) SetVehicleToRespawn(v);
    }
    
SendClientMessageToAll(-1"Veiculos resetados");
    return 
1;
}
IsVehicleOccupied(vehicleid)
{
    for(new 
iGetPlayerPoolSize(); <= zi++){
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
            if(
GetPlayerVehicleID(i) == vehicleid) return 1;
    }
    return 
0;

Reply
#5

Quote:

if (strcmp(cmd, "/rvs",true) == 0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || Guardiao[playerid])
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "| INFO | O Administrador %s (%d) respawnou os Veiculos sem Uso.", pname,playerid);
SendClientMessageToAll(adm, string);
for(new v; v<MAX_VEHICLES; v++) if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
SendClientMessage(playerid, Verde, "| INFO | Veiculos Respawnados");
proximocarro = 0;
for(new carro = 0; carro < MAX_CARROS; carro++)
{
format(string, sizeof(string), "carro%d.ini", carro);
if(dini_Exists(string))
{
new carroid;
DestroyVehicle(dini_Int(string, "Id"));
carroid = AddStaticVehicle(dini_Int(string, "Modelo"), dini_Float(string, "CordX"), dini_Float(string, "CordY"), dini_Float(string, "CordZ"), dini_Float(string, "Angulo"), dini_Int(string, "Cor1"), dini_Int(string, "Cor2"));
dini_IntSet(string, "Id", carroid);
proximocarro++;
}
}
return 1;
}
}

Usa como base.
Reply
#6

Quote:
Originally Posted by SnowBorn
Посмотреть сообщение
Usa como base.
O tуpico jб foi respondo, entгo nгo hб necessidades de vocк responder novamente. Outra coisa й que vocк mandou um cуdigo totalmente mal identado e desatualizado, estamos em 2018 e nгo usamos mais strcmp.

Fica a dica para vocк nгo cometer esses erros novamente.
Reply
#7

Quote:
Originally Posted by Gguiz
Посмотреть сообщение
O tуpico jб foi respondo, entгo nгo hб necessidades de vocк responder novamente. Outra coisa й que vocк mandou um cуdigo totalmente mal identado e desatualizado, estamos em 2018 e nгo usamos mais strcmp.

Fica a dica para vocк nгo cometer esses erros novamente.
Tб nй..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)