Advertisement
Guest User

Untitled

a guest
Jun 26th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.46 KB | None | 0 0
  1. // Virsui modo
  2. #define AFK_TIKRINIMAI 3
  3. #define AFK_DIALOGAS 1337
  4.  
  5. new
  6.     tAFK[ MAX_PLAYERS ], // afk tikrinimu skaicius
  7.     bool:isAFK[ MAX_PLAYERS ], // ar zaidejas yra afk
  8.     Float:afkP[ MAX_PLAYERS ][ 3 ]; // Zaidejo paskutine pozicija
  9.    
  10. // OnGameModeInit
  11.  
  12. SetTimer( "AFKt", 10000, true ); // AFK globalus timeris, kas 10 sekundziu
  13.  
  14. forward AFKt( );
  15. public AFKt( )
  16. {
  17.     for( new p; p < MAX_PLAYERS; p ++ ) if( IsPlayerConnected( p ) && !IsPlayerNPC( p ) && !isAFK[ p ] ) // Ciklas per visus prisijungusius zaidejus kurie nera AFK
  18.     {
  19.         new
  20.             Float:tempP[ 3 ];
  21.            
  22.         GetPlayerPos( p, tempP[ 0 ], tempP[ 1 ], tempP[ 2 ] );
  23.        
  24.         if ( tempP[ 0 ] == afkP[ p ][ 0 ] && tempP[ 1 ] == afkP[ p ][ 1 ] && tempP[ 2 ] == afkP[ p ][ 2 ] ) // Zaidejas 10 sekundziu nepajudejo is vietos, taigi nustatom kad jis yra afk
  25.         {
  26.             tAFK[ p ] ++;
  27.             if ( tAFK[ p ] >= AFK_TIKRINIMAI ) // 3 kartus, per 20-30 sekundziu nepakito jo pozicija, taigi zmogus AFK. ( pasikeist gali virsuje )
  28.             {
  29.                 tAFK[ p ] = 0;
  30.                 isAFK[ p ] = true;
  31.                 ShowPlayerDialog( p, AFK_DIALOGAS, DIALOG_STYLE_MSGBOX, "AFK dialogas", "Jus buvote AFK, todel negavote XP ir pinigu", "SUPRATAU", "" );
  32.             }
  33.         }
  34.         else afkP[ p ][ 0 ] = tempP[ 0 ], afkP[ p ][ 1 ] = tempP[ 1 ], afkP[ p ][ 2 ] = tempP[ 2 ];
  35.     }
  36. }
  37.  
  38. // OnDialogResponse
  39. if ( dialogid == AFK_DIALOGAS ) isAFK[ playerid ] = false;
  40.  
  41. /*Ir tikrini ten kur zaidjeui dudoa XP arba alga ar dar ka nors - taip: if ( !isAFK[ playerid ] ) DuodamAlga( playerid ); */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement