OnPlayerUpdate - 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: OnPlayerUpdate (
/showthread.php?tid=428146)
OnPlayerUpdate -
Blackazur - 04.04.2013
Код:
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?
Re: OnPlayerUpdate -
Scenario - 04.04.2013
Considering 0.3x has inbuilt pause-detection now, that is pretty useless- don't you think?
How often is "pausecheck()" being called?
AW: OnPlayerUpdate -
Blackazur - 04.04.2013
I think one time or so.
Re: OnPlayerUpdate -
Scenario - 04.04.2013
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.
AW: OnPlayerUpdate -
Blackazur - 04.04.2013
It isnt an timer.
Re: OnPlayerUpdate -
Face9000 - 04.04.2013
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.