Advertisement
Guest User

AFK System by </Signature>

a guest
Apr 21st, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.58 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //                         AFK System by </Signature>                         //
  3. ////////////////////////////////////////////////////////////////////////////////
  4. #define FILTERSCRIPT
  5. #include <a_samp>
  6. #include <zcmd>
  7. ////////////////////////////////////////////////////////////////////////////////
  8.     new pName[24];
  9.     new string[128];
  10.     new string2[128];
  11.     new Mute[128];
  12.     new PlayerAFK[MAX_PLAYERS];
  13. ////////////////////////////////////////////////////////////////////////////////
  14. public OnFilterScriptInit()
  15. {
  16.     print("\n-----------------------------------------------------------");
  17.     print(" Filterscript: AFK System je uspjesno ucitana.");
  18.     print("-----------------------------------------------------------\n");
  19.     return 1;
  20. }
  21. ////////////////////////////////////////////////////////////////////////////////
  22. public OnFilterScriptExit()
  23. {
  24.     print("\n--------------------------------------------------------");
  25.     print(" Filterscript: AFK System je ucitana bez problema.");
  26.     print("--------------------------------------------------------\n");
  27.     return 1;
  28.  }
  29. ////////////////////////////////////////////////////////////////////////////////
  30. public OnPlayerConnect(playerid)
  31. {
  32.     PlayerAFK[playerid] = 0;
  33. }
  34. ////////////////////////////////////////////////////////////////////////////////
  35.     CMD:afklist(playerid, params[])
  36.     {
  37.         new string3[MAX_PLAYER_NAME], AFKIgraci[MAX_PLAYER_NAME];
  38.  
  39.         for(new pID = 0; pID < MAX_PLAYERS; pID ++)
  40.         {
  41.             if(IsPlayerConnected(pID))
  42.             {
  43.                 if(PlayerAFK[pID] == 1)
  44.                 {
  45.                     SendClientMessage(playerid, 0xB00000FF, "** AFK IGRACI **");
  46.                     GetPlayerName(playerid, AFKIgraci, sizeof(AFKIgraci));
  47.                     format(string3, sizeof(string3), "%s", AFKIgraci);
  48.                     SendClientMessage(playerid, 0xFFFFFFFF, string3);
  49.     }
  50.         }
  51.             }
  52.         return 1;
  53.                 }
  54. ////////////////////////////////////////////////////////////////////////////////
  55.     CMD:afk(playerid, params[])
  56.     {
  57.         if(PlayerAFK[playerid] == 0)
  58.         {
  59.             TogglePlayerControllable( playerid, 0);
  60.             GetPlayerName(playerid, pName, 24);
  61.             format(string, 128, "** AFK: {FFFFFF}Igrac %s je otisao {B00000}AFK.", pName);
  62.             SendClientMessageToAll( 0xB00000FF, string);
  63.             PlayerAFK[playerid] = 1;
  64.         }
  65.             else return SendClientMessage(playerid, 0xB00000FF, "ERROR: {FFFFFF}Trenutno ste vec AFK.");
  66.         return 1;
  67.     }
  68. ////////////////////////////////////////////////////////////////////////////////
  69.     CMD:back(playerid, params[])
  70.     {
  71.         if(PlayerAFK[playerid] == 1)
  72.         {
  73.             TogglePlayerControllable(playerid,1);
  74.             GetPlayerName(playerid, pName, 24);
  75.             format(string2, 128, "** AFK: {FFFFFF}Igrac %s vise nije {B00000}AFK.", pName);
  76.             SendClientMessageToAll( 0xB00000FF, string2 );
  77.             PlayerAFK[playerid] = 0;
  78.         }
  79.             else return SendClientMessage(playerid, 0xB00000FF, "ERROR: {FFFFFF}Trenutno niste AFK.");
  80.         return 1;
  81.     }
  82. ////////////////////////////////////////////////////////////////////////////////
  83. public OnPlayerDisconnect(playerid)
  84. {
  85.     PlayerAFK[playerid] = 0;
  86. }
  87. ////////////////////////////////////////////////////////////////////////////////
  88. public OnPlayerText(playerid, text[])
  89. {
  90.     if(PlayerAFK[playerid] == 1)
  91.     format(Mute, 128, "ERROR: {FFFFFF}Niste u mogucnosti pisati jer ste AFK !");
  92.     SendClientMessage(playerid, 0xB00000FF, Mute);
  93.     return 0;
  94. }
  95. ////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement