Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #pragma semicolon 1
  2.  
  3. #include <sourcemod>
  4. #include <clientprefs>
  5.  
  6. #pragma newdecls required
  7.  
  8. public Plugin myinfo =
  9. {
  10. name = "",
  11. author = "",
  12. description = "",
  13. version = ""
  14. };
  15.  
  16. ConVar g_cvFreeVipEnable;
  17. bool g_bFreeVip;
  18.  
  19. public void OnPluginStart()
  20. {
  21. g_cvFreeVipEnable = CreateConVar("sm_nightvip_enable", "1", "");
  22.  
  23. AutoExecConfig(true, "Charlie_FreeNightVIP");
  24. }
  25.  
  26. public void OnMapStart()
  27. {
  28. if (GetConVarBool(g_cvFreeVipEnable))
  29. {
  30. char godzina_str[8];
  31. FormatTime(godzina_str, sizeof(godzina_str), "%H", GetTime());
  32. int godzina = StringToInt(godzina_str);
  33.  
  34. if(godzina >= 22 || godzina < 8)
  35. g_bFreeVip = true;
  36. else
  37. g_bFreeVip = false;
  38. }
  39. }
  40.  
  41. public void OnClientPostAdminCheck(int client)
  42. {
  43. if(IsValidPlayer(client) && GetConVarBool(g_cvFreeVipEnable) && g_bFreeVip)
  44. AddUserFlags(client, Admin_Custom3);
  45. }
  46.  
  47. stock bool IsValidPlayer(int client)
  48. {
  49. if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
  50. return false;
  51. return true;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement