SA-MP Forums Archive
Some players appear afk,but there are not! - 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: Some players appear afk,but there are not! (/showthread.php?tid=485683)



Some players appear afk,but there are not! - nhunor58 - 05.01.2014

Hello everybody!

My problem is that some players for example two appear afk to the rest of the players but they say that there are not AFK.The AFK players client shows that they move they can do everything but for the rest of the players it shows that there are AFK,they stay at the spawn and can nothing to do.
Also after a server restart there are still AFK,but if they join with an another nickname the server there don't appear afk anymore..
I don't know why is this happening,so please help me..


Re : Some players appear afk,but there are not! - [HRD]Mar1 - 05.01.2014

I have the same problem due to losing updates from the server i guess it's from 0.3x-r2 client.


Re: Some players appear afk,but there are not! - SyntaxQ - 05.01.2014

I think you have to reset the variables on every connect and disconnect.

For Example:
pawn Код:
public OnPlayerConnect (playerid)
{
      PlayerInfo[ playerid ][ isAFK ] = 0;
      return 1;
}

public OnPlayerDisconnect (playerid, reason)
{
     PlayerInfo[ playerid ][ isAFK ] = 0;
     return 1;
}



Re: Some players appear afk,but there are not! - nhunor58 - 05.01.2014

Quote:
Originally Posted by SyntaxQ
Посмотреть сообщение
I think you have to reset the variables on every connect and disconnect.

For Example:
pawn Код:
public OnPlayerConnect (playerid)
{
      PlayerInfo[ playerid ][ isAFK ] = 0;
      return 1;
}

public OnPlayerDisconnect (playerid, reason)
{
     PlayerInfo[ playerid ][ isAFK ] = 0;
     return 1;
}
I don't think that the problem is this because if the variable it would be 1 the player could not write messages but he can and we saw his messages in the chat!


Re: Some players appear afk,but there are not! - SyntaxQ - 05.01.2014

Show me your commands (/afk, /back)..


Re: Some players appear afk,but there are not! - nhunor58 - 05.01.2014

Command /afk:
pawn Код:
CMD:afk( playerid, params[ ] )
{
    if ( PlayerInfo[ playerid ][ isafk ] == 1 )
        Announce( playerid, "~r~ERROR!: ~y~You are already in AFK mode!", 4000, 4 );

    new Float:x, Float:y, Float:z;
    gsString[ 0 ] = EOS;
    foreach(new i: Player) if ( PlayerInfo[ i ][ HideTDSSSS ] != 1 )
    {
        format( gsString, 144, "~r~ ~n~  ~n~  ~n~  ~n~  ~n~  ~n~ ~n~ ~n~ ~r~ %s ~w~ is now ~g~AFK.", PlayerName( playerid ) );
        GameTextForAll( gsString, 4000, 3 );
    }
    TogglePlayerControllable( playerid, 0 );
    SetPlayerVirtualWorld( playerid, ( playerid + 1 ) );
   
    SetPlayerPos( playerid, 2736.9937, -1758.0190, 17.4084 );
    SetPlayerFacingAngle( playerid, 145.8286 );
   
    TogglePlayerControllable( playerid, false );
    SetTimerEx( "ToggleTrue", 4000, 0, "d", playerid );

    PlayerInfo[ playerid ][ isafk ] = 1;
    GetPlayerPos( playerid, x, y, z );
    SetPVarFloat( playerid, "X", x );
    SetPVarFloat( playerid, "Y", y );
    SetPVarFloat( playerid, "Z", z );
    return ( 1 );
}
Command /back:
pawn Код:
CMD:back( playerid, params[ ] )
{
    if ( PlayerInfo[ playerid ][ isafk ] == 0 )
        Announce( playerid, "~r~ERROR!: ~y~You are not ~r~AFK ~y~or ~r~BRB.", 4000, 4 );

    gsString[ 0 ] = EOS;
    foreach(new i: Player) if ( PlayerInfo[ i ][ HideTDSSSS ] != 1 )
    {
        format( gsString, sizeof( gsString ), "~r~ ~n~  ~n~  ~n~  ~n~  ~n~  ~n~  ~n~ ~n~ ~n~ ~r~ %s ~w~ is now ~g~back.", PlayerName( playerid ) );
        GameTextForAll( gsString, 4000, 3 );
    }
    SetPlayerPos( playerid, GetPVarFloat( playerid, "X" ), GetPVarFloat( playerid, "Y" ), GetPVarFloat( playerid, "Z" ) );
    SetPlayerVirtualWorld( playerid, 0 );
    PlayerInfo[ playerid ][ isafk ] = 0;
    return ( 1 );
}
And the variables are resetted at OnPlayerConnect and OnPlayerDisconnect


Re: Some players appear afk,but there are not! - SyntaxQ - 05.01.2014

pawn Код:
CMD:afk ( playerid, params[] )
{
      if ( PlayerInfo[ playerid ][ isafk ] == 1 )
        Announce( playerid, "~r~ERROR!: ~y~You are already in AFK mode!", 4000, 4 );
      PlayerInfo[ playerid ][ isafk] = 1;
      TogglePlayerControllable( playerid, 0 );
      // You can add all those GameTexts here..
      return 1;
}
pawn Код:
CMD:back ( playerid, params[] )
{
      if ( PlayerInfo[ playerid ][ isafk ] == 0 )
        Announce( playerid, "~r~ERROR!: ~y~You are not ~r~AFK ~y~or ~r~BRB.", 4000, 4 );
      PlayerInfo[ playerid ][ isafk ] = 0;
      TogglePlayerControllable( playerid, 1 );
      // You can add all those GameTexts here..
      return 1;
}
Sorry, but I don't know how those timers work..


Re: Some players appear afk,but there are not! - nhunor58 - 05.01.2014

Quote:
Originally Posted by SyntaxQ
Посмотреть сообщение
pawn Код:
CMD:afk ( playerid, params[] )
{
      if ( PlayerInfo[ playerid ][ isafk ] == 1 )
        Announce( playerid, "~r~ERROR!: ~y~You are already in AFK mode!", 4000, 4 );
      PlayerInfo[ playerid ][ isafk] = 1;
      TogglePlayerControllable( playerid, 0 );
      // You can add all those GameTexts here..
      return 1;
}
pawn Код:
CMD:back ( playerid, params[] )
{
      if ( PlayerInfo[ playerid ][ isafk ] == 0 )
        Announce( playerid, "~r~ERROR!: ~y~You are not ~r~AFK ~y~or ~r~BRB.", 4000, 4 );
      PlayerInfo[ playerid ][ isafk ] = 0;
      TogglePlayerControllable( playerid, 1 );
      // You can add all those GameTexts here..
      return 1;
}
Sorry, but I don't know how those timers work..
Thanks for the code,but i'm pretty sure that is not from the AFK system..It must be something else..
Anyway,i will test it


Re: Some players appear afk,but there are not! - nhunor58 - 05.01.2014

Still have the problem...Someone?


Re : Some players appear afk,but there are not! - [HRD]Mar1 - 05.01.2014

Do you have ping kick system ?