Page 1 of 1

Reset last saved position.

Posted: August 12th, 2011, 10:20 pm
by Reality
I have this code to reset a player last position when (s)he lands on the trigger,

Code: Select all

stachel_Reset()
{
        ent_ResetLoad = getentarray("reset","targetname");
        if(isdefined(ent_ResetLoad))
        {
                for(lp=0;lp<ent_ResetLoad.size;lp++)
                ent_ResetLoad[lp] thread _ResetLoad();
        }
}
 
_ResetLoad()                    //As soon as player is touching trigger "reset" -> thread loadPos()
{
        self endon("disconnect");
        self endon("killed_player");
        self endon("joined_spectators");
        
        while(true)
        {
                self waittill("trigger",other);
                
                wait(0.10);
                other thread maps\mp\gametypes\_codjumper::loadPos();
                wait(0.10);
        }
}
Unfortunatley im unable to get this to work because i dont have the '_codjumper.gsc' in this line
other thread maps\mp\gametypes\_codjumper::loadPos(); and was just wondering if anyone knew the code to put inside the '_codjumper.gsc' file and could post it here to help me to get this to work, if not a different code? many thanks.

Re: Reset last saved position.

Posted: August 13th, 2011, 2:18 am
by Drofder2004
The last released mod currently on server uses LoadPos, so there is no problem with your code.

The problem may be there "ground" checking (you cannot load in the air).
You could however try:

Code: Select all

self setPlayerAngles(self.cj["save"]["ang1"]);
self setOrigin(self.cj["save"]["org1"]);
I would suggest doing a "if( isDefined() )" on both variables however, jsut incase the player has not saved.

Re: Reset last saved position.

Posted: August 13th, 2011, 7:33 am
by Paragon
_codjumper.gsc :

Code: Select all

loadPos()
{
	self suicide();
}

Re: Reset last saved position.

Posted: August 13th, 2011, 11:16 am
by Drofder2004
Paragon wrote:_codjumper.gsc :

Code: Select all

loadPos()
{
	self suicide();
}
what?