14.01.2015, 16:50
When a player is in motion and he clicks the ESC button the afk system does not work. But if a player is standing and he clicks ESC it works.
The same problem is with player who is in the water but then does not need the esc button it's still doesn't work...
My code, what would you recommend to add?
The same problem is with player who is in the water but then does not need the esc button it's still doesn't work...
My code, what would you recommend to add?
pawn Код:
if( IsPlayerInAnyVehicle( playerid123 ) )
{
if( !IsVehicleMoving( GetPlayerVehicleID(playerid123) ) )
{
if( AFKMODE[ playerid123 ] == false )
{
AFKKINT[ playerid123 ] ++;
}
}
else
{
if( AFKMODE[ playerid123 ] == false )
{
if( AFKKINT[ playerid123 ] > 0 )
{
AFKKINT[ playerid123 ] = 0;
}
}
}
}
else
{
if( !IsPlayerMoving( playerid123 ) )
{
if( AFKMODE[ playerid123 ] == false )
{
AFKKINT[ playerid123 ] ++;
}
}
else
{
if( AFKMODE[ playerid123 ] == false )
{
if( AFKKINT[ playerid123 ] > 0 )
{
AFKKINT[ playerid123 ] = 0;
}
}
}
stock IsPlayerMoving(playerid)
{
GetPlayerVelocity(playerid, Velocity[ playerid ][0], Velocity[ playerid ][1],Velocity[ playerid ][2]);
if(Velocity[ playerid ][0] == 0 && Velocity[ playerid ][1] == 0 && Velocity[ playerid ][2] == 0) return 0;
return 1;
}
stock IsVehicleMoving(vehicleid)
{
GetVehicleVelocity(vehicleid, Velocity[ vehicleid ][0], Velocity[ vehicleid ][1], Velocity[ vehicleid ][2]);
if(Velocity[ vehicleid ][0] == 0 && Velocity[ vehicleid ][1] == 0 && Velocity[ vehicleid ][2] == 0) return 0;
return 1;
}
}