HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <sourcemod>
  2. #include <geoip>
  3. #pragma tabsize 0
  4.  
  5. new Handle:h_connectmsg = INVALID_HANDLE;
  6. new Handle:h_disconnectmsg = INVALID_HANDLE;
  7.  
  8. public Plugin:myinfo =
  9. {
  10. name = "Connect MSG",
  11. author = "Crazy",
  12. description = "Csatlakozó üzenet",
  13. version = "1.0",
  14. url = "https://forums.alliedmods.net/showthread.php?t=265993"
  15. };
  16.  
  17. public OnPluginStart()
  18. {
  19. h_connectmsg = CreateConVar("sm_connectmsg", "1", "A felcsatlakozási üzenet bekapcsolása, 1 bekapcsolva, 0 kikapcsolva.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
  20. h_disconnectmsg = CreateConVar("sm_disconnectmsg", "1", "A lecsatlakozási üzenet bekapcsolása, 1 bekapcsolva, 0 kikapcsolva.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
  21. }
  22.  
  23. public OnClientPutInServer(client)
  24. {
  25. new Connect = GetConVarInt(h_connectmsg);
  26. if(Connect == 1)
  27. {
  28. new String:name[99], String:authid[99], String:IP[99], String:Country[99];
  29.  
  30. GetClientName(client, name, sizeof(name));
  31.  
  32. GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
  33.  
  34. GetClientIP(client, IP, sizeof(IP), true);
  35.  
  36. if(!GeoipCountry(IP, Country, sizeof Country))
  37. {
  38. Country = "Unknown Country";
  39. }
  40. PrintToChatAll(" \x04[CONNECT]\x03 %s (%s) csatlakozott. \x01Ország: \x04[%s]", name, authid, Country);
  41.  
  42. } else {
  43.  
  44. CloseHandle(h_connectmsg);
  45. }
  46. }
  47.  
  48. public OnClientDisconnect(client)
  49. {
  50. new Disconnect = GetConVarInt(h_disconnectmsg);
  51. if(Disconnect == 1)
  52.  
  53. {
  54. new String:name[99], String:authid[99], String:IP[99], String:Country[99];
  55.  
  56. GetClientName(client, name, sizeof(name));
  57.  
  58. GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
  59.  
  60. GetClientIP(client, IP, sizeof(IP), true);
  61.  
  62. if(!GeoipCountry(IP, Country, sizeof Country))
  63.  
  64. {
  65. Country = "Unknown Country";
  66. }
  67.  
  68. PrintToChatAll(" \x04[DISCONNECT]\x03 %s (%s) lecsatlakozott. \x01Ország: \x04[%s]", name, authid, Country);
  69.  
  70. } else {
  71.  
  72. CloseHandle(h_disconnectmsg);
  73. }
  74.  
  75. }