Post: Padlock Mod!
10-16-2012, 11:55 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); This is something I have been thinking about but never made. Well I finally came around to it today (bored). Took about 2 hours, super stable, and only uses 3 setTexts! It's really easy to use as long as you have buttonHandling, and createRectangle. This is built within 1 function, and no entity dependent variables. I might make changes as well. Enjoy!!!



To Call It:
Either do this or an if statement. After they OK or CLOSE it will return true/false
    
padlock = self padlock();


Here's the script:
    
padlock()
{
self endon("death");

//enter passcode here
passcode = "1337";
//passcode = getDvar( "g_passcode" );

//data
i = 1;
val = "";
rows_max = 4;
colm_max = 3;
totl_max = rows_max * colm_max;
buttons = [];
items[1] = "OK";
items[2] = "CANCEL";
items[3] = "<--";

//fill data
input = self createFontString( "default", 1.8 );
input.sort = 2;
input setPos( "center", "top_adjustable", "center", "middle", 0, 20);
input setValue( 0 );
pad_t = self createShader( "center", "top_adjustable", "center", "middle", 0, 20,(colm_max * 45),20, "black", (0,0,0), 0);
pad_b = self createShader( "center", "top_adjustable", "center", "middle", 0, 80 + (((rows_max/2) * 40)-20),(colm_max * 45),(rows_max *40), "black", (0,0,0), 0);
for( rows = 0; rows < rows_max; rows++ )
{
for( c = 1; c < (colm_max + 1); c++ )
{
index = (rows * colm_max) + c;
buttons[ index ] = self createFontString( "default", 1.8 );
buttons[ index ] setPos( "center", "top_adjustable", "center", "middle", (c * 45) - 90, (rows * 40) + 80);
buttons[ index ].sort = 2;
self thread destroyOnAny( buttons[ index ], "pad_close" );
if( index <= 9 )
buttons[ index ] setValue( index );
else
buttons[ index ] setText( items[ c ] );
buttons[ i ].color = (0,1,0);
}
}

self thread destroyOnAny( input, "pad_close" );
self thread destroyOnAny( pad_t, "pad_close" );
self thread destroyOnAny( pad_b, "pad_close" );

//use data
for(;Winky Winky
{
self waittill("buttonPress", button);
if( button == "Right" )
{
i++;
if(i > totl_max)
i = 1;
}
else if( button == "Left" )
{
i--;
if(i < 1)
i = totl_max;
}
else if( button == "Up" )
{
temp = i - colm_max;
if(temp < 1)
i = totl_max + temp;
else
i -= colm_max;
}
else if( button == "Down" )
{
temp = i + colm_max;
if(temp > totl_max)
i = temp - totl_max;
else
i += colm_max;
}
for( a = 1; a < (totl_max+1); a++)
buttons[ a ].color = (1,1,1);
buttons[ i ].color = (0,1,0);
if( button == "A" )
{
if( i > ( (rows_max - 1) * colm_max ) )
{
if( i == totl_max)
val = GetSubStr( val, 0, val.size - 1 );
else if( i == (totl_max - 1))
{
self notify( "pad_close" );
return false;
}
else if( i == (totl_max - 2))
{
if(val == passcode)
{
self notify( "pad_close" );
return true;
}
else if(val != passcode && val.size == passcode.size)
self iPrintLn( "Wrong Passcode" );
else if(val != passcode && val.size < passcode.size)
self iPrintLn( "Entered Code is too Short!" );
}
}
else
{
if( val.size < passcode.size )
val += i;
}
input setValue( int(val) );
}
}
}


Here are some extra functions if you don't already have them (USE THESE IF BLANK PATCH):

    
destroyOnAny( elem, a )
{
self waittill_any( "death", a );
elem destroy();
elem delete();
}

setPos( a, b, c, d, e, f )
{
self.horzAlign = a;
self.vertAlign = b;
self.alignX = c;
self.alignY = d;
self.x = e;
self.y = f;
}

createShader(a, b, c, d, x, y, width, height, elem, colour, sort)
{
shader = newClientHudElem(self);
shader.horzAlign = a;
shader.vertAlgin = b;
shader.alignX = c;
shader.alignY = d;
shader.x = x;
shader.y = y;
shader.sort = sort;
shader.alpha = 1;
shader.color = colour;
shader setShader(elem, width, height);
return shader;
}

buttonHandler()
{
self endon( "disconnect" );
self endon( "death" );

buttons = "Up|+actionslot 1,Down|+actionslot 2,Left|+actionslot 3,Right|+actionslot 4,X|+usereload,B|+melee,Y|weapnext,A|+gostand,LS|+breath_sprint,RS|+stance,LB|+smoke,RB|+frag";
buttonArray = strTok( buttons, "," );
foreach ( button in buttonArray )
{
array = strTok( button, "|" );
self notifyOnPlayerCommand( array[0], array[1] );
}
for(;Winky Winky
{
ent = spawnstruct();
foreach ( button in buttonArray )
{
array = strTok( button, "|" );
self thread waittill_string( array[0], ent );
}
ent waittill( "returned", result );
ent notify( "die" );
self notify( "buttonPress", result );
// combo section
if( isDefined(self.inMenu) && !self.inMenu ) continue; // or if in a menu
if( getTime() - self.buttonTime[self.buttonTime.size-1] > 2000 ) // 2 secs since last press == too slow :]
{
self.buttonList = [];
self.buttonTime = [];
}
self.buttonList[self.buttonList.size] = result;
self.buttonTime[self.buttonTime.size] = getTime();
for( b = 0; b < self.buttonList.size; b++ )
{
combo = "";
for ( c = b; c < self.buttonList.size; c++ ) combo += self.buttonList[c] + ",";
combo = getSubStr( combo, 0, combo.size-1 );
keys = getArrayKeys( level.combos );
foreach ( key in keys )
{
if( key == combo )
{
self thread [[level.combos[key]]]();
self.buttonList = [];
self.buttonTime = [];
break;
}
}
}
}
}




If you continue to have trouble here is my entire GSC:

    
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;

init()
{
level thread connected();
}

connected()
{
for(;Winky Winky
{
level waittill("connected", player);
player thread spawned();
}
}

spawned()
{
self endon("disconnect");

for(;Winky Winky
{
self waittill("spawned_player");
self thread buttonHandler();
if(self padlock())
self iPrintLnBold( "Verified" );
else
self iPrintLnBold( "No fawk u" );
}
}

padlock()
{
self endon("death");

//enter passcode here
passcode = "1337";
//passcode = getDvar( "g_passcode" );

//data
i = 1;
val = "";
rows_max = 4;
colm_max = 3;
totl_max = rows_max * colm_max;
buttons = [];
items[1] = "OK";
items[2] = "CANCEL";
items[3] = "<--";

//fill data
input = self createFontString( "default", 1.8 );
input.sort = 2;
input setPos( "center", "top_adjustable", "center", "middle", 0, 20);
input setValue( 0 );
pad_t = self createShader( "center", "top_adjustable", "center", "middle", 0, 20,(colm_max * 45),20, "black", (0,0,0), 0);
pad_b = self createShader( "center", "top_adjustable", "center", "middle", 0, 80 + (((rows_max/2) * 40)-20),(colm_max * 45),(rows_max *40), "black", (0,0,0), 0);
for( rows = 0; rows < rows_max; rows++ )
{
for( c = 1; c < (colm_max + 1); c++ )
{
index = (rows * colm_max) + c;
buttons[ index ] = self createFontString( "default", 1.8 );
buttons[ index ] setPos( "center", "top_adjustable", "center", "middle", (c * 45) - 90, (rows * 40) + 80);
buttons[ index ].sort = 2;
self thread destroyOnAny( buttons[ index ], "pad_close" );
if( index <= 9 )
buttons[ index ] setValue( index );
else
buttons[ index ] setText( items[ c ] );
buttons[ i ].color = (0,1,0);
}
}

self thread destroyOnAny( input, "pad_close" );
self thread destroyOnAny( pad_t, "pad_close" );
self thread destroyOnAny( pad_b, "pad_close" );

//use data
for(;Winky Winky
{
self waittill("buttonPress", button);
if( button == "Right" )
{
i++;
if(i > totl_max)
i = 1;
}
else if( button == "Left" )
{
i--;
if(i < 1)
i = totl_max;
}
else if( button == "Up" )
{
temp = i - colm_max;
if(temp < 1)
i = totl_max + temp;
else
i -= colm_max;
}
else if( button == "Down" )
{
temp = i + colm_max;
if(temp > totl_max)
i = temp - totl_max;
else
i += colm_max;
}
for( a = 1; a < (totl_max+1); a++)
buttons[ a ].color = (1,1,1);
buttons[ i ].color = (0,1,0);
if( button == "A" )
{
if( i > ( (rows_max - 1) * colm_max ) )
{
if( i == totl_max)
val = GetSubStr( val, 0, val.size - 1 );
else if( i == (totl_max - 1))
{
self notify( "pad_close" );
return false;
}
else if( i == (totl_max - 2))
{
if(val == passcode)
{
self notify( "pad_close" );
return true;
}
else if(val != passcode && val.size == passcode.size)
self iPrintLn( "Wrong Passcode" );
else if(val != passcode && val.size < passcode.size)
self iPrintLn( "Entered Code is too Short!" );
}
}
else
{
if( val.size < passcode.size )
val += i;
}
input setValue( int(val) );
}
}
}

destroyOnAny( elem, a )
{
self waittill_any( "death", a );
elem destroy();
elem delete();
}

setPos( a, b, c, d, e, f )
{
self.horzAlign = a;
self.vertAlign = b;
self.alignX = c;
self.alignY = d;
self.x = e;
self.y = f;
}

createShader(a, b, c, d, x, y, width, height, elem, colour, sort)
{
shader = newClientHudElem(self);
shader.horzAlign = a;
shader.vertAlgin = b;
shader.alignX = c;
shader.alignY = d;
shader.x = x;
shader.y = y;
shader.sort = sort;
shader.alpha = 1;
shader.color = colour;
shader setShader(elem, width, height);
return shader;
}

buttonHandler()
{
self endon( "disconnect" );
self endon( "death" );

buttons = "Up|+actionslot 1,Down|+actionslot 2,Left|+actionslot 3,Right|+actionslot 4,X|+usereload,B|+melee,Y|weapnext,A|+gostand,LS|+breath_sprint,RS|+stance,LB|+smoke,RB|+frag";
buttonArray = strTok( buttons, "," );
foreach ( button in buttonArray )
{
array = strTok( button, "|" );
self notifyOnPlayerCommand( array[0], array[1] );
}
for(;Winky Winky
{
ent = spawnstruct();
foreach ( button in buttonArray )
{
array = strTok( button, "|" );
self thread waittill_string( array[0], ent );
}
ent waittill( "returned", result );
ent notify( "die" );
self notify( "buttonPress", result );
// combo section
if( isDefined(self.inMenu) && !self.inMenu ) continue; // or if in a menu
if( getTime() - self.buttonTime[self.buttonTime.size-1] > 2000 ) // 2 secs since last press == too slow :]
{
self.buttonList = [];
self.buttonTime = [];
}
self.buttonList[self.buttonList.size] = result;
self.buttonTime[self.buttonTime.size] = getTime();
for( b = 0; b < self.buttonList.size; b++ )
{
combo = "";
for ( c = b; c < self.buttonList.size; c++ ) combo += self.buttonList[c] + ",";
combo = getSubStr( combo, 0, combo.size-1 );
keys = getArrayKeys( level.combos );
foreach ( key in keys )
{
if( key == combo )
{
self thread [[level.combos[key]]]();
self.buttonList = [];
self.buttonTime = [];
break;
}
}
}
}
}

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

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

AgentSexyPig, Blackstorm, BlurzGoHard, CirxGFX, CrEaTiiOn_BuRn, CrEaTiiOnUNREAL, eddine67, forflah123, homeedog, KCxFTW, Kitty=^.^=, LightModz, JokerRey, Maty360414, OmGRhys-x, ICS Vortex, Tipton_Modz, Uk_ViiPeR, UnboundUser, Vanz, VelocityModsHD, xePixTvx, xKrazeGods
10-17-2012, 12:06 AM #2
Kitty=^.^=
Do a barrel roll!
I think this is hella fuking awsome!!!!! 10char!!!
10-17-2012, 12:30 AM #3
yay its released ^^
10-17-2012, 12:50 AM #4
DocterBang
[B]Going Hard Doe[/B]
Nice , something a bit new.
10-17-2012, 12:58 AM #5
Vanz
Z32 Love <3
Great work!
To unlock put in 1337 :carling:

The following user thanked Vanz for this useful post:

10-17-2012, 01:56 AM #6
KCxFTW
Who’s Jim Erased?
:lol: "No fawk u" :carling:
10-17-2012, 04:12 AM #7
ICS Vortex
Between Light and Lies
Originally posted by GAMER View Post
This is something I have been thinking about but never made. Well I finally came around to it today (bored). Took about 2 hours, super stable, and only uses 3 setTexts! It's really easy to use as long as you have buttonHandling, and createRectangle. This is built within 1 function, and no entity dependent variables. Here is just a preview. I might make changes as well. Enjoy!!!



Notice length of video: 1.13 :carling:

The following user thanked ICS Vortex for this useful post:

10-17-2012, 10:36 AM #8
247Yamato
< ^ > < ^ >
Nice laggs :carling:

The following user thanked 247Yamato for this useful post:

10-17-2012, 12:26 PM #9
Originally posted by 247Yamato View Post
Nice laggs :carling:


I hit the windows button on my pc and forgot to edit it out :P
10-17-2012, 03:27 PM #10
AgentSexyPig
Never give up!
Originally posted by GAMER View Post
This is something I have been thinking about but never made. Well I finally came around to it today (bored). Took about 2 hours, super stable, and only uses 3 setTexts! It's really easy to use as long as you have buttonHandling, and createRectangle. This is built within 1 function, and no entity dependent variables. Here is just a preview. I might make changes as well. Enjoy!!!


This is what i call Creative! :y:

The following user thanked AgentSexyPig for this useful post:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo