Forum

> > CS2D > Scripts > Lua error on dedicated...
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua error on dedicated...

5 replies
To the start Previous 1 Next To the start

old Lua error on dedicated...

Quattro
GAME BANNED Off Offline

Quote
Please someone help me, CS2D has a bug on dedicated server and I don't know how to bypass it anymore, last time I did it by luck by copying the file name over existing but now it doesn't work...

this is the report I get from dedicated:

[00:15:32] LUA ERROR: maps/dm_quake.lua:259: attempt to index local 'file' (a nil value)
[00:15:32] -> maps/dm_quake.lua:259: in function 'update_report'
[00:15:32] -> maps/dm_quake.lua:312: in function 'endsequence'
[00:15:32] -> maps/dm_quake.lua:38: in function <maps/dm_quake.lua:35>

This is the function which supposedly is incorrect although it works perfectly by starting new game:

1
2
3
4
5
6
function update_report(report)
	msg(string.char(169)..'255255255Match report has been added to ranking history')
	local file = io.open("sys/areports.txt", "a")
	file:write(report.. "\n")
	file:close()
end

How comes dedicated server can not do what starting new game can? Please help

old Re: Lua error on dedicated...

Quattro
GAME BANNED Off Offline

Quote
I thought that as well at start, I also posted this on other topic I think and I resolved it by selecting "areports.txt" on my pc, copying full name, then opening dedi and pasting the name over the existing "areports.txt"

And it fixed it for some reason
It must be a bug on dedicated cs2d


EDIT:
I found the problem finally.
This has something to do with text format (probably), while trying to read in write/append modes. Read mode is unaffected.

I deleted the file from dedicated server and let the script create it by itself. Now it can read the file without errors in all modes r/w/a
edited 3×, last 20.05.18 01:38:19 pm

old Re: Lua error on dedicated...

DC
Admin Off Offline

Quote
This is definitely not a bug in the dedicated server. In fact the dedicated server and the client use exactly the same code. There is no difference at all except that rendering, audio and input is stripped from the dedicated server.

Like user Yates assumed this clearly sounds like a rights & permissions problem. And all the stuff you described afterwards confirms it.

The Linux user you used to run CS2D probably did not have write permissions on that file. If the script creates the file itself it of course also has write permissions (otherwise it wouldn't be able to create the file at all).

You can easily change the rights on a file with chmod or a good file transfer client (assuming that you're using Linux for the server).

old Re: Lua error on dedicated...

VADemon
User Off Offline

Quote
1
2
3
4
5
6
7
function update_report(report)
     msg(string.char(169)..'255255255Match report has been added to ranking history')
     local file, err = io.open("sys/areports.txt", "a")
     if err then print("[reports] ".. err) end
     file:write(report.. "\n")
     file:close()
end
RTFM, my wieners!
io.open returns error codes!

In case of text encoding errors or crazily strange name problems open your file in a hex-editor. These symbols aren't the same a ~= а
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview