PDA

View Full Version : save script error



malyczolg
7th April 2013, 13:53
hi , i test my mod on developer 1 and :


******* script runtime error *******
struct is not an entity: (file 'huntyaudobriy/save.gsc', line 3)
guid = self getGuid();
*
called from:
(file 'huntyaudobriy/dmk.gsc', line 105)
thread huntyaudobriy\save::save(level.wpfile);
*
called from:
(file 'maps/mp/gametypes/_callbacksetup.gsc', line 15)
[[level.callbackStartGameType]]();
*
started from:
(file 'maps/mp/gametypes/_callbacksetup.gsc', line 10)
CodeCallback_StartGameType()
*
************************************

but if server on developer 0 mod work , whocan help me ?

save script :


save(file)
{
guid = self getGuid();
f=openfile(guid+".txt", "write");
fprintln(f, self.lol);
fprintln(f, self.rankc);
closefile(f);
}

EvoloZz
7th April 2013, 14:03
You need to call that function with "self", like this: self thread huntyaudobriy\save::save(level.wpfile);

malyczolg
7th April 2013, 14:23
ok thanks :) i go test

IzNoGoD
7th April 2013, 14:55
Then youll still be trying to get the guid of the server, not of the client. Call it on a proper player instead of on level.

malyczolg
7th April 2013, 15:06
******* script runtime error *******
pair 'undefined' and '.wp' has unmatching types 'undefined' and 'string': (file 'rankmod/dmk.gsc', line 1023)
f=openfile(guid+".wp", "write");

help plz

Jeplaa
7th April 2013, 15:24
why not call it simply .txt ?

malyczolg
7th April 2013, 15:27
yes , why ?

IzNoGoD
7th April 2013, 15:46
Why do you still assume that you are getting a correct guid if you are trying to getguid() the level?

malyczolg
7th April 2013, 16:02
IzNoGoD can you tell me what is to be an extension ?
txt not work
gsc not work
wp not work
can u help me ?

Earliboy
7th April 2013, 19:58
example:
Redirect a player to save his stuff:


self path\save::save();


Save player stats:


save()
{
guid = self getGuid();

f = openfile(guid + ".txt", "write");
fprintln(f, self.lol);
fprintln(f, self.rankc);
closefile(f);
}

IzNoGoD
7th April 2013, 19:59
Extension is not the problem
THE PROBLEM IS THAT YOU DONT GET THE GUID OF THE PLAYER, YOU TRY TO GET THE GUID OF THE SERVER.
DEVELOPER 1 WARNED YOU FOR THIS BY CRASHING, BUT YOU CHOOSE TO IGNORE IT AND NOW YOU ARE AT THE NEXT ERROR.

FIX ERROR 1 FIRST BEFORE COMPLAINING ABOUT ERROR 2.

Caps because i told this 3 times now, and you should have read it 3 times, instead of me having to write it 3 times.

malyczolg
7th April 2013, 20:11
******* script runtime error *******
struct is not an entity: (file 'rankmod/save.gsc', line 3)
guid = self getGuid();

Earliboy , u script not work.

IzNoGoD
7th April 2013, 20:27
earliboy's script is working fine.
You are calling the script the wrong way.

malyczolg
7th April 2013, 20:50
IzNoGoD can u tell me , where I have to add ?

IzNoGoD
7th April 2013, 23:13
called from:
(file 'huntyaudobriy/dmk.gsc', line 105)
thread huntyaudobriy\save::save(level.wpfile);
*
called from:
(file 'maps/mp/gametypes/_callbacksetup.gsc', line 15)
[[level.callbackStartGameType]]();
*

Dont call it in ongametypestarted.
Call it in onplayerconnect.

Earliboy
7th April 2013, 23:27
Dude, please just stop working on stuff like that, u will never bring it to work this way!
Just stop modding and start on the basics. Like youre doing, u will never understand how its working, u always gonna ask stuff like this.