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, 07:57 AM #11
Karoolus
I'm the W@W Menu Guy !
Originally posted by x. View Post
The video has been made private but you can see the screen shot ...

You must login or register to view this content.


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..
03-21-2012, 08:06 AM #12
Amanda
Can’t trickshot me!
Originally posted by Karoolus View Post
i'm writing an entire in-game Create-A-Class
this is just the beginning


lol
And how do these shaders work?
I precached some of them, then tried for example setShader("weapon_g3") but nothing appeared on screen! :confused:
I think either the name of the weapon shaders is not the same as the weapon model or there is another way to display them...
03-21-2012, 10:56 AM #13
Karoolus
I'm the W@W Menu Guy !
Originally posted by Amanda View Post
lol
And how do these shaders work?
I precached some of them, then tried for example setShader("weapon_g3") but nothing appeared on screen! :confused:
I think either the name of the weapon shaders is not the same as the weapon model or there is another way to display them...


I'll post the code i have so far tonight when i get home Winky Winky


btw, WHERE do you precache the shaders ?
i tried precaching them in my own function, but that doesn't work, they have to be precached in init() (i put them in init() from rank.gsc)
03-21-2012, 11:33 AM #14
Correy
I'm the Original
Originally posted by x. View Post
The video has been made private but you can see the screen shot ...

You must login or register to view this content.


thats modding the menu's, you can't do that on ps3 Gaspkay:
03-21-2012, 11:54 AM #15
Amanda
Can’t trickshot me!
Originally posted by Karoolus View Post
I'll post the code i have so far tonight when i get home


btw, WHERE do you precache the shaders ?
i tried precaching them in my own function, but that doesn't work, they have to be precached in init() (i put them in init() from rank.gsc)


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...
03-21-2012, 01:48 PM #16
247Yamato
< ^ > < ^ >
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..


Thats not new, :S . Was made on CoD4 Promod and in MW2 Promod.
03-21-2012, 01:51 PM #17
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...


I know Winky Winky
I'll post the shaders as soon as i get home..
I put them in an array like you did, so it's easy to precache them Smile

weapons shaders names are:

"weapon_weapname"

just like that.. the weapon names all have _mp at the end, but you don't need those Smile
you might be able to use level.weaponlist & GetSubStr so you have the weapon name without _mp but that would make things too complicated :p

---------- Post added at 02:51 PM ---------- Previous post was at 02:50 PM ----------

Originally posted by 247Yamato View Post
Thats not new, :S . Was made on CoD4 Promod and in MW2 Promod.


never seen it + it wasn't written by me..
03-21-2012, 02:34 PM #18
Correy
I'm the Original
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...


i wrote a script, but never mind aha Gaspkay:
03-21-2012, 03:23 PM #19
yeah Winky Winky i like it now just add the attachments. Happy there in my post Winky Winky

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo