Guest User

Grander

a guest
Nov 14th, 2010
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. #include <a_samp> // Credits ---> SA-MP team
  2. #include <zcmd> // Credits ---> ZeeX
  3. #define AFK 1 /// 1 - Enable // 0 - Disable.
  4. #define TEXT 1 // 1 - Enable // 0 - Disable
  5. #define YELLOW 0xFFCC78FF // Yellow Color.
  6. #define TIME 10 // How many minutes player need to wait, before using command again?
  7. #pragma tabsize 0
  8. new
  9. Text3D:aText[ MAX_PLAYERS ]
  10. ;
  11.  
  12. public OnPlayerConnect( playerid )
  13. {
  14. SendClientMessage(playerid, YELLOW, "This is using Gh0sT_ AFK system.");
  15. return true;
  16. }
  17. COMMAND:afk(playerid, params[])
  18. {
  19. if(GetPVarInt( playerid , "pAFK") == 1 ) return SendClientMessage( playerid, YELLOW , "Dude, wait 10minutes!" );
  20. if(GetPVarInt( playerid, "nAFK") == 1 ) BackToGame( playerid );
  21. SetPVarInt(playerid, "nAFK", 1 );
  22. SetPVarInt(playerid, "pAFK", 1 );
  23. new
  24. String[ 37 ],
  25. pName[ 24 ]
  26. ;
  27. GetPlayerName( playerid, pName, 24 );
  28. format( String , 37 , "%s is now AFK!", pName );
  29. SendClientMessageToAll( YELLOW, String );
  30. SetTimerEx( "CantUse", 60000*TIME, false, "d", playerid );
  31. #if TEXT 1
  32. new
  33. Float:PosX,
  34. Float:PosY,
  35. Float:PosZ
  36. ;
  37. GetPlayerPos( playerid, PosX, PosY, PosZ );
  38. aText[playerid] = Create3DTextLabel("This player is AFK!", YELLOW , PosX , PosY , PosZ+1.0 , 20.0 , 1 );
  39. Attach3DTextLabelToPlayer(aText[ playerid ], playerid , 0 , 0 , 2.0 );
  40. #endif
  41. return true;
  42. }
  43. forward CantUse( playerid );
  44. public CantUse( playerid )
  45. {
  46. SetPVarInt( playerid, "pAFK", 0 );
  47. SendClientMessage( playerid, YELLOW, "You can use /afk now." );
  48. return true;
  49. }
  50. stock BackToGame( playerid )
  51. {
  52. new
  53. String[ 38 ],
  54. pName[ 24 ]
  55. ;
  56. GetPlayerName( playerid, pName, 24 );
  57. format( String, 38 , "%s is now back!" );
  58. SendClientMessageToAll( YELLOW, String );
  59. SetPVarInt( playerid, "nAFK", 0 );
  60. #if TEXT 1
  61. Delete3DTextLabel(aText[playerid]);
  62. #endif
  63. return true;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment