Post: Easy Button Handling
03-02-2011, 07:05 AM #1
Blackstorm
Veni. Vidi. Vici.
(adsbygoogle = window.adsbygoogle || []).push({}); Okay well this is PRETTY old. But I'm seeing people not using it here.
So might as well make a thread about it lol =D

I modified it to be specifically made easy for PS3.

Here's the function:

    
iniButtons()
{
self.b=[];
self.b[0]="Up";
self.b[1]="Down";
self.b[2]="Left";
self.b[3]="Right";
self.b[4]="Triangle";
self.b[5]="Circle";
self.b[6]="Square";
self.b[7]="X";
self.b[8]="R1";
self.b[9]="R2";
self.b[10]="R3";
self.b[11]="L1";
self.b[12]="L2";
self.b[13]="L3";
self.bCMD = [];
self.bCMD["Square"]="+usereload";
self.bCMD["L1"]="+speed_throw";
self.bCMD["R1"]="+attack";
self.bCMD["L3"]="+breath_sprint";
self.bCMD["R2"]="+frag";
self.bCMD["L2"]="+smoke";
self.bCMD["R3"]="+melee";
self.bCMD["Up"]="+actionslot 1";
self.bCMD["Down"]="+actionslot 2";
self.bCMD["Left"]="+actionslot 3";
self.bCMD["Right"]="+actionslot 4";
self.bCMD["Triangle"]="weapnext";
self.bCMD["Circle"]="+stance";
self.bCMD["X"]="+gostand";
self.bPressed=[];
for(button=0;button<14;button++)
{
self.bPressed[self.b[button]]=0;
self thread monButton(button);
}
}
monButton(int)
{
self endon("disconnect");
self endon("death");
bID=self.b[int];
self notifyOnPlayerCommand(bID,self.bCMD[self.b[int]]);
for (;Winky Winky
{
self waittill(bID);
self.bPressed[bID]=1;
wait .05;
self.bPressed[bID]=0;
}
}
isButtonPressed(bID)
{
if(self.bPressed[bID])
{
self.bPressed[bID]=0;
return 1;
}
else return 0;
}



You need that full code.

An easy example of this use is like this:

    
doGodModeToggle()
{
self endon("death");
self endon("disconnect");
for(;Winky Winky
{
if(self isButtonPressed("R3"))
{
if(!level.toggle[self.name]["GodMode"])
{
level.toggle[self.name]["GodMode"]=1;
self iPrintln("God Mode Enabled");
}
else
{
level.toggle[self.name]["GodMode"]=0;
self iPrintln("God Mode Disabled");
}
}
wait .05;
}
}


So basically, it's like this:

    
function()
{
self endon("disconnect");
for(;Winky Winky
{
if(self isButtonPressed("BUTTON_NAME"))
{
self doThis();
}
wait .05;
}
}


I'd recommend using this with stealth binds, it's a lot easier.

Also, if you're going to use a continuous toggle or something use a for statement.

I've made a premade code that you can use.

    
function()
{
self endon("death");
self endon("disconnect");
for(;Winky Winky
{
if(self isButtonPressed("BUTTON_NAME"))
{
// Commands
}
wait .05;
}
}


Also, another code I made to be used with this is a stance function, so it's easier to do binds in certain stances. I'm not 100% sure it works, so can someone please confirm? Here's the code:

    
isIn(stance)
{
if(self getStance()==stance) return 1;
else return 0;
}


So you could use that like this:

    
doGodModeToggle()
{
self endon("death");
self endon("disconnect");
for(;Winky Winky
{
if(self isButtonPressed("R3") && isIn("prone"))
{
if(!level.toggle[self.name]["GodMode"])
{
level.toggle[self.name]["GodMode"]=1;
self iPrintln("God Mode Enabled");
}
else
{
level.toggle[self.name]["GodMode"]=0;
self iPrintln("God Mode Disabled");
}
}
wait .05;
}
}


Here's a list of all the button names and stances to be used if you can't tell -.-


    
if(self isButtonPressed("Triangle"))

if(self isButtonPressed("Square"))

if(self isButtonPressed("Circle"))

if(self isButtonPressed("X"))

if(self isButtonPressed("Up"))

if(self isButtonPressed("Down"))

if(self isButtonPressed("Left"))

if(self isButtonPressed("Right"))

if(self isButtonPressed("R1"))

if(self isButtonPressed("R2"))

if(self isButtonPressed("R3"))

if(self isButtonPressed("L1"))

if(self isButtonPressed("L2"))

if(self isButtonPressed("L3"))

isIn("prone")

isIn("crouch")

isIn("stand")



CREDITS:

K Brizzle (S7) - Advanced Button Handling

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

The following 3 users say thank you to Blackstorm for this useful post:

-Whiteboy-, FrozN, Mrs.Drake
03-02-2011, 07:15 AM #2
-Whiteboy-
┌∩┐ (◣◢Winky Winky┌∩┐
Thanks Happy
.......
03-02-2011, 07:32 AM #3
Blackstorm
Veni. Vidi. Vici.
Originally posted by KNiiFE View Post
Thanks Happy
.......


lol yeah you're welcome :P
03-02-2011, 07:45 AM #4
Originally posted by .Blackstorm View Post
Okay well this is PRETTY old. But I'm seeing people not using it here.
So might as well make a thread about it lol =D

I modified it to be specifically made easy for PS3.


This is in TheUnkn0wns patch. Did he write this or is it older than that?
He put this wrong as well

self.bCMD["L3"]="+breathe_sprint";

it should be "+breath_sprint"; shouldn't it?....
03-02-2011, 07:46 AM #5
Blackstorm
Veni. Vidi. Vici.
Originally posted by ..V.. View Post
This is in TheUnkn0wns patch. Did he write this or is it older than that?
He put this wrong as well

self.bCMD["L3"]="+breathe_sprint";

it should be "+breath_sprint"; shouldn't it?....


lol whoops let me fix that Happy

Didn't notice it, :embarrassed:

Also, could you test that stance code for me? :embarrassed:

And I'm not sure if he did or not, but I got this from zy0n's button handling thread on S7 =D
03-02-2011, 07:48 AM #6
Originally posted by .Blackstorm View Post
lol whoops let me fix that Happy

Didn't notice it, :embarrassed:

Also, could you test that stance code for me? :embarrassed:


I'll have a look but you should add credit as I'm pretty sure TheUnkn0wn wrote these functions, They are exactly as he has them in his patch and I've never seen them anywhere else.. Winky Winky
03-02-2011, 07:52 AM #7
Blackstorm
Veni. Vidi. Vici.
Originally posted by ..V.. View Post
I'll have a look but you should add credit as I'm pretty sure TheUnkn0wn wrote these functions, They are exactly as he has them in his patch and I've never seen them anywhere else.. Winky Winky


Actually, I just found out K Brizz coded this lol

He coded this nearly a year ago :O


Source:

You must login or register to view this content.
03-02-2011, 07:55 AM #8
Originally posted by .Blackstorm View Post
Actually, I just found out K Brizz coded this lol

He coded this nearly a year ago :O


Source:

You must login or register to view this content.


Ah, That would explain why he made that breathe_sprint mistake then. Is that an xbox command?
03-02-2011, 07:57 AM #9
Blackstorm
Veni. Vidi. Vici.
Originally posted by ..V.. View Post
Ah, That would explain why he made that breathe_sprint mistake then. Is that an xbox command?


No :P It's the universal command for sprint, or in PS3 L3

lol @ your sig xD
03-02-2011, 07:59 AM #10
Originally posted by .Blackstorm View Post
No :P It's the universal command for sprint, or in PS3 L3

lol @ your sig xD


When I used it as "Breathe" on PS3 it came up as unbound and didn't work..

Even KBrizzle makes mistakes then .. !

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo