SA-MP Forums Archive
check if player is idle.. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: check if player is idle.. (/showthread.php?tid=186848)



check if player is idle.. - admantis - 30.10.2010

Hello I would like a code when you are idle for 5 minutes you get automatically kicked, i need this to prevent abusing.


Re: check if player is idle.. - Hal - 30.10.2010

get the player position, and check it every 5 min to see if its the same.
if so, then kick.


Re: check if player is idle.. - The_Moddler - 30.10.2010

Maybe this could help you..

https://sampforum.blast.hk/showthread.php?tid=186129


Re : Re: check if player is idle.. - admantis - 30.10.2010

Quote:
Originally Posted by Hal
Посмотреть сообщение
get the player position, and check it every 5 min to see if its the same.
if so, then kick.
Really.. I dont know how to script this, very confusing..
I have an idea in my head..

pawn Код:
new Float:X, Float:Y, Float:Z
GetPlayerPos(playerid,X,Y,Z);
new speed = GetPlayerVelocity(playerid,X,Y,Z);
if (speed < 1) return SetTimer("checkidle",5mins,0);

if (speed > 0) return KillTimer("checkidle");
pawn Код:
public checkidle(playerid)
{
if (speed < 1) return kick(playerid);
}
Would it work? :S
{


Re : Re: check if player is idle.. - admantis - 30.10.2010

Quote:
Originally Posted by The_Moddler
Посмотреть сообщение
I dont need if player is paused, thought that would become handy, and i might use it, i mean if player is idle (not paused) and he went for a nap or something he can get lots of money and stuff without even playing.


Re: Re : Re: check if player is idle.. - Hal - 30.10.2010

Quote:
Originally Posted by admantis
Посмотреть сообщение
Really.. I dont know how to script this, very confusing..
I have an idea in my head..

pawn Код:
new Float:X, Float:Y, Float:Z
GetPlayerPos(playerid,X,Y,Z);
new speed = GetPlayerVelocity(playerid,X,Y,Z);
if (speed < 1) return SetTimer("checkidle",5mins,0);

if (speed > 0) return KillTimer("checkidle");
pawn Код:
public checkidle(playerid)
{
if (speed < 1) return kick(playerid);
}
Would it work? :S
{
Possibly, but it would take to much memory, because its always running to check, and starts a timer everytime the player stops moving. using the speed/velocity wouldnt work.


Re : Re: Re : Re: check if player is idle.. - admantis - 30.10.2010

Quote:
Originally Posted by Hal
Посмотреть сообщение
Possibly, but it would take to much memory, because its always running to check, and starts a timer everytime the player stops moving. using the speed/velocity wouldnt work.
Ok if you have got any idea please reply here I will still be thinking heh


Re: Re : Re: check if player is idle.. - The_Moddler - 31.10.2010

Quote:
Originally Posted by admantis
Посмотреть сообщение
I dont need if player is paused, thought that would become handy, and i might use it, i mean if player is idle (not paused) and he went for a nap or something he can get lots of money and stuff without even playing.
80% of the times the player presses pause.

When they pres pause, you set a timer of 5 minutes or to whatever you want, then you put your script on that callback, if the timer didn't finish, when the player unpauses you kill the timer.

Just an idea.