Does anyone know how to make it so that only Admins can use a script
I've added the Admin pick up script to my server but right now all on the server can use the pick up but i only want to make it so that the Admin is the only one who can use the pick up script
Script for Admin Cod4 server
Moderator: Core Staff
-
- CJ Wannabe
- Posts: 44
- Joined: January 10th, 2013, 7:07 pm
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Script for Admin Cod4 server
Post the full script. A simple check on admin status should be easy to implement.
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
-
- CJ Wannabe
- Posts: 44
- Joined: January 10th, 2013, 7:07 pm
Re: Script for Admin Cod4 server
The script is
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.      */
  Â
Â
     thread onPlayerConnect();
   Â
Â
Â
}
Â
onPlayerConnect()
{
    for(;;)
    {
        level waittill( "connected", Player );
       Â
        player thread onPlayerSpawned();
    }
}
Â
onPlayerSpawned()
{
    for(;;)
    {
        self waittill( "spawned_Player" );
   Â
        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;
        }
    }
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Script for Admin Cod4 server
Added DVAR to adjust level 'All/VIP/Admin'. Default VIP.
(adminPickup)
(adminPickup)
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", 1);
     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;
        }
    }
}
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
Who is online
Users browsing this forum: No registered users and 23 guests