fn_servername 1.1 KB

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # LGSM fn_servername function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 150115
  6. # Description: Gets the server name.
  7. if [ "${engine}" == "avalanche" ]; then
  8. servername=$(grep -s Name "${servercfgfullpath}"|sed 's/Name//g' | tr -d '=\"; '|sed 's/,//g')
  9. elif [ "${engine}" == "realvirtuality" ]; then
  10. servername=$(grep -s hostname "${servercfgfullpath}"| grep -v //|sed -e 's/\<hostname\>//g'| tr -d '=\"; ')
  11. elif [ "${engine}" == "seriousengine35" ]; then
  12. servername=$(grep -s prj_strMultiplayerSessionName "${servercfgfullpath}"|sed 's/prj_strMultiplayerSessionName = //g'|sed 's/"//g'|sed 's/;//g')
  13. elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
  14. servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
  15. elif [ "${engine}" == "spark" ]; then
  16. : # Not in config file
  17. elif [ "${engine}" == "unity3d" ]; then
  18. servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
  19. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  20. servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
  21. fi