Detecting if player is not Moving?
#1

Title says half of it,

It's like an AUTO AFK SYSTEM , I've been searching but didn't find it, could anyone tell me how to do an auto afk system ,if the player is inactive for 30seconds i mean not moving and not moving his mouse to look around, it would kick him after 30seconds? I just can't figure it out how to do it. Could anyone help me?
Reply
#2

pawn Код:
stock Float:GetPlayerSpeed(playerid, bool:Z = true)
{
new Float:SpeedX, Float:SpeedY, Float:SpeedZ;
new Float:Speed;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), SpeedX, SpeedY, SpeedZ);
else GetPlayerVelocity(playerid, SpeedX, SpeedY, SpeedZ);
if(Z) Speed = floatsqroot(multifloatadd(floatpower(SpeedX, 2.0), floatpower(SpeedY, 2.0), floatpower(SpeedZ, 2.0)));
else Speed = floatsqroot(floatadd(floatpower(SpeedX, 2.0), floatpower(SpeedY, 2.0)));
return floatmul(Speed, 200.0);
}

stock bool:IsPlayerMoving(playerid) return GetPlayerSpeed(playerid) > 0.1;
Reply
#3

http://forum.sa-mp.com/index.php?topic=69197.0
Reply
#4

Quote:
Originally Posted by Killa_
No. Let him learn making it himself.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)