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;
}
}
Last edited by Karoolus ; 03-26-2012 at 02:15 PM.

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-20-2012, 10:25 PM #2
Amanda
Can’t trickshot me!
That's really nice Smile However I hope we will not see many different versions of weapon selectors.... That prestige selectors or RGB Editors thing was enough...

The following user thanked Amanda for this useful post:

iiReFuZee
03-20-2012, 10:27 PM #3
Karoolus
I'm the W@W Menu Guy !
Originally posted by Amanda View Post
That's really nice Smile However I hope we will not see many different versions of weapon selectors.... That prestige selectors or RGB Editors thing was enough...


i'm writing an entire in-game Create-A-Class :p
this is just the beginning Winky Winky

The following user thanked Karoolus for this useful post:

COD5-MAN-
03-20-2012, 11:16 PM #4
DlBSY993
There's 0nly 1..
I use...

Menu "Give desert eagle" :: deagle);

deagle(){Givemotherfudging "deagle");}

Saves more room .. god i frickin hate editor things in patches, the make me ZZZZzzzz
03-20-2012, 11:17 PM #5
Jacob-And-Britt
I’m too L33T
Originally posted by Karoolus View Post
i'm writing an entire in-game Create-A-Class :p
this is just the beginning Winky Winky
NOOOOOOOOOOO.... lol i was going to make a gun selector.. :( btw why are you such a hater.
03-20-2012, 11:19 PM #6
Makee the shaders a bit wider, wack a bit of moveovertime in there and it'll be sexy Winky Winky Nice work.
03-21-2012, 01:40 AM #7
looks good, now just add a black BG then add it to a gametype Winky Winky
03-21-2012, 02:11 AM #8
Cmd-X
It's been awhile.
Originally posted by Amanda View Post
That's really nice However I hope we will not see many different versions of weapon selectors.... That prestige selectors or RGB Editors thing was enough...


Sorry, but I don't see why DVAR/RGB editors are so bad.. It's just another script to the never-ending list Smile If you don't like it, simply don't use it, but I know, it is a little annoying.
03-21-2012, 06:27 AM #9
Karoolus
I'm the W@W Menu Guy !
Originally posted by nZxMikeeeyx View Post
Makee the shaders a bit wider, wack a bit of moveovertime in there and it'll be sexy Winky Winky Nice work.

I know, working on that Winky Winky I already tried, but the thing is that the side shaders are smaller than the middle one, so i have to set a new shader everytime, which made it lag (i used ChangeShaderSize, something i wrote myself, kinda like changefontscaleovertime)
looking for something that actually works without lagging Winky Winky


Originally posted by IELIITEMODZX View Post
looks good, now just add a black BG then add it to a gametype Winky Winky

like this? :carling:
03-21-2012, 06:47 AM #10
Originally posted by Karoolus View Post
I know, working on that Winky Winky I already tried, but the thing is that the side shaders are smaller than the middle one, so i have to set a new shader everytime, which made it lag (i used ChangeShaderSize, something i wrote myself, kinda like changefontscaleovertime)
looking for something that actually works without lagging Winky Winky



like this? :carling:


The video has been made private but you can see the screen shot ...

You must login or register to view this content.

The following user thanked x_DaftVader_x for this useful post:

247Yamato

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo