Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Virsui modo
- #define AFK_TIKRINIMAI 3
- #define AFK_DIALOGAS 1337
- new
- tAFK[ MAX_PLAYERS ], // afk tikrinimu skaicius
- bool:isAFK[ MAX_PLAYERS ], // ar zaidejas yra afk
- Float:afkP[ MAX_PLAYERS ][ 3 ]; // Zaidejo paskutine pozicija
- // OnGameModeInit
- SetTimer( "AFKt", 10000, true ); // AFK globalus timeris, kas 10 sekundziu
- forward AFKt( );
- public AFKt( )
- {
- for( new p; p < MAX_PLAYERS; p ++ ) if( IsPlayerConnected( p ) && !IsPlayerNPC( p ) && !isAFK[ p ] ) // Ciklas per visus prisijungusius zaidejus kurie nera AFK
- {
- new
- Float:tempP[ 3 ];
- GetPlayerPos( p, tempP[ 0 ], tempP[ 1 ], tempP[ 2 ] );
- 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
- {
- tAFK[ p ] ++;
- if ( tAFK[ p ] >= AFK_TIKRINIMAI ) // 3 kartus, per 20-30 sekundziu nepakito jo pozicija, taigi zmogus AFK. ( pasikeist gali virsuje )
- {
- tAFK[ p ] = 0;
- isAFK[ p ] = true;
- ShowPlayerDialog( p, AFK_DIALOGAS, DIALOG_STYLE_MSGBOX, "AFK dialogas", "Jus buvote AFK, todel negavote XP ir pinigu", "SUPRATAU", "" );
- }
- }
- else afkP[ p ][ 0 ] = tempP[ 0 ], afkP[ p ][ 1 ] = tempP[ 1 ], afkP[ p ][ 2 ] = tempP[ 2 ];
- }
- }
- // OnDialogResponse
- if ( dialogid == AFK_DIALOGAS ) isAFK[ playerid ] = false;
- /*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