check if player is idle..
#1

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

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

Maybe this could help you..

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

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
{
Reply
#5

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.
Reply
#6

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.
Reply
#7

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
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)