SA-MP Forums Archive
Chat box gets spammed then server crashes - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Chat box gets spammed then server crashes (/showthread.php?tid=326855)



Chat box gets spammed then server crashes - new121 - 18.03.2012

Ok so when ever this function gets called, the SendClientMessages gets spammed over and over and over, and the dialog does as well, then eventually the samp server.exe crashes, anyone know why this is happening? I am sure it is something I am over looking but I don't know what the issue is.
pawn Код:
public RoundTimer()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        SendClientMessage(i, COLOR_YELLOW, " Onto the voting stage! ");
        ShowPlayerDialog(i, 3, DIALOG_STYLE_LIST, "Vote","1:Desert\r\n 2:IdleWood\r\n 3:Woods", "Ok","");
        SendClientMessage(i, COLOR_YELLOW, " You have 20 Seconds to vote for the next map! ");
        SetTimer("StartRoundPrep", 20000, false);
        baysideround = 0;
        woodsround = 0;
        desertround = 0;
        if(AXISKILLS > ALLIESKILLS)
        {
            SendClientMessage(i, COLOR_GREEN, " AXIS have won this round ");
        }
        if(ALLIESKILLS > AXISKILLS)
        {
            SendClientMessage(i, COLOR_GREEN, " ALLIES have won this round ");
        }
        if(ALLIESKILLS == AXISKILLS && AXISDEATHS < ALLIESDEATHS)
        {
            SendClientMessage(i, COLOR_GREEN, " Allies and Axis had the same kills but Axis had less deaths so they win!");
        }
        if(ALLIESKILLS == AXISKILLS && ALLIESDEATHS < AXISDEATHS)
        {
            SendClientMessage(i, COLOR_GREEN, " Allies and Axis had the same kills but Allies had less deaths so they win!");
        }
    }
    return 1;
}



Re: Chat box gets spammed then server crashes - Vince - 18.03.2012

Show where this function gets called in the first place. As far as I can see there's nothing wrong with that (although subject to improvement).


Re: Chat box gets spammed then server crashes - new121 - 18.03.2012

pawn Код:
public CamTime()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        SpawnInRound(i);
        SetTimer("RoundTimer", 60000, false);
    }
    return 1;
}
CamTime gets called in these stocks

pawn Код:
stock StartDesertRound()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        SendClientMessage(i, COLOR_YELLOW, " Map: Desert ");
        SendClientMessage(i, COLOR_YELLOW, "Round Time: 10 minutes ");
        SendClientMessage(i, COLOR_YELLOW, "Rack up as many kills as you can!");
        SendClientMessage(i, COLOR_YELLOW, "At the end of the round voting for the next will begin!");
        SetPlayerCameraPos(i, -218.8484, 1851.0262, 168.4845);
        SetPlayerPos(i, -218.8484,1851.0262,168.4845);
        SetPlayerCameraLookAt(i, -231.0072,1644.3071,67.1937);
        ShowPlayerDialog(i, 4, DIALOG_STYLE_LIST, "Weapons", "Deagle\rShotgun\nSniper\rDeagle\nAk47\rDeagle\nM4\rMP5", "Ok", "");
        desertround = 1;
        SetPlayerHealth(i, 100);
        SetTimer("CamTime", 20000, false);
        TogglePlayerControllable(i, 0);
        roundinprogress = true;
    }
    return 1;
}
stock StartWoodsRound()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        SendClientMessage(i, COLOR_YELLOW, " Map: Woods ");
        SendClientMessage(i, COLOR_YELLOW, "Round Time: 10 minutes ");
        SendClientMessage(i, COLOR_YELLOW, "Rack up as many kills as you can!");
        SendClientMessage(i, COLOR_YELLOW, "At the end of the round voting for the next will begin!");
        SetPlayerCameraPos(i, -1663.4386,-2248.3936,34.4361);
        SetPlayerPos(i, -1663.4386,-2248.3936,34.4361);
        SetPlayerCameraLookAt(i, -1613.8433,-2169.3018,23.7248);
        //ShowPlayerDialog(i, 4, DIALOG_STYLE_LIST, "Weapons", "Deagle\rShotgun\nSniper\rDeagle\nAk47\rDeagle\nM4\rMP5", "Ok", "");
        woodsround ++;
        SetTimer("CamTime", 20000, false);
        roundinprogress = true;
    }
    return 1;
}
stock StartBaysideRound()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        SendClientMessage(i, COLOR_YELLOW, " Map: Bayside ");
        SendClientMessage(i, COLOR_YELLOW, "Round Time: 10 minutes ");
        SendClientMessage(i, COLOR_YELLOW, "Rack up as many kills as you can!");
        SendClientMessage(i, COLOR_YELLOW, "At the end of the round voting for the next will begin!");
        SetPlayerPos(i, -2669.0940,2213.4553,74.6946);
        SetPlayerCameraPos(i, -2669.0940,2213.4553,74.6946);
        SetPlayerCameraLookAt(i, -2243.0249,2461.7085,4.9764);
        //ShowPlayerDialog(i, 4, DIALOG_STYLE_LIST, "Weapons", "Deagle\rShotgun\nSniper\rDeagle\nAk47\rDeagle\nM4\rMP5", "Ok", "");
        baysideround ++;
        SetTimer("CamTime", 20000, false);
        roundinprogress = true;

    }
    return 1;
}



Re: Chat box gets spammed then server crashes - Vince - 18.03.2012

Quote:
Originally Posted by new121
Посмотреть сообщение
pawn Код:
public CamTime()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        SpawnInRound(i);
        SetTimer("RoundTimer", 60000, false);
    }
    return 1;
}
This sets 500 different timers, hence the spam. Move the timer out of the loop and you should be good.


Re: Chat box gets spammed then server crashes - new121 - 18.03.2012

Thank you. Testing now but this makes complete sense so, I'm sure it will work


Re: Chat box gets spammed then server crashes - new121 - 19.03.2012

Ok for some reason I had to change the variable in my loops to different variabls instead of i I guess they were conflicting