Zone where players can not save.
Posted: June 20th, 2011, 9:12 am
Is is possible to make a zone on a map where players can't save ? ;s
And if it it , then how ?
And if it it , then how ?
CoDJumper.com - For all your CoDJumping needs!
https://codjumper.com/forums/
Code: Select all
 main()
{
    level.trig_stopsave=getent("nosave","targetname");
    level thread waitforconnect();
}
Â
waitforconnect()
{
    while(true)
    {
        level waittill("connecting",player);
        player thread waitforspawn();
    }
}
Â
waitforspawn()
{
    self endon("disconnect");
    self.saving=true;
    while(true)
    {
        self waittill("spawned");
Â
        self thread onspawn();
    }
}
Â
onspawn()
{
    self endon("disconnect");
    self endon("spawned");
    if(!self.saving)
        self notify("end_saveposition_threads"); //plz change this to the correct notify
    while(true)
    {
        if(isdefined(self.sessionstate)&&self.sessionstate=="playing")
        {
            if(self.saving&&self istouching(level.trig_stopsave))
            {
                self.saving=false;
                self notify("end_saveposition_threads"); //change this too
            }
            else if(!self.saving&&!self istouching(level.trig_stopsave)&&self isonground())
            {
                self.saving=true;
                self thread maps\mp\cj::monitorsaveload(); //im pretty sure this is not the correct thread.. drof?
            }
        }
        wait 0.05;
    }
}
Code: Select all
 main()
{
    level.trig_stopsave=getent("nosave","targetname");
    level thread waitforconnect();
}
Â
waitforconnect()
{
    while(true)
    {
        level waittill("connecting",player);
        player thread waitforspawn();
    }
}
Â
waitforspawn()
{
    self endon("disconnect");
    self.spamming=false;
    while(true)
    {
        self waittill("spawned_player");
        self thread onspawn();
    }
}
Â
onspawn()
{
    self endon("disconnect");
    self endon("spawned_player");
    while(true)
    {
        if(isdefined(self.sessionstate)&&self.sessionstate=="playing")
        {
            if(!self.spamming&&self istouching(level.trig_stopsave))
            {
                self.cj["save_backup"]["org1"]=self.cj["save"]["org1"];
                self.cj["save_backup"]["org2"]=self.cj["save"]["org2"];
                self.cj["save_backup"]["org3"]=self.cj["save"]["org3"];
                self.cj["save_backup"]["ang1"]=self.cj["save"]["ang1"];
                self.cj["save_backup"]["ang2"]=self.cj["save"]["ang2"];
                self.cj["save_backup"]["ang3"]=self.cj["save"]["ang3"];
                self.spamming=true;
                self thread spamsaves();
            }
            else if(!self.spamming&&!self istouching(level.trig_stopsave)&&self isonground())
            {
                self.spamming=false;
                self notify("stop_spamming_saves");
            }
        }
        wait 0.05;
    }
}
Â
spamsaves()
{
    self endon("disconnect");
    self endon("stop_spamming_saves");
    while(true)
    {
        self.cj["save"]["org1"]=self.cj["save_backup"]["org1"];
        self.cj["save"]["org2"]=self.cj["save_backup"]["org2"];
        self.cj["save"]["org3"]=self.cj["save_backup"]["org3"];
        self.cj["save"]["ang1"]=self.cj["save_backup"]["ang1"];
        self.cj["save"]["ang2"]=self.cj["save_backup"]["ang2"];
        self.cj["save"]["ang3"]=self.cj["save_backup"]["ang3"];
        wait 0.05;
    }
}
Although im not very familiar with mapping, i guess trigger_multiple already does this?Drofder2004 wrote:Fixed the notify for CoD4 usage.
Also, might be worth tweaking for an array of no save areas.
trigger_multiple is just a trigger that detects an entity. I would figure "multiple" has lost its original meaning, ut has nothing to do with allowing multiples.IzNoGoD wrote:Although im not very familiar with mapping, i guess trigger_multiple already does this?Drofder2004 wrote:Fixed the notify for CoD4 usage.
Also, might be worth tweaking for an array of no save areas.
If you use "istouching" then you also no longer need a trigger, a "script_brushmodel" with an invisible texture set to non-coliding.IzNoGoD wrote:istouching() removes this disability, and allows multiple players to "touch" a trigger, but it increases the serverload a bit.
Code: Select all
main()
{
level.trig_stopsave=getent("nosave","targetname"); //the only brushmodel out of the 'no draw not solid' texture
level thread cunt();
}
cunt()
{
while(-1111111111111111111111111111111)
{
wait 0; //hopefully this will work. so the rest of the loop will run after the player may have saved their position. so it will be overriden within the same frame, not in .05 second.
players = getEntArray("player", "classname");
for (i = 0; i < players.size; i++)
{
if (players[i].sessionstate != "playing")
continue;
if (!players[i] isTouching(level.trig_stopsave))
{
if (isDefined(players[i].defloration))
players[i].defloration = undefined;
continue;
}
if (!isDefined(players[i].defloration))
for (a = 1; a < 4; a++)
{
players[i].defloration = 1;
players[i].cj["save_backup"]["org"+a]=players[i].cj["save"]["org"+a];
players[i].cj["save_backup"]["ang"+a]=players[i].cj["save"]["ang"+a];
}
else
for (a = 1; a < 4; a++)
if (players[i].cj["save"]["org"+a] != players[i].cj["save_backup"]["org"+a])
{
players[i].cj["save"]["org"+a] = players[i].cj["save_backup"]["org"+a];
players[i].cj["save"]["ang"+a] = players[i].cj["save_backup"]["ang"+a];
}
}
wait .05;
}
}
IzNoGoD wrote:Damnit
For it to work, edit this line:
else if(!self.spamming
to
else if(self.spamming
(remove the !)
Quote from the thread !!!!!HELP!!!!!IzNoGoD wrote:You could at least have made your topic title a little more descriptive...