SA-MP Forums Archive
Question about hosting/lag etc. Also timer issue and small things. - 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: Question about hosting/lag etc. Also timer issue and small things. (/showthread.php?tid=480275)



Question about hosting/lag etc. Also timer issue and small things. - Dokins - 09.12.2013

Alright, basically I would like to clear this up.

I had an issue with Dialog opening having a delay (it still delays a little but not nearly as much). My question is...

For the purposes of a server development testing I had an account on King J servers, I purchased 2 slots.

Could for all intents and purposes opening a large dialog cause considerable lag?

When I went on localhost and hosted mysql etc locally, there is almost no delay at all.

Could someone suggest any fixes/other causes and a definitive answer?

TIMER ISSUE

Basically, my timer used as a clock like this:

21:31:45 format.

The seconds sometimes jump.

I tried using timerfix and it caused my timers to completely stop.

One other smaller question.

pawn Код:
for(new p = 0; p < MAX_PLAYERS; p++)
    {
        if(LoggedIn[p] == 1 && IsPlayerConnected(p))
        {
            if(AdminJail[p] > 0)
            {
                AdminJail[p] --;
               
                format(string, sizeof(string), "You have %d minute(s) left in Admin Jail.", AdminJail[p]);
                SendClientMessage(p, COLOUR_GREY, string);

                if(AdminJail[p] == 0)
                {
                    SendClientMessage(p, COLOUR_LIGHTBLUE, "You have been released from Admin Jail");
                    MySQL_SetInteger(PlayerSQLID[p], "AdminJail", -1, "accounts");
                    SetPlayerPos(p, -216.0915,972.2845,19.3201);
                    SetPlayerVirtualWorld(p, 0);
                    SetPlayerInterior(p, 0);
                    SetCameraBehindPlayer(p);//release.
                }
            }
        }
    }
This is under a one minute timer.

Why is that that although I make it send the client message updating the minutes if its > 0 that it still sends when it == 0. It's an annoying bug?

That would be great.


Re: Question about hosting/lag etc. Also timer issue and small things. - Vince - 09.12.2013

Rather poor coding. If AdminJail[p] is 1 it'll still fall through. The variable is then decremented resulting in the message: "You have 0 minute(s) left in Admin Jail.".


Re: Question about hosting/lag etc. Also timer issue and small things. - Dokins - 09.12.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
Rather poor coding. If AdminJail[p] is 1 it'll still fall through. The variable is then decremented resulting in the message: "You have 0 minute(s) left in Admin Jail.".
With all due respect, this doesn't exactly aid me in resolving this. I'm not exactly an expert scripter and I'm going through a learning process; forgive me.


Re: Question about hosting/lag etc. Also timer issue and small things. - Dokins - 10.12.2013

Still unresolved.


Re: Question about hosting/lag etc. Also timer issue and small things. - Patrick - 10.12.2013

Try this code, because when the variable is set to 0, the message will show every time the timer updates, so that will keep sending the releasing message and setting your Position, also made some edit on your code.

pawn Код:
for(new p = 0; p < MAX_PLAYERS; p++)
{
    if ( LoggedIn[ p ] == 0 && !IsPlayerConnected( p ) ) continue;
   
    if ( AdminJail[ p ] >= 1 )
    {
        AdminJail[ p ] --;
       
        format( string, sizeof( string ), "You have %d minute(s) left in Admin Jail.", AdminJail[ p ] );
        SendClientMessage( p, COLOUR_GREY, string );
    }
    else if ( AdminJail[ p ] <= 0 )
    {
        SendClientMessage( p, COLOUR_LIGHTBLUE, "You have been released from Admin Jail" );
        MySQL_SetInteger( PlayerSQLID[ p ], "AdminJail", -1, "accounts" );
        SetPlayerPos( p, -216.0915,972.2845,19.3201 ), SetPlayerVirtualWorld( p, 0 ),
        SetPlayerInterior( p, 0 ), SetCameraBehindPlayer( p );
    }
}