How to chose the spawn weapon for Admin

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

Moderator: Core Staff

Post Reply
Treeqix
CJ Wannabe
CJ Wannabe
Posts: 3
Joined: December 31st, 2011, 3:30 am
Gamertag: Stream Treeqix

How to chose the spawn weapon for Admin

Post by Treeqix » December 31st, 2011, 3:35 am

Hey guys,

I recently made a server but I have a problem.
I made my friends Admin but they don't want to spawn with a Desert Eagle but with a sort of Brickblaster or Gravity gun.

Thanks if you can help I heard about scripts but I don't know how to script...

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: How to chose the spawn weapon for Admin

Post by Nekoneko » December 31st, 2011, 12:04 pm

The weapon admins spawn with is saved in
self.cj["weapon"]

And is reset to desert eagle 0.05 secs after you spawn

So you can only overwrite the code, or make another script, waiting for the player to spawn, to remove the deagle and give him another weapon

(Overwriting would be cleaner and easier, but since you don't have access to the source code you'll have to find another way)

Code: Select all

_spawn()         //would run on every player on spawn
{
   weapon = "remington700_mp";
   if(isDefined(self.cj["status"]) && self.cj["status"] >= 1)
   {
      wait 0.1;
      self takeWeapon("deserteagle_gold")   //or just leave it, if you want 3 Weapons (+c4 hands)
      self giveWeapon(Weapon);
   }
}

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

Re: How to chose the spawn weapon for Admin

Post by Drofder2004 » December 31st, 2011, 2:19 pm

The admin weapon was supposed to be dvar based but unfortunately it is something I overlooked and never changed.
If I (or someone else) gets round to releasing a next version, then it will be changed.

For the time being, a custom script as above will do the trick.
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

Treeqix
CJ Wannabe
CJ Wannabe
Posts: 3
Joined: December 31st, 2011, 3:30 am
Gamertag: Stream Treeqix

Re: How to chose the spawn weapon for Admin

Post by Treeqix » December 31st, 2011, 3:10 pm

Thank you but where can i find self.cj?

Treeqix
CJ Wannabe
CJ Wannabe
Posts: 3
Joined: December 31st, 2011, 3:30 am
Gamertag: Stream Treeqix

Re: How to chose the spawn weapon for Admin

Post by Treeqix » December 31st, 2011, 5:20 pm

Where do i need to overwrite the script ? What File?

I never scripted :p

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: How to chose the spawn weapon for Admin

Post by Nekoneko » January 1st, 2012, 10:24 pm

A simple way is by editing _clientids.gsc, since it doesn't contain much.

So here are the steps

1.Make a new .iwd file for your server mod ( *.rar file renamed to *.iwd, can be any name ) or use an existing one

2.In the .iwd file make sure you have the folders maps\mp\gametypes

3.Go in the folder maps\mp\gametypes and place a new text file, which you rename to: _clientids.gsc

4.Copy pasta this into your _clientids.gsc

Code: Select all

init()
{
        level.clientid = 0;
 
        level thread onPlayerConnect();
}
 
onPlayerConnect()
{
        for(;;)
        {
                level waittill("connecting", player);
                
                player.clientid = level.clientid;
                level.clientid++;
                
                player thread onPlayerSpawn();
        }
}
 
onPlayerSpawn()
{
        self endon ("disconnect");
        
        while(1)
        {
                self waittill("spawned_player");
                
                Weapon = "ak47_mp";
                if(isDefined(self.cj["status"]) && self.cj["status"] >= 1)
                {
                        wait 0.1;
                        self takeWeapon("deserteagle_mp");
                        self giveWeapon(Weapon);
                        self switchtoWeapon(Weapon);
                }
        }
}
Note:
You will be spawning with an ak47 instead of a desert eagle
Change it to whatever you like..

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests