OnPlayerUpdate
#1

Код:
public OnPlayerUpdate(playerid)
{
	new Float:hp;
	GetPlayerHealth(playerid,hp);
    if(hp <= 1.0) return SetPlayerHealth(playerid,-1.0);

	if(Map[AllowWater] == 0)
	{
    	if(IsPlayerInWater(playerid))
		{
			SetPlayerHealth(playerid,0.0);
		}
	}
    PauseTime[playerid] = gettime();
	return 1;
}
Код:
forward pausecheck();
public pausecheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new PausedSeconds = gettime()-PauseTime[i];
        if(PausedSeconds > 5)
        SetPlayerChatBubble(i, "Paused", COLOR_YELLOW, 100.0, 5000);
        }
    return 1;
}
How to make that more ressourcefree?
Reply
#2

Considering 0.3x has inbuilt pause-detection now, that is pretty useless- don't you think?

How often is "pausecheck()" being called?
Reply
#3

I think one time or so.
Reply
#4

It's a timer, right?

So, is it a timer that gets called once every second, once every minute, once every hour? Show the SetTimer function that calls this.
Reply
#5

It isnt an timer.
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Considering 0.3x has inbuilt pause-detection now, that is pretty useless- don't you think?
0.3x has the inbuilt pause system but for large server is not enough. And trust me, with a large server you have to detect death evaders, tons of them, and the default pause system isn't enough.


pawn Код:
public pausecheck()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        new PausedSeconds = gettime()-PauseTime[i];
        if(PausedSeconds > 10 || PausedSeconds < 20)
        SetPlayerChatBubble(i, "Paused", COLOR_YELLOW, 100.0, 5000);
        }
    return 1;
}
Increase the pausing time delay because with 5 seconds it gonna "spam" your CPU hard. Also 5 seconds isn't a good time for detecting a paused player since i can press ESC just to check the map.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)