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, 08:02 AM #11
Blackstorm
Veni. Vidi. Vici.
Originally posted by ..V.. View Post
When I used it as "Breathe" on PS3 it came up as unbound and didn't work..

Even KBrizzle makes mistakes then .. !


Nobody's perfect, also, nice to have you back here Dancing
03-02-2011, 11:17 AM #12
DEREKTROTTER
You're Goddamn Right
Originally posted by .Blackstorm View Post
Nobody's perfect, also, nice to have you back here Dancing


Did u do anything with the big patch_mp.ff?
03-02-2011, 05:47 PM #13
Blackstorm
Veni. Vidi. Vici.
Originally posted by DEREKTROTTER View Post
Did u do anything with the big patch_mp.ff?


What do you mean
03-02-2011, 05:49 PM #14
malanof5
Error… Cat invasion!
Thanks for this now I know this, but where do we add it in the patch if I didn't read it correctly?
03-02-2011, 06:28 PM #15
DEREKTROTTER
You're Goddamn Right
Originally posted by .Blackstorm View Post
What do you mean


well u told me you put moss's PPV2 into the largeGSC right? just thought you was on with something
03-02-2011, 08:51 PM #16
pcfreak30
>> PCFreak30.com Happy<<
Well there are many designs for button handling. I prefer to use notify channels. I also think its a better idea to use strTok to compress the code.

Good job anyways.
03-02-2011, 09:20 PM #17
Blackstorm
Veni. Vidi. Vici.
Originally posted by pcfreak30 View Post
Well there are many designs for button handling. I prefer to use notify channels. I also think its a better idea to use strTok to compress the code.

Good job anyways.


I did that but like I said it's straight up copy pasta lol

so all I did was modify the button names lol
03-03-2011, 03:12 AM #18
Originally posted by KNiiFE View Post
Thanks Happy
.......


whiteboy.. wth man.. why do you hate me so much?
03-04-2011, 07:03 PM #19
K-Brizzle
Do a barrel roll!
:mudkip: nice from me :mudkip:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo