[Ajuda] Comando de rvs
#1

quando eu do /rvs respawn todos os carros, tem como ajuda para Respawn so os sem uso


if(!strcmp(cmd,"/rvs", true) && pAdmin[playerid] >= 2)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string),"* O Administrador %s(%d) respawnou os veiculos sem uso", pname, playerid);
SendClientMessageToAll(adm, string);
new carro = 0;
for(carro = 0; carro < MAX_VEHICLES; carro++)
{
if(!IsVehicleOccupied(carro)) SetVehicleToRespawn(carro);
}
return 1;
}
Reply
#2

testa
pawn Код:
if(!strcmp(cmd,"/rvs", true) && pAdmin[playerid] >= 2)
{
    new str[128], bool:vehicle[MAX_VEHICLES], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(str, sizeof(str), " *O Administrador %s(%d) respawnou os veiculos sem uso", pname, playerid);
    SendClientMessage(playerid, -1, str);

    for(new j = 1; GetVehicleModel(j); ++j)
    {
       
        vehicle[j] = false;
        for(new i, p = GetMaxPlayers(); i < p; ++i)
        {
           

            if(!IsPlayerInAnyVehicle(i) || !IsPlayerConnected(i) )
            continue;

            if(IsPlayerInVehicle(i, j))
            {
               

                vehicle[j] = true;
                break;
            }
        }
        if(!vehicle[j])
        if(!IsTrailerAttachedToVehicle(j))
        SetVehicleToRespawn(j);
    }
    return true;
}
Reply
#3

Quote:
Originally Posted by Tekken
Посмотреть сообщение
quando eu do /rvs respawn todos os carros, tem como ajuda para Respawn so os sem uso


if(!strcmp(cmd,"/rvs", true) && pAdmin[playerid] >= 2)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string),"* O Administrador %s(%d) respawnou os veiculos sem uso", pname, playerid);
SendClientMessageToAll(adm, string);
new carro = 0;
for(carro = 0; carro < MAX_VEHICLES; carro++)
{
if(!IsVehicleOccupied(carro)) SetVehicleToRespawn(carro);
}
return 1;
}
Код:
    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] > 0){
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(string, sizeof(string), "{00FF00}(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;
    }
    }
Final Do GM

Код:
IsVehicleOccupied(vid)
{
for(new i; i < GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(GetPlayerVehicleID(i) == vid) return true;
}
return false;
}
Se Te Ajudei Da +Rap Por Favor, Para Tirar Os Negativos .
Creditos : Não Lembro Nick
Reply
#4

Tenta esse

pawn Код:
if (strcmp("/rvs", cmdtext, true, 10) == 0)
{
    if (IsPlayerAdmin(playerid)) //Variavel de admin
    {
        static NoVeiculo;

        for( new i = 0; i < MAX_VEHICLES; i++ )
        {
            NoVeiculo = false;

            for( new j = 0; j < MAX_PLAYERS; j++ )
            {
                if(IsPlayerInVehicle( j, i ))
                {
                    NoVeiculo = true;
                    break;
                }
            }
            if(~NoVeiculo == -1)
            {
                SetVehicleToRespawn(i);
            }
        }
    }
    return 1;
}
Reply
#5

tenta ae

pawn Код:
CMD:rvs(playerid)
{
    if(pAdmin[playerid] >= 2)
    {
        for(new v = 0; v < MAX_VEHICLES; v++)
        {
            if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
        }
        new string[80], ptname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, ptname, MAX_PLAYER_NAME);
        format(string, sizeof(string), "O(A) ADM %s (%d) respawnou todos os veнculos desocupados.", ptname, playerid);
        SendClientMessageToAll(-1, string);
    }
    return 1;
}
Reply
#6

tenta assim

pawn Код:
if(strcmp(cmd, "/rvu", true) == 0)
    {
        if(pAdmin[playerid] >= 2)
        {
            for(new v = 0; v < MAX_VEHICLES; v++)
            {
                if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
            }
            format(string, sizeof(string), "O(A) ADM %s (%d) respawnou todos os veнculos desocupados.", GetPlayerNameEx(playerid), playerid);
            SendClientMessageToAll(tcadm, string);

            SendClientMessage(playerid, Verde, "Veнculos desocupados respawnados!");
        }
        return 1;
    }
e no final do Game Mod coloque isso

pawn Код:
stock IsVehicleOccupied(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
            {
                if(GetPlayerVehicleID(i) == vehicleid)
                {
                    return 1;
                }
            }
        }
    }
    return 0;
}
Reply
#7

Tenta esse do Gm da Dten.
Quote:

if(strcmp(cmd, "/rvu", true) == 0)
{
new string[128];
for(new v = 0; v < MAX_VEHICLES; v++)
{
if(!IsVehicleOccupied(v)) SetVehicleToRespawn(v);
}
format(string, sizeof(string), "O(A) ADM %s (%d) respawnou todos os veнculos desocupados.", GetPlayerNameEx(playerid), playerid);
SendClientMessageToAll(0x33AAFFFF, string);
SendClientMessage(playerid, 0x00D700AA, "Veнculos desocupados respawnados!");
return 1;
}

No final do GM:
Quote:

stock IsVehicleOccupied(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
{
if(GetPlayerVehicleID(i) == vehicleid)
{
return 1;
}
}
}
}
return 0;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)