[Ajuda] Respawn carros loop
#1

O problema й que quando eu uso o RTC ele nгo aconteзe nada os carros nгo voltam pra posiзгo inicial.
pawn Код:
//OnGameModeInit
    carPM[1] = AddStaticVehicleEx(596,1460.5000000,-690.4000200,94.6000000,266.0000000,79,1,60000); // 14 linhas iguais a esse

CMD:rtc(playerid, params[])
{
    new string[256];
    if(Player[playerid][pPMRJ] >= 4)
    {
        for(new i; i < 14; i++)
        {
            SetVehicleToRespawn(carPM[i]);
            format(string, sizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM.", getPName(playerid));
            SendMessageToCops(COR_ABATIDO, string);
            return 1;
        }
    }
Reply
#2

Quote:
Originally Posted by Ivison
Посмотреть сообщение
O problema й que quando eu uso o RTC ele nгo aconteзe nada os carros nгo voltam pra posiзгo inicial.
pawn Код:
//OnGameModeInit
    carPM[1] = AddStaticVehicleEx(596,1460.5000000,-690.4000200,94.6000000,266.0000000,79,1,60000); // 14 linhas iguais a esse

CMD:rtc(playerid, params[])
{
    new string[256];
    if(Player[playerid][pPMRJ] >= 4)
    {
        for(new i; i < 14; i++)
        {
            SetVehicleToRespawn(carPM[i]);
            format(string, sizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM.", getPName(playerid));
            SendMessageToCops(COR_ABATIDO, string);
            return 1;
        }
    }

pawn Код:
CMD:rtc(playerid, params[])
{
  if(Player[playerid][pPMRJ] >= 4)
    {
        new str[40], nome[24], bool:vehicle[MAX_VEHICLES];
        GetPlayerName(playerid, nome, 24);
        format(string, sizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM.", getPName(playerid));
        SendMessageToCops(COR_ABATIDO, string);
        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]) SetVehicleToRespawn(j);
        }
        return 1;
    }
Tenta ai '-'
Reply
#3

Acho que o usuбrio acima jб concertou seu erro, sу lembre-se, mandar uma mensagem dentro de um loop й burrice, anгo ser que tenha uma condicional dentro dela para uma coisa especнfica.

Abraзos
Reply
#4

Quote:
Originally Posted by ProKillerpa
Посмотреть сообщение
Acho que o usuбrio acima jб concertou seu erro, sу lembre-se, mandar uma mensagem dentro de um loop й burrice, anгo ser que tenha uma condicional dentro dela para uma coisa especнfica.

Abraзos
Vish, verdade jб nгo mecho em pawn faz algum tempo irei corrigir o cуdigo.
Obrigado
Reply
#5

Funcionou. vlw ae +Rep
Reply
#6

Tenho um problema ele ta dando Respawn em todos os carros.
Reply
#7

Quote:
Originally Posted by MTCpyedroDN
Посмотреть сообщение
pawn Код:
CMD:rtc(playerid, params[])
{
  if(Player[playerid][pPMRJ] >= 4)
    {
        new str[40], nome[24], bool:vehicle[MAX_VEHICLES];
        GetPlayerName(playerid, nome, 24);
        format(string, sizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM.", getPName(playerid));
        SendMessageToCops(COR_ABATIDO, string);
        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]) SetVehicleToRespawn(j);
        }
        return 1;
    }
Tenta ai '-'
Desculpa estragar sua festa, mas vocк copiou o cуdigo, deveria ao menos ter deixado os crйditos.

Sobre dar respawn em todos os carros, tente com esse cуdigo.

PHP код:
CMD:rtc(playeridparams[])
{
  if(
Player[playerid][pPMRJ] >= 4)
    {
        new 
str[40], nome[24], bool:vehicle[MAX_VEHICLES];
        
GetPlayerName(playeridnome24);
        
format(stringsizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM."getPName(playerid));
        
SendMessageToCops(COR_ABATIDOstring);
        for(new 
1GetVehicleModel(j); ++j)
        {
            
vehicle[j] = false;
            for(new 
iGetMaxPlayers(); p; ++i)
            {
                if(!
IsPlayerInVehicle(playeridcarPM[1]) || !IsPlayerConnected(i)) continue;
                if(
IsPlayerInVehicle(ij))
                {
                    
vehicle[j] = true;
                    break;
                }
            }
            if(!
vehicle[j]) SetVehicleToRespawn(j);
        }
        return 
1;
    } 
Reply
#8

Quote:
Originally Posted by ProKillerpa
Посмотреть сообщение
Desculpa estragar sua festa, mas vocк copiou o cуdigo, deveria ao menos ter deixado os crйditos.

Sobre dar respawn em todos os carros, tente com esse cуdigo.

PHP код:
CMD:rtc(playeridparams[])
{
  if(
Player[playerid][pPMRJ] >= 4)
    {
        new 
str[40], nome[24], bool:vehicle[MAX_VEHICLES];
        
GetPlayerName(playeridnome24);
        
format(stringsizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM."getPName(playerid));
        
SendMessageToCops(COR_ABATIDOstring);
        for(new 
1GetVehicleModel(j); ++j)
        {
            
vehicle[j] = false;
            for(new 
iGetMaxPlayers(); p; ++i)
            {
                if(!
IsPlayerInVehicle(playeridcarPM[1]) || !IsPlayerConnected(i)) continue;
                if(
IsPlayerInVehicle(ij))
                {
                    
vehicle[j] = true;
                    break;
                }
            }
            if(!
vehicle[j]) SetVehicleToRespawn(j);
        }
        return 
1;
    } 
Tinha esse cуdigo em meu GameMode, nгo mecho em pawn faz tempo apenas copiei e adaptei sobre os crйditos й possivel q tenha pegado o codigo de algum lado nгo me lembro de onde.
Peзo desculpa '-'
Reply
#9

Quote:
Originally Posted by MTCpyedroDN
Посмотреть сообщение
Tinha esse cуdigo em meu GameMode, nгo mecho em pawn faz tempo apenas copiei e adaptei sobre os crйditos й possivel q tenha pegado o codigo de algum lado nгo me lembro de onde.
Peзo desculpa '-'
ok.

UP alguem?
Reply
#10

pawn Код:
CMD:rtc(playerid, params[])
{
    new string[256];
    if(Player[playerid][pPMRJ] >= 4)
    {
        for(new i = 0; i < sizeof(carPM); i++){ SetVehicleToRespawn(carPM[i]);}
        format(string, sizeof(string), "{0000FF}HQ: Todas as unidades: Polнcial {ffffff}%s{0000FF} respawnou todos os carros da PM.", getPName(playerid));
        SendMessageToCops(COR_ABATIDO, string);
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)