[Ajuda] Loop com erro ou SetTimer?
#1

Alguйm pode me ajudar com este comando? pois й funcional mais bugado, tipo, dou /rv ae depois de 30 segundos o servidor buga todo.. ae mostra direto a mensagem floodando, '* Todos veнculos foram respawnados!', isso nгo desbuga atй que o servidor seja desligado, alguйm ae pode me informar o erro no cуdigo?

- Comando -
pawn Код:
if (strcmp(cmd, "/respawnveiculos", true) == 0 || strcmp(cmd, "/rv", true) == 0)
    {
        if (IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 2)
            {
                format(string, sizeof(string), "Admin [%d] %s: Respawn de todos os veiculos em 30 segundos.", PlayerInfo[playerid][pAdmin], GetPlayerNameRP(playerid));
                SendClientMessageToAll(COR_AZUL_ESCURO, string);
                SetTimer("respawnveiculos", 30000, false);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Vocк nгo tem nнvel administrativo suficiente.");
            }
        }
        return true;
    }
- Public chamada -
pawn Код:
forward respawnveiculos();
public respawnveiculos()
{
    new string[256];
    format(string,sizeof(string),"* Todos veнculos foram respawnados!");
    OOCNews(COLOR_YELLOW,string);
    GameTextForAll("~r~Veiculos Respawnados",4000,3);
    new bool:unwanted[CAR_AMOUNT];
    for(new player=0; player<MAX_SLOTS; player++)
    {
        if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
    }
    for(new car = 0; car < MAX_VEHICLES; car++)
    {
        if(!unwanted[car]) SetVehicleToRespawn(car);
    }
    return true;
}
Reply
#2

Poste a sua funзгo OOCNews pra darmos uma analisada...
Reply
#3

Nгo vai resolver nada isso.. '.'

pawn Код:
public OOCNews(color,const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(!gNews[i])
            {
                SendClientMessage(i,color,string);
            }
        }
    }
}
Reply
#4

Estranho... Testei e tudo aparentemente funciona normal, sem flood. Pode ser algum conflito
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)