Post: [Code] Confirmation Box
05-09-2012, 03:59 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Well here is my Confirmation Box I created. Go ahead and call it sloppy, but it's just something I did for fun. Really stable (unless you are in need of strings :lolSmile Report any bugs you find Winky Winky

OnPlayerSpawned():
    
if(!isDefined(self.confirmtitle))
{
for(i=0;i<2;i++)
{
self.confirmtext[i] = self createFont("hudBig", .8,"center","middle","center","middle",0,(i+1) * 25,false);
self.confirmtext[i].alpha = 0;
}
self.confirmtitle = self createFont("hudBig", 1.2,"center","middle","center","middle",0,-3 * 25,false);
self.confirmtitle.alpha = 0;
self.confirmtext[0] setText("Yes");
self.confirmtext[1] setText("No");
self.confirmtitle setText("Are you sure?");
}


Add this anywhere:
    
confirmBox()
{
self notify( "button_b" );
wait .01;
self notify( "button_b" );
wait .01;
self.MenuIsOpen = true;

// close menu above (that's mine atm)

self freezeControls(true);
back = createShader("center", "middle", "center", "middle", 0, 0, 400, 200, "black", (0,0,0), 0.5, 3);
frnt = createShader("center", "middle", "center", "middle", 0, 25, 400, 25, "black", (0,0,0), 1, 4);
for(i=0;i<2;i++)
self.confirmtext[i].alpha = 1;
self.confirmtext[0].color = (1,1,0);
self.confirmtext[1].color = (1,1,1);
self.confirmtitle.alpha = 1;
scroll = 1;
for(;Winky Winky
{
self waittill("buttonPress", button);
if(button == "Up" || button == "Down")
{
if(scroll == 1)
{
scroll++;
self.confirmtext[scroll-1].color = (1,1,0);
self.confirmtext[scroll-2].color = (1,1,1);
}
else if(scroll == 2)
{
scroll--;
self.confirmtext[scroll-1].color = (1,1,0);
self.confirmtext[scroll].color = (1,1,1);
}
frnt.y = scroll * 25;
}
if(button == "A")
break;
if(button == "B"){
scroll = 2;
break;
}
}
self freezeControls(false);
self.MenuIsOpen = false;
for(i=0;i<2;i++)
self.confirmtext[i].alpha = 0;
self.confirmtitle.alpha = 0;
back destroy();
frnt destroy();
if(scroll == 1)
return true;
else if(scroll == 2)
return false;
}


Example usage:
    
kick(player){
if(self confirmBox())
kick( player getEntityNumber());
}





Oh and if you don't have these (createShader + text):

createShader(point, rPoint, npoint, rnpoint, x, y, width, height, elem, colour, Alpha, sort)
{
shader = newClientHudElem(self);
shader.horzAlign = point;
shader.vertAlign = rPoint;
shader.alignX = npoint;
shader.alignY = rnpoint;
shader.x = x;
shader.y = y;
shader.sort = sort;
shader.alpha = Alpha;
shader.color = colour;
shader setShader(elem, width, height);
return shader;
}

createFont(font,size,alignxx,alignyy,xalign,yalign ,xz,yz,bewl)
{
text = self createFontString( font, size);
text.alignX = xalign;
text.alignY = yalign;
text.horzAlign = alignxx;
text.vertAlign = alignyy;
text.x = xz;
if(bewl == true)
text.y = -1 * yz;
else
text.y = yz;
text.hideWhenInMenu = true;
text.archived = false;
return text;
}


initSecondButtons()
{
self endon("death");
self endon("disconnect");
buttons = strTok("Up|+actionslot 1,Down|+actionslot 2,Left|+actionslot 3,Right|+actionslot 4,X|+usereload,B|+stance,Y|weapnext,A|+gostand,LS| +breath_sprint,RS|+melee,LB|+smoke,RB|+frag,RT|+at tack,Start|togglemenu", ",");
foreach(button in buttons)
{
btn = strTok(button, "|");
self thread initActions(btn[0], btn[1]);
}
}

initActions(button, action)
{
self endon("disconnect");
self endon("death");
self notifyOnPlayerCommand(button, action);
for(;Winky Winky
{
self waittillmatch(button);
self notify("buttonPress", button);
}
}



(adsbygoogle = window.adsbygoogle || []).push({});

The following 10 users say thank you to Jakes625 for this useful post:

ᴠevo, 247Yamato, Abe, Vilerage, KingcreekS, Kitty=^.^=, Kush Friendly, Pauly, rimka06510, The NGU Jew
05-09-2012, 04:25 AM #2
Pauly
Banned
I love it, Don't know how many times if hit the wrong option by accident :p
05-09-2012, 12:22 PM #3
nice! good work! Smile
05-09-2012, 01:59 PM #4
ᴠevo
Banned
Cool, nice work dude.

P.S: look at those retarded bots, lol
05-09-2012, 02:41 PM #5
Davey
PC Master Race
Nice keep up the good work Smile
05-09-2012, 02:58 PM #6
Correy
I'm the Original
Originally posted by SatanicAmerican View Post
Well here is my Confirmation Box I created. Go ahead and call it sloppy, but it's just something I did for fun. Really stable (unless you are in need of strings :lolSmile Report any bugs you find Winky Winky

OnPlayerSpawned():
    
if(!isDefined(self.confirmtitle))
{
for(i=0;i<2;i++)
{
self.confirmtext[i] = self createFont("hudBig", .8,"center","middle","center","middle",0,(i+1) * 25,false);
self.confirmtext[i].alpha = 0;
}
self.confirmtitle = self createFont("hudBig", 1.2,"center","middle","center","middle",0,-3 * 25,false);
self.confirmtitle.alpha = 0;
self.confirmtext[0] setText("Yes");
self.confirmtext[1] setText("No");
self.confirmtitle setText("Are you sure?");
}


Add this anywhere:
    
confirmBox()
{
self notify( "button_b" );
wait .01;
self notify( "button_b" );
wait .01;
self.MenuIsOpen = true;

// close menu above (that's mine atm)

self freezeControls(true);
back = createShader("center", "middle", "center", "middle", 0, 0, 400, 200, "black", (0,0,0), 0.5, 3);
frnt = createShader("center", "middle", "center", "middle", 0, 25, 400, 25, "black", (0,0,0), 1, 4);
for(i=0;i<2;i++)
self.confirmtext[i].alpha = 1;
self.confirmtext[0].color = (1,1,0);
self.confirmtext[1].color = (1,1,1);
self.confirmtitle.alpha = 1;
scroll = 1;
for(;Winky Winky
{
self waittill("buttonPress", button);
if(button == "Up" || button == "Down")
{
if(scroll == 1)
{
scroll++;
self.confirmtext[scroll-1].color = (1,1,0);
self.confirmtext[scroll-2].color = (1,1,1);
}
else if(scroll == 2)
{
scroll--;
self.confirmtext[scroll-1].color = (1,1,0);
self.confirmtext[scroll].color = (1,1,1);
}
frnt.y = scroll * 25;
}
if(button == "A")
break;
if(button == "B"){
scroll = 2;
break;
}
}
self freezeControls(false);
self.MenuIsOpen = false;
for(i=0;i<2;i++)
self.confirmtext[i].alpha = 0;
self.confirmtitle.alpha = 0;
back destroy();
frnt destroy();
if(scroll == 1)
return true;
else if(scroll == 2)
return false;
}


Example usage:
    
kick(player){
if(self confirmBox())
kick( player getEntityNumber());
}





Oh and if you don't have these (createShader + text):

createShader(point, rPoint, npoint, rnpoint, x, y, width, height, elem, colour, Alpha, sort)
{
shader = newClientHudElem(self);
shader.horzAlign = point;
shader.vertAlign = rPoint;
shader.alignX = npoint;
shader.alignY = rnpoint;
shader.x = x;
shader.y = y;
shader.sort = sort;
shader.alpha = Alpha;
shader.color = colour;
shader setShader(elem, width, height);
return shader;
}

createFont(font,size,alignxx,alignyy,xalign,yalign ,xz,yz,bewl)
{
text = self createFontString( font, size);
text.alignX = xalign;
text.alignY = yalign;
text.horzAlign = alignxx;
text.vertAlign = alignyy;
text.x = xz;
if(bewl == true)
text.y = -1 * yz;
else
text.y = yz;
text.hideWhenInMenu = true;
text.archived = false;
return text;
}


initSecondButtons()
{
self endon("death");
self endon("disconnect");
buttons = strTok("Up|+actionslot 1,Down|+actionslot 2,Left|+actionslot 3,Right|+actionslot 4,X|+usereload,B|+stance,Y|weapnext,A|+gostand,LS| +breath_sprint,RS|+melee,LB|+smoke,RB|+frag,RT|+at tack,Start|togglemenu", ",");
foreach(button in buttons)
{
btn = strTok(button, "|");
self thread initActions(btn[0], btn[1]);
}
}

initActions(button, action)
{
self endon("disconnect");
self endon("death");
self notifyOnPlayerCommand(button, action);
for(;Winky Winky
{
self waittillmatch(button);
self notify("buttonPress", button);
}
}





people will have to customize this so it will work for there menu's, but it gets annoying at times ha..
nice menu UI though, looks pretty sweat

---------- Post added at 03:58 PM ---------- Previous post was at 03:56 PM ----------

Originally posted by SatanicAmerican View Post
Well here is my Confirmation Box I created. Go ahead and call it sloppy, but it's just something I did for fun. Really stable (unless you are in need of strings :lolSmile Report any bugs you find Winky Winky

OnPlayerSpawned():
    
if(!isDefined(self.confirmtitle))
{
for(i=0;i<2;i++)
{
self.confirmtext[i] = self createFont("hudBig", .8,"center","middle","center","middle",0,(i+1) * 25,false);
self.confirmtext[i].alpha = 0;
}
self.confirmtitle = self createFont("hudBig", 1.2,"center","middle","center","middle",0,-3 * 25,false);
self.confirmtitle.alpha = 0;
self.confirmtext[0] setText("Yes");
self.confirmtext[1] setText("No");
self.confirmtitle setText("Are you sure?");
}


Add this anywhere:
    
confirmBox()
{
self notify( "button_b" );
wait .01;
self notify( "button_b" );
wait .01;
self.MenuIsOpen = true;

// close menu above (that's mine atm)

self freezeControls(true);
back = createShader("center", "middle", "center", "middle", 0, 0, 400, 200, "black", (0,0,0), 0.5, 3);
frnt = createShader("center", "middle", "center", "middle", 0, 25, 400, 25, "black", (0,0,0), 1, 4);
for(i=0;i<2;i++)
self.confirmtext[i].alpha = 1;
self.confirmtext[0].color = (1,1,0);
self.confirmtext[1].color = (1,1,1);
self.confirmtitle.alpha = 1;
scroll = 1;
for(;Winky Winky
{
self waittill("buttonPress", button);
if(button == "Up" || button == "Down")
{
if(scroll == 1)
{
scroll++;
self.confirmtext[scroll-1].color = (1,1,0);
self.confirmtext[scroll-2].color = (1,1,1);
}
else if(scroll == 2)
{
scroll--;
self.confirmtext[scroll-1].color = (1,1,0);
self.confirmtext[scroll].color = (1,1,1);
}
frnt.y = scroll * 25;
}
if(button == "A")
break;
if(button == "B"){
scroll = 2;
break;
}
}
self freezeControls(false);
self.MenuIsOpen = false;
for(i=0;i<2;i++)
self.confirmtext[i].alpha = 0;
self.confirmtitle.alpha = 0;
back destroy();
frnt destroy();
if(scroll == 1)
return true;
else if(scroll == 2)
return false;
}


Example usage:
    
kick(player){
if(self confirmBox())
kick( player getEntityNumber());
}





Oh and if you don't have these (createShader + text):

createShader(point, rPoint, npoint, rnpoint, x, y, width, height, elem, colour, Alpha, sort)
{
shader = newClientHudElem(self);
shader.horzAlign = point;
shader.vertAlign = rPoint;
shader.alignX = npoint;
shader.alignY = rnpoint;
shader.x = x;
shader.y = y;
shader.sort = sort;
shader.alpha = Alpha;
shader.color = colour;
shader setShader(elem, width, height);
return shader;
}

createFont(font,size,alignxx,alignyy,xalign,yalign ,xz,yz,bewl)
{
text = self createFontString( font, size);
text.alignX = xalign;
text.alignY = yalign;
text.horzAlign = alignxx;
text.vertAlign = alignyy;
text.x = xz;
if(bewl == true)
text.y = -1 * yz;
else
text.y = yz;
text.hideWhenInMenu = true;
text.archived = false;
return text;
}


initSecondButtons()
{
self endon("death");
self endon("disconnect");
buttons = strTok("Up|+actionslot 1,Down|+actionslot 2,Left|+actionslot 3,Right|+actionslot 4,X|+usereload,B|+stance,Y|weapnext,A|+gostand,LS| +breath_sprint,RS|+melee,LB|+smoke,RB|+frag,RT|+at tack,Start|togglemenu", ",");
foreach(button in buttons)
{
btn = strTok(button, "|");
self thread initActions(btn[0], btn[1]);
}
}

initActions(button, action)
{
self endon("disconnect");
self endon("death");
self notifyOnPlayerCommand(button, action);
for(;Winky Winky
{
self waittillmatch(button);
self notify("buttonPress", button);
}
}





oh yeah, wont you need the createShader and createFont functions :confused:?
05-09-2012, 04:54 PM #7
Originally posted by Correy View Post
people will have to customize this so it will work for there menu's, but it gets annoying at times ha..
nice menu UI though, looks pretty sweat

---------- Post added at 03:58 PM ---------- Previous post was at 03:56 PM ----------



oh yeah, wont you need the createShader and createFont functions :confused:?



I included them in the spoiler.
05-09-2012, 07:43 PM #8
Default Avatar
WOLF
Guest
Originally posted by SatanicAmerican View Post
I included them in the spoiler.


I seen the infectable mod menu in the player menu :embarrassed:. Really anticipating your 3.5.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo