fn_csgofix 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # LGSM fn_csgofix function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. lgsm_version="061115"
  6. # Description: Resolves various issues with csgo.
  7. # Fixed server not always creating steam_appid.txt file.
  8. fn_csgoappfix(){
  9. if [ ! -f "${filesdir}/steam_appid.txt" ]; then
  10. fn_printdots "Applying 730 steam_appid.txt Fix."
  11. sleep 1
  12. fn_printinfo "Applying 730 steam_appid.txt Fix."
  13. fn_scriptlog "Applying 730 steam_appid.txt Fix"
  14. sleep 1
  15. echo -en "\n"
  16. echo -n "730" >> "${filesdir}/steam_appid.txt"
  17. fi
  18. }
  19. fn_csgofixes(){
  20. # Fixes the following error:
  21. # Error parsing BotProfile.db - unknown attribute 'Rank".
  22. if ! grep -q "//Rank" "${systemdir}/botprofile.db" > /dev/null 2>&1; then
  23. echo "Applying botprofile.db fix."
  24. sleep 1
  25. echo ""
  26. echo "botprofile.db fix removes the following error from appearing on the console:"
  27. echo " Error parsing BotProfile.db - unknown attribute 'Rank"
  28. sleep 1
  29. sed -i 's/\tRank/\t\/\/Rank/g' "${systemdir}/botprofile.db" > /dev/null 2>&1
  30. if [[ $? != 0 ]]; then
  31. fn_printfailure "Applying botprofile.db fix."
  32. else
  33. fn_printcomplete "Applying botprofile.db fix."
  34. fi
  35. echo -en "\n"
  36. echo ""
  37. fi
  38. # Fixes errors simular to the following:
  39. # Unknown command "cl_bobamt_vert".
  40. if ! grep -q "//exec default" "${servercfgdir}/valve.rc" > /dev/null 2>&1 || ! grep -q "//exec joystick" "${servercfgdir}/valve.rc" > /dev/null 2>&1; then
  41. echo "Applying valve.rc fix."
  42. sleep 1
  43. echo ""
  44. echo "valve.rc fix removes the following error from appearing on the console:"
  45. echo " Unknown command \"cl_bobamt_vert\""
  46. sleep 1
  47. sed -i 's/exec default.cfg/\/\/exec default.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
  48. sed -i 's/exec joystick.cfg/\/\/exec joystick.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
  49. if [[ $? != 0 ]]; then
  50. fn_printfailure "Applying valve.rc fix."
  51. else
  52. fn_printcomplete "Applying valve.rc fix."
  53. fi
  54. echo -en "\n"
  55. echo ""
  56. fi
  57. # Fixes errors simular to the following:
  58. # http://forums.steampowered.com/forums/showthread.php?t=3170366.
  59. if [ -f "${systemdir}/subscribed_collection_ids.txt" ]||[ -f "${systemdir}/subscribed_file_ids.txt" ]||[ -f "${systemdir}/ugc_collection_cache.txt" ]; then
  60. echo "workshopmapfix fixes the following error:"
  61. echo " http://forums.steampowered.com/forums/showthread.php?t=3170366"
  62. sleep 1
  63. echo ""
  64. echo "Applying workshopmap fix."
  65. sleep 1
  66. rm -f "${systemdir}/subscribed_collection_ids.txt"
  67. rm -f "${systemdir}/subscribed_file_ids.txt"
  68. rm -f "${systemdir}/ugc_collection_cache.txt"
  69. if [[ $? != 0 ]]; then
  70. fn_printfailure "Applying workshopmap fix."
  71. else
  72. fn_printcomplete "Applying workshopmap fix."
  73. fi
  74. echo -en "\n"
  75. echo ""
  76. fi
  77. }
  78. if [ ! -z "${startfix}" ]; then
  79. fn_csgoappfix
  80. else
  81. fn_csgofixes
  82. fi