@ -197,14 +197,15 @@ fn_mod_get_info() {
# Variable to know when job is done.
modinfocommand = "0"
# Find entry in global array.
for ( ( index = 0; index <= ${# mods_global_array [@] } ; index++) ) ; do
for ( ( index = 0; index < ${# mods_global_array [@] } ; index++) ) ; do
# When entry is found.
if [ " ${ mods_global_array [index] } " = = " ${ currentmod } " ] ; then
# Go back to the previous "MOD" separator.
for ( ( index = index; index <= ${# mods_global_array [@] } ; index --) ) ; do
for ( ( index_search = index; index_search >= 0; index_search --) ) ; do
# When "MOD" is found.
if [ " ${ mods_global_array [index] } " = = "MOD" ] ; then
if [ " ${ mods_global_array [index_search ] } " = = "MOD" ] ; then
# Get info.
index = ${ index_search }
fn_mods_define
modinfocommand = "1"
break
@ -331,7 +332,7 @@ fn_compatible_mod_engines() {
# How many engines we need to test.
enginesamount = $( echo -e " ${ modengines } " | awk -F ';' '{ print NF }' )
# Test all subvalue of "modengines" using the ";" separator.
for ( ( gamevarindex = 1; gamevarindex < ${ enginesamount } ; gamevarindex++) ) ; do
for ( ( gamevarindex = 1; gamevarindex < enginesamount; gamevarindex++) ) ; do
# Put current engine name into modtest variable.
enginemodtest = $( echo -e " ${ modengines } " | awk -F ';' -v x = ${ gamevarindex } '{ print $x }' )
# If engine name matches.
@ -472,7 +473,7 @@ fn_mods_check_installed() {
# Count installed mods.
fn_mods_count_installed
# If no mods are found.
if [ ${ installedmodscount } -eq 0 ] ; then
if [ " ${ installedmodscount } " -eq 0 ] ; then
echo -e ""
fn_print_failure_nl "No installed mods or addons were found"
echo -e " * Install mods using LinuxGSM first with: ./ ${ selfname } mods-install "
@ -689,13 +690,9 @@ fn_mod_install_amxmodx_file() {
# since it does exist, is the entry already in plugins.ini
logentry = " line (linux addons/amxmodx/dlls/amxmodx_mm_i386.so) inserted into ${ modinstalldir } /addons/metamod/plugins.ini "
echo -en "adding amxmodx_mm_i386.so in plugins.ini..."
grep -q "amxmodx_mm_i386.so" " ${ modinstalldir } /addons/metamod/plugins.ini "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
if ! grep -q "amxmodx_mm_i386.so" " ${ modinstalldir } /addons/metamod/plugins.ini " ; then
# file exists but the entry does not, let's add it
echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" >> " ${ modinstalldir } /addons/metamod/plugins.ini "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
if ! echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" >> " ${ modinstalldir } /addons/metamod/plugins.ini " ; then
fn_script_log_fail " ${ logentry } "
fn_print_fail_eol_nl
else
@ -705,9 +702,7 @@ fn_mod_install_amxmodx_file() {
fi
else
# create new file and add the mod to it
echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" > " ${ modinstalldir } /addons/metamod/plugins.ini "
exitcode = $?
if [ " ${ exitcode } " -ne 0 ] ; then
if ! echo "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" > " ${ modinstalldir } /addons/metamod/plugins.ini " ; then
fn_script_log_fail " ${ logentry } "
fn_print_fail_eol_nl
core_exit.sh
@ -723,10 +718,8 @@ fn_mod_remove_amxmodx_file() {
# since it does exist, is the entry already in plugins.ini
logentry = " line (linux addons/amxmodx/dlls/amxmodx_mm_i386.so) removed from ${ modinstalldir } /addons/metamod/plugins.ini "
echo -en "removing amxmodx_mm_i386.so in plugins.ini..."
grep -q "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" " ${ modinstalldir } /addons/metamod/plugins.ini "
# iIs it found? If so remove it and clean up
exitcode = $?
if [ " ${ exitcode } " -eq 0 ] ; then
# is it found? If so remove it and clean up
if grep -q "linux addons/amxmodx/dlls/amxmodx_mm_i386.so" " ${ modinstalldir } /addons/metamod/plugins.ini " ; then
# delete the line we inserted
sed -i '/linux addons\/amxmodx\/dlls\/amxmodx_mm_i386.so/d' " ${ modinstalldir } /addons/metamod/plugins.ini "
# remove empty lines