Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp> // Credits ---> SA-MP team
- #include <zcmd> // Credits ---> ZeeX
- #define AFK 1 /// 1 - Enable // 0 - Disable.
- #define TEXT 1 // 1 - Enable // 0 - Disable
- #define YELLOW 0xFFCC78FF // Yellow Color.
- #define TIME 10 // How many minutes player need to wait, before using command again?
- #pragma tabsize 0
- new
- Text3D:aText[ MAX_PLAYERS ]
- ;
- public OnPlayerConnect( playerid )
- {
- SendClientMessage(playerid, YELLOW, "This is using Gh0sT_ AFK system.");
- return true;
- }
- COMMAND:afk(playerid, params[])
- {
- if(GetPVarInt( playerid , "pAFK") == 1 ) return SendClientMessage( playerid, YELLOW , "Dude, wait 10minutes!" );
- if(GetPVarInt( playerid, "nAFK") == 1 ) BackToGame( playerid );
- SetPVarInt(playerid, "nAFK", 1 );
- SetPVarInt(playerid, "pAFK", 1 );
- new
- String[ 37 ],
- pName[ 24 ]
- ;
- GetPlayerName( playerid, pName, 24 );
- format( String , 37 , "%s is now AFK!", pName );
- SendClientMessageToAll( YELLOW, String );
- SetTimerEx( "CantUse", 60000*TIME, false, "d", playerid );
- #if TEXT 1
- new
- Float:PosX,
- Float:PosY,
- Float:PosZ
- ;
- GetPlayerPos( playerid, PosX, PosY, PosZ );
- aText[playerid] = Create3DTextLabel("This player is AFK!", YELLOW , PosX , PosY , PosZ+1.0 , 20.0 , 1 );
- Attach3DTextLabelToPlayer(aText[ playerid ], playerid , 0 , 0 , 2.0 );
- #endif
- return true;
- }
- forward CantUse( playerid );
- public CantUse( playerid )
- {
- SetPVarInt( playerid, "pAFK", 0 );
- SendClientMessage( playerid, YELLOW, "You can use /afk now." );
- return true;
- }
- stock BackToGame( playerid )
- {
- new
- String[ 38 ],
- pName[ 24 ]
- ;
- GetPlayerName( playerid, pName, 24 );
- format( String, 38 , "%s is now back!" );
- SendClientMessageToAll( YELLOW, String );
- SetPVarInt( playerid, "nAFK", 0 );
- #if TEXT 1
- Delete3DTextLabel(aText[playerid]);
- #endif
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment