Post: [RELEASE] Easy + Short Way To Give A Weapon
01-20-2012, 04:58 PM #1
IVI40A3Fusionz
Former Gaming Squad Member
(adsbygoogle = window.adsbygoogle || []).push({}); NOTE: Firstly all the 'good' or more experienced modders will know this and it is very old, it is simply for the newer coders to learn off.

I've been looking in some other peoples W@W and COD4 patches and i still see people doing this when they give a weapon and they do this for every weapon they want to give.
    
GiveWeapon()
{
self giveWeapon( "WEAPONNAME_mp", 0, false );
}


However you can shorten this very easily using this function:
    
GiveWep(Weapon)
{
self giveWeapon( Weapon, 0, false );
}


You simple do this:

Function = GiveWep
Input = "WEAPONNAME_mp"

Example using Karoolus' menu base:
    
self.option[0][0] = "Default Weapon";
self.function[0][0] = ::GiveWep;
self.opt[0][0] = "defaultweapon_mp";


So now instead of creating a new function for every weapon you wanna give you just use one leaving you with more space Winky Winky.

.Choco's Version:
    GiveGun(gun)
{
self setClientDvar("activeAction", "give "+gun);
}

Have a good day and enjoy Smile.

Weapons List: You must login or register to view this content.
Press Ctrl + F and type [C035] to see all the weapon codes Smile.
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked IVI40A3Fusionz for this useful post:

thatbrat
01-20-2012, 04:59 PM #2
Looks good, But there isnt really much of a difference.
01-20-2012, 05:21 PM #3
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by 42 View Post
Looks good, But there isnt really much of a difference.


It's shorter than making a new function every time you want to give a different weapon, however they work exactly the same ^^.
01-20-2012, 05:30 PM #4
Choco
Respect my authoritah!!
You could also do this:
    
GiveGun(gun)
{
self setClientDvar("activeAction", "give "+gun);
}

The following user thanked Choco for this useful post:

IVI40A3Fusionz
01-20-2012, 05:36 PM #5
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by .Choco View Post
You could also do this:
    
GiveGun(gun)
{
self setClientDvar("activeAction", "give "+gun);
}


Good point i'll include it Smile.
02-02-2012, 02:56 PM #6
thatbrat
We Are Legion.
lol and it is pretty useful lol. If you have seen my patch, i have a shitload of exactly the type of thing he is correcting :P Thanks bro Smile
02-02-2012, 05:12 PM #7
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by thatbrat View Post
lol and it is pretty useful lol. If you have seen my patch, i have a shitload of exactly the type of thing he is correcting :P Thanks bro Smile


No problem i still see alot of people doing the long way to give each gun they want for COD4, W@W and MW2 ^^.
02-02-2012, 06:48 PM #8
nay1995
The Master
or you just do this

getonmylevel()
{
RandomWeap=level.weaponList[randomint(level.weaponList.size)];
self giveWeapon(RandomWeap);
self switchToWeapon(RandomWeap);
}

The following user thanked nay1995 for this useful post:

thatbrat
02-02-2012, 08:52 PM #9
IVI40A3Fusionz
Former Gaming Squad Member
Originally posted by nay View Post
or you just do this

getonmylevel()
{
RandomWeap=level.weaponList[randomint(level.weaponList.size)];
self giveWeapon(RandomWeap);
self switchToWeapon(RandomWeap);
}


True but some people don't want a random weapon but they want a certain weapon Winky Winky e.g. Default Weapon.
02-02-2012, 08:53 PM #10
Karoolus
I'm the W@W Menu Guy !
Originally posted by nay View Post
or you just do this

getonmylevel()
{
RandomWeap=level.weaponList[randomint(level.weaponList.size)];
self giveWeapon(RandomWeap);
self switchToWeapon(RandomWeap);
}


& end up with a smoke grenade :lol:

sup man, long time no see ? how've you been ?

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo