PDA

View Full Version : Libcod



nerdiiii
25th March 2019, 10:07
Hello again, sorry for spamming, but I've got a problem while running my server with libcod



#!/bin/bash

sv_maxclients="24"
fs_game="sdpammode"
fs_homepath="/root/cod2"
cod="/root/cod2/cod2_lnxded"
com_hunkMegs="256"
config="server.cfg"
cracked="1"
net_port="28960"


args=\
"+set fs_homepath \"$fs_homepath\" "\
"+set sv_cracked $cracked "\
"+set fs_game $fs_game "\
"+set net_port $net_port "\
"+set com_hunkMegs $com_hunkMegs "\
"+set sv_maxclients $sv_maxclients "\
"+set fs_basepath \"$fs_homepath\" "\
"+exec $config"

LD_PRELOAD="/root/libcod/bin/libcod2_1_3.so" $cod $args +set g_gametype sd +map mp_toujane


I've saved that as a .sh file and added it to " /root "

so, after I try to run it, an error appears


./server.sh: line 2: $'\r': command not found
./server.sh: line 11: $'\r': command not found
./server.sh: line 12: $'\r': command not found
: No such file or directoryfs_homepath "/root/cod2
./server.sh: line 15: $'+set sv_cracked 1\r \r': command not found
./server.sh: line 16: $'+set fs_game sd_polat_bigjump\r \r': command not found
./server.sh: line 17: $'+set net_port 28960\r \r': command not found
./server.sh: line 18: $'+set com_hunkMegs 256\r \r': command not found
./server.sh: line 19: $'+set sv_maxclients 24\r \r': command not found
: No such file or directoryfs_basepath "/root/cod2
./server.sh: line 21: $'+exec 1qaz.cfg\r\r': command not found
./server.sh: line 22: $'\r': command not found
: No such file or directory/cod2/cod2_lnxded



Please, help me to solve this problem! I need libcod for my server

IzNoGoD
25th March 2019, 17:08
Dont edit your .sh file on windows, it adds a \r\n at the end of each line, whereas linux expects a \n only.

nerdiiii
25th March 2019, 17:26
I tried to do it through
nano run.sh and edited it, but it shows the same error

IzNoGoD
25th March 2019, 19:54
I tried to do it through
nano run.sh and edited it, but it shows the same error

delete the line ends in nano, then add them back in. It should fix up the errors you're seeing.

nerdiiii
25th March 2019, 22:11
Thank you so much man! it's working

maxdamage99
26th March 2019, 10:07
Dont edit your .sh file on windows, it adds a \r\n at the end of each line, whereas linux expects a \n only.

i think dos2unix cant fix it

snoopdoge90
1st July 2019, 20:00
Notepad++ is every developers friend on Windows - your basic free lightweight replacement for quick edits with some power functions. Linux files? Just right click on 'Windows (CR LF)' on the right bottom of the screen and click 'Unix (LF)'. Problem solved!

You must be into SM if you like to use VIM (or into a lesser extend Nano) on your Linux terminal. Windows is my daily driver and sometimes I wonder what the hell I'm doing in those terminals and VIM where I just can launch open Notepad++ directly from SSH on my Windows machine. I guess I'm into SM :rolleyes: .