PDA

View Full Version : ERROR: SP_worldspawn: The first entity isn't 'worldspawn'



Earliboy
8th February 2013, 21:36
Hello,
i generated some log files to log some issues of my mod.
The problem is, when i delete the "\n" at the end of the log message, it gives me after map_restart an error.

********************
ERROR: SP_worldspawn: The first entity isn't 'worldspawn'
********************

Btw, for telling me "Bla bla mapping" the map is mp_toujane. After removing the "\n" the error happends. Evene with " " it happends.

I deleted the \n cause append do not need it.



thread earlmod\_logging::stats("L: Done loading stats file of Guid " + guid + " rank is " + self.stats["rank"] + " xp is " + self.stats["xp"] + "\n");



stats(mess)
{
if(!level.logging["stats"])
return;

if(!isDefined(mess))
return;

file = openFile(level.logging_file["stats"], "append");
fPrintln(file, mess);
closeFile(file);
}


Any idea?

(Quake code i found for Worldspawn > Click me (http://openarena.ws/svn/source/code/game/g_spawn.c))

IzNoGoD
8th February 2013, 22:03
Dont closefile() if fid == -1, cause file wont be opened

Earliboy
9th February 2013, 00:10
File works, it adds the messages.
I got some more threads in my script, that is just the adding of message.
At initialation it checks for the cvars, folders and files and creates them if they don't exists.

Earliboy
9th February 2013, 00:28
Yep, i do hate Cod2 errors :) Stupid, no sense :D

The check if the file exists, went a littbit wrong and cod2 just gave out this stupid error.
But thanks for help, specialy to izno, he saw whats wrong ^^

kung foo man
24th February 2013, 13:53
Did you also have also this error related to the codscript-file-functions?



No map specified in sv_mapRotation - forcing map_restart.
==== ShutdownGame ====
------- Game Initialization -------
gamename: Call of Duty 2
gamedate: Apr 19 2006
********************
ERROR: G_ParseSpawnVars: closing brace without data
********************
----- Server Shutdown -----
Sending heartbeat to cod2master.activision.com
==== ShutdownGame ====

Ni3ls
13th January 2014, 21:44
How did you fix this? I got the same error but I handle my open and closing files perfectly. Only open if it exists and only close if it exists

Earliboy
14th January 2014, 13:08
Well, double check at closing!
My problem was, the file was still open (I don't remember why) and if I restarted map (ONLY THEN) I had this error.
So double check also use if(fid == -1).

Ni3ls
14th January 2014, 16:27
I have that :/

saveacc()
{

f=openfile(self.pers["loginname"]+".cfg","write");
if(f!=-1)
{
fprintln(f,self.pers["totalKills"]);
fprintln(f,self.pers["totalHead"]);
fprintln(f,self.pers["totalBash"]);
fprintln(f,self.pers["loginpw"]);
fprintln(f,self.pers["loadoldstats"]);
closefile(f);
}
}

loadacc()
{

f=openfile(self.pers["loginname"]+".cfg","read");
if(f!=-1)
{
freadln(f);
self.pers["totalKills"] = int(fgetarg(f,0));
self.pers["totalHead"] = int(fgetarg(f,1));
self.pers["totalBash"] = int(fgetarg(f,2));
self.pers["loginpw"] = fgetarg(f,3);
self.pers["loadoldstats"] = int(fgetarg(f,4));
closefile(f);
}

}

And to get the old stats back from saving on GUID

loadoldstats()
{
wait 1;
if(isdefined(self.pers["login"]))
{
self iprintlnbold("LOAD OLD STATS: "+self.pers["loadoldstats"]);
if(self.pers["loadoldstats"]==0)
{
f=openfile("stats/player_" + self getGuid() + ".txt","read");
if(f!=-1)
{
freadln(f);
self.pers["totalKills"] = int(fgetarg(f,0));
self iprintlnbold("^2Total kills Loaded!");
self iprintlnbold("^2Total kills: "+self.pers["totalKills"]);
wait 1;
self.pers["totalHead"] = int(fgetarg(f,1));
self iprintlnbold("^3Total Headshots Loaded!");
self iprintlnbold("^3Total headshots: "+self.pers["totalHead"]);
wait 1;
self.pers["totalBash"] = int(fgetarg(f,2));
self iprintlnbold("^4Total Bashes Loaded!");
self iprintlnbold("^4Total Bashes: "+self.pers["totalBash"]);
self.pers["loadoldstats"]=1;
closefile(f);
wait 1;

self maps\mp\gametypes\log::saveacc();
}
}
else
self iprintlnbold("already loaded");
}
}

IzNoGoD
14th January 2014, 17:06
do NOT put waits between fileopen and fileclose.

Serv might change map BEFORE file is closed, causing your bug.

Get data, close file, then add waits and printlns, dont wait before closing after opening!

Ni3ls
15th January 2014, 15:30
Jep solved