HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. *
  3. * Name: simplelog.sma
  4. *
  5. * Version: 1.0
  6. *
  7. * Purpose: S@ndel wants it.
  8. *
  9. * Usage: Logs name and ip address of each player who has connected to
  10. * the server. amx_logging cvar turns it on/off (1 - on).
  11. *
  12. */
  13.  
  14. #include <amxmodx>
  15.  
  16. new PLUGIN[]="SimpleLog"
  17. new AUTHOR[]="n!nja"
  18. new VERSION[]="1.0"
  19.  
  20. public plugin_init()
  21. {
  22. // Register plugin
  23. register_plugin(PLUGIN, VERSION, AUTHOR)
  24. register_cvar("amx_logging", "1")
  25.  
  26. return PLUGIN_CONTINUE
  27. }
  28.  
  29. public client_connect(id)
  30. {
  31. if(get_cvar_num("amx_logging") == 1)
  32. {
  33. new username[32]
  34. new ipaddress[32]
  35.  
  36. new logline[192]
  37. new filename[100]
  38.  
  39. new mapname[64]
  40. get_mapname( mapname, 63 )
  41.  
  42. new CurrentTime[9]
  43. get_time("%H:%M:%S",CurrentTime,8)
  44.  
  45.  
  46. get_time("addons/amxmodx/playerips.log", filename, 99)
  47.  
  48. get_user_name(id, username, 31)
  49. get_user_ip(id, ipaddress, 31)
  50.  
  51. format(logline, 191, "%s - %s", username, ipaddress, CurrentTime, mapname)
  52. log_to_file(filename, logline)
  53. }
  54.  
  55. return PLUGIN_HANDLED
  56. }