Answered Spawning and deploying equipment help

Mr Knife God

New Member
Messages
29
Reaction score
10
Points
3
Does anyone know a function where I can spawn grenades in seperate slots? I have a code where I can spawn grenades and such
Code:
givegrenades(weapon)
{
    currentweapon = self GetCurrentOffhand();
    self TakeWeapon(currentweapon);
    self giveweapon(weapon);
    self iPrintln("^7"+weapon+" ^2Given");
}
But it only replaces grenades from my lethals slot. I need one where it can replace grenades from my tacticals slot too.
 

zerker24

Developer
Messages
35
Reaction score
42
Points
218
The same code works for both. When I get home tonight I'll send you the code, but it's fairly simple.
 

Mr Knife God

New Member
Messages
29
Reaction score
10
Points
3
The same code works for both. When I get home tonight I'll send you the code, but it's fairly simple.
Alright. But its kinda different, because when I use it, I select c4 to replace my current lethal, but I want to also replace my tactical with another tactical. If I pick a tactical, it puts it in the place of my lethal.
 

zerker24

Developer
Messages
35
Reaction score
42
Points
218
Do you still have it?
I don't, but I know what the problem is. GetCurrentOffhand will normally always return the granade. so when you remove it and add the equipment it will add the equipment to the open slot. Your best bet is to instead of removing the currentoffhand removing every type of equipment first, then adding the equipment. Or I believe there is a way to get the players spawn weapons, although I do not have that code ATM.
 

Mr Knife God

New Member
Messages
29
Reaction score
10
Points
3
I don't, but I know what the problem is. GetCurrentOffhand will normally always return the granade. so when you remove it and add the equipment it will add the equipment to the open slot. Your best bet is to instead of removing the currentoffhand removing every type of equipment first, then adding the equipment. Or I believe there is a way to get the players spawn weapons, although I do not have that code ATM.
Is "GetOffhandSecondaryClass" one part of achieving what I need?
 
Top