Answered Bo2 How to change Model | How to give yourself Weapons via GSC

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,066
Reaction score
2,907
Points
1,103
Thanks but would this give me the weapon or another player? And where should I put the code (Sorry started making GSC yesterday :/).
Wait I'm on way at home, I will answer in a second :peace:
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,066
Reaction score
2,907
Points
1,103
Ok thank you! :grinning:
Ok so:
First of all let's build a function to give yourself weapons:
Code:
giveWeapon()
{
self giveWeapon("TEST_WEAPONNAME");
}
self - definite that you give the weapon yourself
TEST_WEAPONNAME - There you can place a weapon name. You will get this weapon!

So the next step it to chose a weapon, you can find the weapons names here:
Weapon List
Please, Log in or Register to view URLs content!

Please, Log in or Register to view URLs content!


So let's pick a random multiplayer weapon:
an94_mp
So now we need to replace TEST_WEAPONNAME with an94_mp! It will look like this:
Code:
giveWeapon()
{
self giveWeapon("an94_mp");
}
So you will get the weapon after you call giveWeapon();
You can't use zombie weapons on Multiplayer.

Also to optimize your weapon function I recommend to do that:
Code:
giveWeapon()
{
self TakeWeapon( self getcurrentweapon() ); //Will take one weapon! Same like you pick up a dropped weapon.
self giveWeapon("an94_mp"); //Will give yourself the new weapon
self switchtoweapon("an94_mp"); //Will swtich to the new weapon
}

Also you can use Inputs:
Code:
giveWeapon(input)
{
self TakeWeapon( self getcurrentweapon() );
self giveWeapon(input);
self switchtoweapon(input);
}
So now you can call:
self giveWeapon("an94_mp"); //To give the AN94!
self giveWeapon("mp7_mp"); //To give the MP7!

This makes it possible to give you any weapon with a input with only one function!

I hope this helped you a little bit! Have a nice evening!
Your CabCon!
 
Last edited:

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Ok so:
First of all let's build a function to give yourself weapons:
Code:
giveWeapon()
{
self giveWeapon("TEST_WEAPONNAME");
}
self - definite that you give the weapon yourself
TEST_WEAPONNAME - There you can place a weapon name. You will get this weapon!

So the next step it to chose a weapon, you can find the weapons names here:
Weapon List
Please, Log in or Register to view URLs content!

Please, Log in or Register to view URLs content!


So let's pick a random multiplayer weapon:
an94_mp
So now we need to replace TEST_WEAPONNAME with an94_mp! It will look like this:
Code:
giveWeapon()
{
self giveWeapon("an94_mp");
}
So you will get the weapon after you call giveWeapon();
You can't use zombie weapons on Multiplayer.

Also to optimize your weapon function I recommend to do that:
Code:
giveWeapon()
{
self TakeWeapon( self getcurrentweapon() ); //Will take one weapon! Same like you pick up a dropped weapon.
self giveWeapon("an94_mp"); //Will give yourself the new weapon
self switchtoweapon("an94_mp"); //Will swtich to the new weapon
}

Also you can use Inputs:
Code:
giveWeapon(input)
{
self TakeWeapon( self getcurrentweapon() );
self giveWeapon();
self switchtoweapon(input);
}
So now you can call:
self giveWeapon("an94_mp"); //To give the AN94!
self giveWeapon("mp7_mp"); //To give the MP7!

This makes it possible to give you any weapon with a input with only one function!

I hope this helped you a little bit! Have a nice evening!
Your CabCon!
This should work right?
self add_option("Weapons", "Default Weapon", ::giveWeapon("defaultweapon_mp");
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,066
Reaction score
2,907
Points
1,103
This should work right?
Please, Log in or Register to view URLs content!
No, in a menu structure you need to do like that:
Code:
self add_option("Weapons" , "Default Weapon", ::giveWeapon, "defaultweapon_mp");

Use this function:
Code:
giveWeapon(input)
{
self TakeWeapon( self getcurrentweapon() );
self giveWeapon(input);
self switchtoweapon(input);
}
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
No, in a menu structure you need to do like that:
Code:
self add_option("Weapons" , "Default Weapon", ::giveWeapon, "defaultweapon_mp");

Use this function:
Code:
giveWeapon(input)
{
self TakeWeapon( self getcurrentweapon() );
self giveWeapon(input);
self switchtoweapon(input);
}
Oh it works, thank you very much!
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,066
Reaction score
2,907
Points
1,103
Sorry to bother you but how would I create a submenu like:

Weapons>Snipers
Weapons>Assault Rifles
etc.? Thanks
np, you need to create a structure of submenus with the 'category names' (e.g.: Snipers, Assault Rifles). After that you put inside this submenu all for example snipers. :smile:
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
np, you need to create a structure of submenus with the 'category names' (e.g.: Snipers, Assault Rifles). After that you put inside this submenu all for example snipers. :grinning:
Ok so would this work?:
Please, Log in or Register to view URLs content!

and change the doWeapon to giveWeapon?
 

Quacked420

Veteran
Messages
58
Reaction score
10
Points
793
Yeap, do this and this should work.
Ok so I just started with just pistols like this:
Please, Log in or Register to view URLs content!


When I click Weapons the first option is just a O or 0 when I click it it just stays the same and when I try go back it stays the same you know what's wrong? Thanks.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
5,066
Reaction score
2,907
Points
1,103
Ok so I just started with just pistols like this:
Please, Log in or Register to view URLs content!


When I click Weapons the first option is just a O or 0 when I click it it just stays the same and when I try go back it stays the same you know what's wrong? Thanks.
You need to remove that:
ceaa6925c21f45f5baf22e67b00b3c12.png
 
Top