Someone help combine these two scripts?

Have a question you need to ask? Need help? Ask here!

Moderator: Core Staff

Post Reply
Ru Grapes
CJ Wannabe
CJ Wannabe
Posts: 3
Joined: January 8th, 2014, 10:12 pm

Someone help combine these two scripts?

Post by Ru Grapes » January 9th, 2014, 11:48 pm

Hi there, been trying for a day to get both of these scripts to work with each other together inside my addons.gsc.

Was just wondering if anyone would be able to help join them together, or tell me how I can use both of them? :)

Thanks!

Code: Select all

/* ______      ____      __
  / ____/___  / __ \    / /_  ______ ___  ____  ___  _____ _________  ____ ___
 / /   / __ \/ / / /_  / / / / / __ `__ \/ __ \/ _ \/ ___// ___/ __ \/ __ `__ \
/ /___/ /_/ / /_/ / /_/ / /_/ / / / / / / /_/ /  __/ /  _/ /__/ /_/ / / / / / /
\____/\____/_____/\____/\__,_/_/ /_/ /_/ .___/\___/_/  (_)___/\____/_/ /_/ /_/
                                      /*/
 
#include codjumper\_cj_utility;
 
init()
{
        /* You may use this file to add your custom             *
         * scripts without requiring a stock file hack. *
         * Thread your functions inside 'init()' and            *
         * place your custom functions below.           */
		 
		 if(getDvar("adminPickup") == "")
                  setDvar("adminPickup", 2);
 
        thread onPlayerConnect();
       
 
 
}

onPlayerConnect()
{
            level endon("game_ended");
  
            for(;;)
            {
                        level waittill("connecting", player);
  
                        player thread doNoclip();
            }
}
doNoclip()
{
            level endon("game_ended");
            self endon("disconnect");
  
            self waittill("spawned_player");
           
            for(;;wait 0.05)
            {
                        if((!isDefined(self.cj["status"]) || self.cj["status"] < 1) || self.sessionstate != "playing")
                                    continue;
  
                        if(!self useButtonPressed() || !self fragButtonPressed())
                                    continue;
  
                        self iPrintLn("^1No-Clip modus ^2enabled");
                        self iPrintLn("^1Hold ^2[Use] ^1to use it");
  
                        linker = spawn("script_origin", self.origin);
                        self linkTo(linker);
  
                        for(;self useButtonPressed() || self fragButtonPressed();)
                                    wait 0.05;
  
                        for(;!self useButtonPressed() || !self fragButtonPressed();wait 0.05)
                        {
                                    if(self useButtonPressed())
                                                linker.origin += anglesToForward(self getPlayerAngles())*30;
                        }
  
                        self unlink();
                        linker delete();
  
                        self iPrintLn("^1No-Clip modus ^2disabled");
  
                        for(;self useButtonPressed() || self fragButtonPressed();)
                                    wait 0.05;
								
							
									
            }
}

Code: Select all

    /* ______         ____         __
       / ____/___   / __ \      / /_   ______ ___   ____   ___   _____ _________   ____ ___
      / /    / __ \/ / / /_   / / / / / __ `__ \/ __ \/ _ \/ ___// ___/ __ \/ __ `__ \
    / /___/ /_/ / /_/ / /_/ / /_/ / / / / / / /_/ /   __/ /   _/ /__/ /_/ / / / / / /
    \____/\____/_____/\____/\__,_/_/ /_/ /_/ .___/\___/_/   (_)___/\____/_/ /_/ /_/
                                                             /*/
      
    #include codjumper\_cj_utility;
      
    init()
    {
                /* You may use this file to add your custom                   *
                  * scripts without requiring a stock file hack. *
                  * Thread your functions inside 'init()' and                  *
                  * place your custom functions below.                */
            
             /* Admin Pickup Dvar, 0 = All, 1 = Admin/VIP, 2 = Admin Only */
              if(getDvar("adminPickup") == "")
                      setDvar("adminPickup", 2);
     
                  thread onPlayerConnect();
    }
      
    onPlayerConnect()
    {
                for(;;)
                {
                            level waittill( "connected", Player );
                           
                            player thread onPlayerSpawned();
                }
    }
      
    onPlayerSpawned()
    {
                for(;;)
                {
                            self waittill( "spawned_Player" );
               
                    if(self.cj["status"] >= getDvarInt("adminPickup"))
                            self thread _AdminPickup();
               
                }
    }
               
    _AdminPickup()
    {
         self endon("disconnect");
      
                while(1)
                {            
                            while(!self secondaryoffhandButtonPressed())
                            {
                                        wait 0.05;
                            }
                           
                            start = self getEye();
                            end = start + maps\mp\_utility::vector_scale(anglestoforward(self getPlayerAngles()), 999999);
                            trace = bulletTrace(start, end, true, self);
                            dist = distance(start, trace["position"]);
      
                            ent = trace["entity"];
      
                            if(isDefined(ent) && ent.classname == "player")
                            {
                                        if(isPlayer(ent))
                                                    ent IPrintLn("^1You've been picked up by the admin ^2" + self.name + "^1!");
      
                                        self IPrintLn("^1You've picked up ^2" + ent.name + "^1!");
      
                                        linker = spawn("script_origin", trace["position"]);
                                        ent linkto(linker);
      
                                        while(self secondaryoffhandButtonPressed())
                                        {
                                                    wait 0.05;
                                        }
      
                                        while(!self secondaryoffhandButtonPressed() && isDefined(ent))
                                        {
                                                    start = self getEye();
                                                    end = start + maps\mp\_utility::vector_scale(anglestoforward(self getPlayerAngles()), dist);
                                                    trace = bulletTrace(start, end, false, ent);
                                                    dist = distance(start, trace["position"]);
      
                                                    if(self fragButtonPressed() && !self adsButtonPressed())
                                                                dist -= 15;
                                                    else if(self fragButtonPressed() && self adsButtonPressed())
                                                                dist += 15;
      
                                                    end = start + maps\mp\_utility::vector_Scale(anglestoforward(self getPlayerAngles()), dist);
                                                    trace = bulletTrace(start, end, false, ent);
                                                    linker.origin = trace["position"];
      
                                                    wait 0.05;
                                        }
            
                                        if(isDefined(ent))
                                        {
                                                    ent unlink();
                                                               
                                                    if(isPlayer(ent))
                                                                ent IPrintLn("^1You've been dropped by the admin ^2" + self.name + "^1!");
      
                                                    self IPrintLn("^1You've dropped ^2" + ent.name + "^1!");
                                        }
      
                                        linker delete();
                            }
      
                            while(self secondaryoffhandButtonPressed())
                            {
                                        wait 0.05;
                            }
                }
    }

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Someone help combine these two scripts?

Post by Drofder2004 » January 10th, 2014, 11:49 pm

I do not know if the code works, or if the two scripts work together, I have simply melded the code.

Code: Select all

/*         ______      ____      __
          / ____/___  / __ \    / /_  ______ ___  ____  ___  _____ _________  ____ ___
         / /   / __ \/ / / /_  / / / / / __ `__ \/ __ \/ _ \/ ___// ___/ __ \/ __ `__ \
        / /___/ /_/ / /_/ / /_/ / /_/ / / / / / / /_/ /  __/ /  _/ /__/ /_/ / / / / / /
        \____/\____/_____/\____/\__,_/_/ /_/ /_/ .___/\___/_/  (_)___/\____/_/ /_/ /_/
/*/
 
#include codjumper\_cj_utility;
 
init()
{
        /* You may use this file to add your custom    *
        * scripts without requiring a stock file hack. *
        * Thread your functions inside 'init()' and    *
        * place your custom functions below.           */
 
        if(getDvar("adminPickup") == "")
                setDvar("adminPickup", 2);
 
        thread onPlayerConnect();
}
 
onPlayerConnect()
{
        level endon("game_ended");
 
        for(;;)
        {
                level waittill("connecting", player);           
                player thread doNoclip();
                player thread onPlayerSpawned();
        }
}
 
onPlayerSpawned()
{
        for(;;)
        {
                self waittill( "spawned_Player" );
                
                if(self.cj["status"] >= getDvarInt("adminPickup"))
                        self thread _AdminPickup();
        }
}
 
doNoclip()
{
        level endon("game_ended");
        self endon("disconnect");
        
        self waittill("spawned_player");
 
        for(;;wait 0.05)
        {
                if((!isDefined(self.cj["status"]) || self.cj["status"] < 1) || self.sessionstate != "playing")
                        continue;
        
                if(!self useButtonPressed() || !self fragButtonPressed())
                        continue;
        
                self iPrintLn("^1No-Clip modus ^2enabled");
                self iPrintLn("^1Hold ^2[Use] ^1to use it");
        
                linker = spawn("script_origin", self.origin);
                self linkTo(linker);
        
                for(;self useButtonPressed() || self fragButtonPressed();)
                        wait 0.05;
        
                for(;!self useButtonPressed() || !self fragButtonPressed();wait 0.05)
                {
                        if(self useButtonPressed())
                        linker.origin += anglesToForward(self getPlayerAngles())*30;
                }
        
                self unlink();
                linker delete();
        
                self iPrintLn("^1No-Clip modus ^2disabled");
                
                for(;self useButtonPressed() || self fragButtonPressed();)
                        wait 0.05;
        }
}
 
_AdminPickup()
{
        self endon("disconnect");
 
        while(1)
        {            
                while(!self secondaryoffhandButtonPressed())
                {
                        wait 0.05;
                }
        
                start = self getEye();
                end = start + maps\mp\_utility::vector_scale(anglestoforward(self getPlayerAngles()), 999999);
                trace = bulletTrace(start, end, true, self);
                dist = distance(start, trace["position"]);
        
                ent = trace["entity"];
        
                if(isDefined(ent) && ent.classname == "player")
                {
                        if(isPlayer(ent))
                                ent IPrintLn("^1You've been picked up by the admin ^2" + self.name + "^1!");
                
                        self IPrintLn("^1You've picked up ^2" + ent.name + "^1!");
                        
                        linker = spawn("script_origin", trace["position"]);
                        ent linkto(linker);
                
                        while(self secondaryoffhandButtonPressed())
                        {
                                wait 0.05;
                        }
                
                        while(!self secondaryoffhandButtonPressed() && isDefined(ent))
                        {
                                start = self getEye();
                                end = start + maps\mp\_utility::vector_scale(anglestoforward(self getPlayerAngles()), dist);
                                trace = bulletTrace(start, end, false, ent);
                                dist = distance(start, trace["position"]);
                        
                                if(self fragButtonPressed() && !self adsButtonPressed())
                                        dist -= 15;
                                else if(self fragButtonPressed() && self adsButtonPressed())
                                        dist += 15;
                        
                                end = start + maps\mp\_utility::vector_Scale(anglestoforward(self getPlayerAngles()), dist);
                                trace = bulletTrace(start, end, false, ent);
                                linker.origin = trace["position"];
                        
                                wait 0.05;
                        }
                
                        if(isDefined(ent))
                        {
                                ent unlink();
                           
                                if(isPlayer(ent))
                                        ent IPrintLn("^1You've been dropped by the admin ^2" + self.name + "^1!");
                        
                                self IPrintLn("^1You've dropped ^2" + ent.name + "^1!");
                        }
                
                        linker delete();
                }
        
                while(self secondaryoffhandButtonPressed())
                {
                        wait 0.05;
                }
        }
}
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 8 guests