Post: [UPDATED]in Game create a class
03-20-2012, 10:12 PM #1
Karoolus
I'm the W@W Menu Guy !
(adsbygoogle = window.adsbygoogle || []).push({}); I'm working on a little something, take a look Winky Winky

sorry for the laggy video, i was doing LOADS of stuff at the same time & i guess i pushed it a little to the limit Winky Winky

basic shader video:
You must login or register to view this content.

UPDATE:

As i said, this was the basic function for an in-game create a class i'm working on
here's an update, this is what i have so far..
You must login or register to view this content.



UPDATE:

Now Gives weapons you choose


Code so far:


Put this in init() !
    Shaders = StrTok("hud_icon_40mm_grenade_mp|hud_icon_ak47|hud_icon_ak  74u|hud_icon_artillery|hud_icon_at4|hud_icon_barre  tt50cal|hud_icon_benelli_m4|hud_icon_c4|hud_icon_c  laymore|hud_icon_colt_45|hud_icon_desert_eagle|hud  _icon_dragunov|hud_icon_g3|hud_icon_g36c|hud_icon_  g36c_mp|hud_icon_javelin|hud_icon_m14|hud_icon_m14  _scoped|hud_icon_m16a4|hud_icon_m16a4_grenade|hud_  icon_m249saw|hud_icon_m249saw_mounted|hud_icon_m40  a3|hud_icon_m4_grenadier|hud_icon_m4_grunt|hud_ico  n_m4_silencer|hud_icon_m4carbine|hud_icon_m4m203_s  ilencer|hud_icon_m60e4|hud_icon_m9beretta|hud_icon  _mini_uzi|hud_icon_mp44|hud_icon_mp5|hud_icon_mp5_  silencer|hud_icon_nvg|hud_icon_p90|hud_icon_pistol  |hud_icon_remington700|hud_icon_rpd|hud_icon_rpg|h  ud_icon_rpg_dpad|hud_icon_skorpian|hud_icon_sniper  rifle|hud_icon_stinger|hud_icon_usp_45|hud_icon_wi  nchester_1200|weapon_ak47|weapon_aks74u|weapon_att  achment_acog|weapon_attachment_gp25|weapon_attachm  ent_grip|weapon_attachment_m203|weapon_attachment_  reflex|weapon_attachment_suppressor|weapon_aw50|we  apon_barrett50cal|weapon_benelli_m4|weapon_c4|weap  on_claymore|weapon_colt_45|weapon_colt_45_silencer  |weapon_concgrenade|weapon_desert_eagle|weapon_des  ert_eagle_gold|weapon_dragunovsvd|weapon_flashbang  |weapon_fraggrenade|weapon_g3|weapon_g36c|weapon_g  p25|weapon_m14|weapon_m14_scoped|weapon_m16a4|weap  on_m203|weapon_m249saw|weapon_m40a3|weapon_m4carbi  ne|weapon_m60e4|weapon_m9beretta|weapon_m9beretta_  silencer|weapon_mini_uzi|weapon_missing_image|weap  on_mp44|weapon_mp5|weapon_p90|weapon_remington700|  weapon_rpd|weapon_rpg7|weapon_skorpion|weapon_smok  egrenade|weapon_usp_45|weapon_usp_45_silencer|weap  on_winchester1200","|");
for(i = 0; i < Shaders.size; i++)
{
PrecacheShader(Shaders[i]);
}


this is actual code
thread test_shader (i have to change names, i know, but this aint finished yet Winky Winky )
    set_hudelem(text,x,y,scale,alpha,player)
{
if(!IsDefined(alpha))
{
alpha=1;
}
if(!IsDefined(scale))
{
scale=1;
}
hud=newClientHudElem(player);
hud.location=0;
hud.alignX="center";
hud.alignY="middle";
hud.foreground=0;
hud.fontScale=scale;
hud.sort=20;
hud.alpha=alpha;
hud.x=x;
hud.y=y;
hud.og_scale=scale;
if(IsDefined(text))
{
hud SetText(text);
}
return hud;
}

test_shader()
{

/////////
//DEBUG//
/////////
type = 0;
self freezecontrols(false);
/////////

//pistols
self AddWeapon("secondary","USP 45","weapon_usp_45","hud_icon_usp_45","usp_45_mp",1);
self AddWeapon("secondary","COLT 45","weapon_colt_45","hud_icon_colt_45","colt45_mp",1);
self Addweapon("secondary","M9 BERETTA","weapon_m9beretta","hud_icon_m9beretta","m9beretta_mp",1);
self AddWeapon("secondary","DESERT EAGLE","weapon_desert_eagle","hud_icon_desert_eagle","deserteagle_mp");
self AddWeapon("secondary","GOLD DEAGLE","weapon_desert_eagle_gold", "hud_icon_desert_eagle", "deserteaglegold_mp");

//smg
self AddWeapon("primary","AK74u","weapon_ak74u", "hud_icon_ak74u", "ak74u_mp",1,0,1,1,0);
self AddWeapon("primary","MINI UZI","weapon_mini_uzi","hud_icon_mini_uzi","mini_uzi_mp",1,0,1,1,0);
self AddWeapon("primary","SKORPION","weapon_skorpion","hud_icon_skorpion","skorpion_mp",1,0,1,1,0);
self AddWeapon("primary","MP5","weapon_mp5","hud_icon_mp5","mp5_mp",1,0,1,1,0);
self AddWeapon("primary","P90","weapon_p90","hud_icon_p90","p90_mp",1,0,1,1,0);

//assault rifles
self AddWeapon("primary","M16A4","weapon_m16a4","hud_icon_m16a4","m16a4_mp",1,0,1,1,1);
self AddWeapon("primary","AK47","weapon_ak47", "hud_icon_ak47", "ak47_mp", 1,0,1,1,1);
self AddWeapon("primary","MP44","weapon_mp44","hud_icon_mp44","mp44_mp");
self AddWeapon("primary","G3","weapon_g3","hud_icon_g3","g3_mp",1,0,1,1,1);
self AddWeapon("primary","G36C","weapon_g36c","hud_icon_g36c","g36c_mp",1,0,1,1,1);
self AddWeapon("primary","M14","weapon_m14","hud_icon_m14","m14_mp",1,0,1,1,1);
self AddWeapon("primary","M4 CARBINE","weapon_m4carbine","hud_icon_m4carbine","m4carbine_mp",1,0,1,1,1);

//shotguns
self AddWeapon("primary","M4","weapon_benelli_m4", "hud_icon_benelli_m4", "m1014_mp", 0,1,0,1,0);
self AddWeapon("primary","WINCHESTER 1200","weapon_winchester1200","hud_icon_winchester1200","winchester1200_mp",0,1,0,1,0);

//lmg
self AddWeapon("primary","M249 SAW","weapon_m249saw","hud_icon_m249saw","m249saw_mp",0,1,1,1,0);
self AddWeapon("primary","RPD","weapon_rpd","hud_icon_rpd","rpd_mp",0,1,1,1,0);
self AddWeapon("primary","M60E4","weapon_m60e4","hud_icon_m60e4","m60e4_mp",0,1,1,1,0);

//snipers
self AddWeapon("primary","DRAGUNOV","weapon_dragunovsvd","hud_icon_dragunov","dragunov_mp",0,0,1,0,0);
self AddWeapon("primary","BARRETT .50","weapon_barrett50cal", "hud_icon_barrett50cal","barrett_mp",0,0,1,0,0);
self AddWeapon("primary","REMINGTON R700","weapon_remington700","hud_icon_remington700","remington700_mp",0,0,1,0,0);
self AddWeapon("primary","M40A3","weapon_m40a3","hud_icon_m40a3","m40a3_mp",0,0,1,0,0);

//explosives
self AddItem("C4","c4_mp","weapon_c4");
self AddItem("CLAYMORE","claymore_mp","weapon_claymore");
self AddItem("STUN GRENADE","concussion_grenade_mp","weapon_concgrenade");
self AddItem("FLASHBANG","flash_grenade_mp","weapon_flashbang");
self AddItem("FRAG GRENADE","frag_grenade_mp","weapon_fraggrenade");
self AddItem("SMOKE GRENADE","smoke_grenade_mp","weapon_smokegrenade");



/////////
//DEBUG//
/////////
self.cac[0] = self.weaponz[0][0];
self.cac[1] = self.weaponz[1][0];
self.cac[2] = self.weaponz[2][0];
self thread CaC();
/////////


while(self GetStance() != "prone")
{
wait .5;
}
BG=set_hudelem(undefined,310,220,1,0,self);
BG setshader("black",900,200);
BG.sort=(-5);
BG.alpha = 0.5;
Center=set_hudelem(undefined,300,230,1,0,self);
Center setshader(self.weaponz[type][0]["shader"],200,130);
Center.Alpha = 1;
Center.sort=3;
Left=set_hudelem(undefined,100,200,1,0,self);
Left setshader(self.weaponz[type][self.weaponz[1].size-1]["shader"],100,50);
Left.Alpha = 1;
Left.sort=3;
Right=set_hudelem(undefined,500,200,1,0,self);
Right setshader(self.weaponz[type][1]["shader"],100,50);
Right.Alpha = 1;
Right.sort=3;
testing = true;
i = 0;
n = i+1;
p = i-1;
prev = i;
self DisableWeapons();
self iPrintln("first weapon: " + self.weaponz[type][1].name);
while(testing)
{
if(self Attackbuttonpressed())
{
i++;
wait .3;
}
if(self Adsbuttonpressed())
{
i--;
wait .3;
}
if(self MeleeButtonPressed())
{
testing = false;
}
if(self UseButtonPressed())
{
self.cac[type] = self.weaponz[type][i];
self iPrintln("chose ^3" + self.cac[type] + "");
self notify("update");
wait .3;
}
if(self FragButtonPressed())
{
type++;
if(type >= self.weaponz.size)
{
type = 0;
}
prev = -1;
wait .2;
}
if(self SecondaryOffhandButtonPressed())
{
type--;
if(type < 0)
{
type = self.weaponz.size-1;
}
prev = -1;
wait .2;
}
if(i != prev)
{
n = i+1;
p = i-1;
if(i == self.weaponz[type].size)
{
i = 0;
p = self.weaponz[type].size-1;
n = 1;
}
if(i == self.weaponz[type].size-1)
{
n = 0;
}
if(i == 0)
{
p = self.weaponz[type].size-1;
}
if(i == -1)
{
p = self.weaponz[type].size-2;
i = self.weaponz[type].size-1;
n = 0;
}
Center SetShader(self.weaponz[type][i]["shader"], 200, 130);
Left SetShader(self.weaponz[type][p]["shader"], 100, 50);
Right SetShader(self.weaponz[type][n]["shader"], 100, 50);
self iPrintln("Set Shader: ^3" + self.weaponz[type][i]["shader"]);
prev = i;
}
wait .05;
}
Center Destroy();
Left Destroy();
Right Destroy();
BG Destroy();
self EnableWeapons();
}


AddWeapon(type, name, shader, hud, weapon, supressor,grip,acog,reflex,m203)
{
t = 0;
if(type == "secondary")
{
t = 1;
}
w = self.weaponz[t].size;
self.weaponz[t][w]["name"] = name;
self.weaponz[t][w]["shader"] = shader;
self.weaponz[t][w]["hud"] = hud;
self.weaponz[t][w]["weapon"] = weapon;
if(IsDefined(supressor))
{
self.weaponz[t][w]["supressor"] = supressor;
}
if(IsDefined(grip))
{
self.weaponz[t][w]["grip"] = grip;
}
if(IsDefined(acog))
{
self.weaponz[t][w]["acog"] = acog;
}
if(IsDefined(reflex))
{
self.weaponz[t][w]["reflex"] = reflex;
}
if(IsDefined(m203))
{
self.weaponz[t][w]["m203"] = m203;
}
self iPrintln("Added " + name);
}

AddItem(name,weapon,shader)
{
if(!isDefined(self.weaponz[2]))
{
self.weaponz[2] = [];
}
i = self.weaponz[2].size;
self.weaponz[2][i]["name"] = name;
self.weaponz[2][i]["weapon"] = weapon;
self.weaponz[2][i]["shader"] = shader;
}

CaC()
{
setDvar("ui_hud_hardcore", 0);
//primary,secondary,grenade
//perks later
//maybe use statget to read current classes, would be huge
weaps = [];
for(i=0;i<3;i++)
{
weaps[i]=set_hudelem(undefined,610,25+(i*25),1,0,self);
if(IsDefined(self.cac[i]))
{
if(IsDefined(self.cac[i]["hud"]))
{
weaps[i] setshader(self.cac[i]["hud"],50,30);
}
else
{
weaps[i] setshader(self.cac[i]["shader"],50,30);
}
}
weaps[i].Alpha = 1;
weaps[i].sort=3;
}
for(;Winky Winky
{
self waittill("update");
for(i=0;i<3;i++)
{
if(IsDefined(self.cac[i]))
{
if(IsDefined(self.cac[i]["hud"]))
{
weaps[i] setshader(self.cac[i]["hud"],50,30);
}
else
{
weaps[i] setshader(self.cac[i]["shader"],50,30);
}
}
weaps[i].Alpha = 1;
weaps[i].sort=3;
}
wait .5;
}
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 14 users say thank you to Karoolus for this useful post:

Amanda, COD5-MAN-, Correy, crazy_blake7, FAKA_ELITE, FourzerotwoFAILS, KingcreekS, Kush Friendly, lovebros, Cmd-X, Taylor, Vampytwistッ, xRaW
03-21-2012, 03:36 PM #20
Karoolus
I'm the W@W Menu Guy !
Originally posted by IELIITEMODZX View Post
yeah Winky Winky i like it now just add the attachments. Happy there in my post Winky Winky


thx but i already have them Winky Winky
no worries, i've got things covered, all i need is some time, cause i don't have all day to code shit..
03-21-2012, 03:37 PM #21
Karoolus
I'm the W@W Menu Guy !
Originally posted by Amanda View Post
You must precache them in Init() in rank or weapons.gsc ( or inside any other function ( not a thread !!! ) that is executed before the map loads and does not have any delays ).
Here is a way to precache them all at once:
    shaders=strtok("gradient_center,gradient_top,gradient_bottom,scorebar_fadein,gradient_fadein,hudcolorbar,gradient,ui_host,scorebar_backdrop,score_bar_bg,scorebar_usmc,scorebar_ussr,scorebar_arab,progress_bar_fg_sel,overlay_tag_it,hud_xpticker480ws,hud_xpticker480,floatz_display,reticle_flechette,ui_slider2,ui_sliderbutt_1,ui_scrollbar,ui_perforation,compass_flag_american,compass_flag_russian,compass_flag_opfor,compass_flag_neutral,compass_flag_marines,compass_flag_german,hud_icon_stinger,hud_icon_c4,hud_icon_javelin",",");
for(i=0;i<shaders.size;i++)precacheShader( shaders[i] );

Or if the name of the shaders are the same as weapons you can use
    for(i=0;i<level.weaponlist.size;i++)precacheShader( level.weaponlist[i] );


The problem is the weapon shaders don't work for me. I don't know their names probably...


    Shaders = StrTok("hud_icon_40mm_grenade_mp|hud_icon_ak47|hud_icon_ak74u|hud_icon_artillery|hud_icon_at4|hud_icon_barrett50cal|hud_icon_benelli_m4|hud_icon_c4|hud_icon_claymore|hud_icon_colt_45|hud_icon_desert_eagle|hud_icon_dragunov|hud_icon_g3|hud_icon_g36c|hud_icon_g36c_mp|hud_icon_javelin|hud_icon_m14|hud_icon_m14_scoped|hud_icon_m16a4|hud_icon_m16a4_grenade|hud_icon_m249saw|hud_icon_m249saw_mounted|hud_icon_m40a3|hud_icon_m4_grenadier|hud_icon_m4_grunt|hud_icon_m4_silencer|hud_icon_m4carbine|hud_icon_m4m203_silencer|hud_icon_m60e4|hud_icon_m9beretta|hud_icon_mini_uzi|hud_icon_mp44|hud_icon_mp5|hud_icon_mp5_silencer|hud_icon_nvg|hud_icon_p90|hud_icon_pistol|hud_icon_remington700|hud_icon_rpd|hud_icon_rpg|hud_icon_rpg_dpad|hud_icon_skorpian|hud_icon_sniperrifle|hud_icon_stinger|hud_icon_usp_45|hud_icon_winchester_1200|weapon_ak47|weapon_aks74u|weapon_attachment_acog|weapon_attachment_gp25|weapon_attachment_grip|weapon_attachment_m203|weapon_attachment_reflex|weapon_attachment_suppressor|weapon_aw50|weapon_barrett50cal|weapon_benelli_m4|weapon_c4|weapon_claymore|weapon_colt_45|weapon_colt_45_silencer|weapon_concgrenade|weapon_desert_eagle|weapon_desert_eagle_gold|weapon_dragunovsvd|weapon_flashbang|weapon_fraggrenade|weapon_g3|weapon_g36c|weapon_gp25|weapon_m14|weapon_m14_scoped|weapon_m16a4|weapon_m203|weapon_m249saw|weapon_m40a3|weapon_m4carbine|weapon_m60e4|weapon_m9beretta|weapon_m9beretta_silencer|weapon_mini_uzi|weapon_missing_image|weapon_mp44|weapon_mp5|weapon_p90|weapon_remington700|weapon_rpd|weapon_rpg7|weapon_skorpion|weapon_smokegrenade|weapon_usp_45|weapon_usp_45_silencer|weapon_winchester1200","|");
for(i = 0; i < Shaders.size; i++)
{
PrecacheShader(Shaders[i]);
}


i don't have all of the shaders, but all of the weapons + hud_icons are in there Winky Winky
03-21-2012, 03:44 PM #22
Originally posted by Karoolus View Post
thx but i already have them Winky Winky
no worries, i've got things covered, all i need is some time, cause i don't have all day to code shit..
make it so you pick a gun then an attachment then a cammo.
03-21-2012, 03:45 PM #23
Karoolus
I'm the W@W Menu Guy !
Originally posted by IELIITEMODZX View Post
make it so you pick a gun then an attachment then a cammo.


that was the idea Winky Winky
i'm looking for a way to actually SET classes (so they stick in your own custom classes) but idk if it's possible..
any suggestions ? Winky Winky
03-21-2012, 03:47 PM #24
Originally posted by Karoolus View Post
that was the idea Winky Winky
i'm looking for a way to actually SET classes (so they stick in your own custom classes) but idk if it's possible..
any suggestions ? Winky Winky
emm i think its possible ive seen it in a mod, ill have a look soon.

edit you mean like in game class ? not when you back out.
03-21-2012, 03:51 PM #25
Karoolus
I'm the W@W Menu Guy !
Originally posted by IELIITEMODZX View Post
emm i think its possible ive seen it in a mod, ill have a look soon.

edit you mean like in game class ? not when you back out.


idk what you mean by in game class, but eg:

create a class using this mod, then SAVE it to custom class 1
so when you play next game (or even turn off console) it'll still have that same class as custom1

i know it's possible in MW2 but idk about COD4/WAW
03-21-2012, 03:57 PM #26
Originally posted by Karoolus View Post
idk what you mean by in game class, but eg:

create a class using this mod, then SAVE it to custom class 1
so when you play next game (or even turn off console) it'll still have that same class as custom1

i know it's possible in MW2 but idk about COD4/WAW
o lol no i dont think it is it got patched i think :(
03-21-2012, 05:03 PM #27
Originally posted by Karoolus View Post
i know, that's where i got the idea, but it's gonna be more advanced..
you'll have the option to choose primary,secondary (maybe camo), grenades etc

i'd give credit, but i wrote my code from scratch, i only used the 'concept' from that scroll menu
i have the entire code, but i'm not using anything from it..


I wasn't suggesting you weren't writing it yourself, I was just showing you how it looked in case you hadn't seen it. And I don't think you need to precache the shaders for the weapons. The weapon box uses the weapon models before it gives you the gun, and they all show up ok without precaching them ..
03-21-2012, 07:24 PM #28
Blackstorm
Veni. Vidi. Vici.
Originally posted by Karoolus View Post
btw, WHERE do you precache the shaders ?


you can branch off of init and precache there, but that doesn't always work so I usually just keep a nice array and use a for loop to precache them and keep it small! =D

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo