Author Topic: New Button Action?  (Read 650 times)

Like, say I want to make it, so if I have a certain item equipped, that if I press a button, it does something.
Is it possible to make something like that out of this:
Code: [Select]
stateTransitionOnTriggerUpOnly have it say something like..
Code: [Select]
stateTransitionOnTriggerBThe B represents the letter on the keyboard.
Is this possible? Or do I have to go through more confusing things to do this?
All I need to know, if that doesn't work is:
Where to put the button to push.
Where to put the what happens when the button is pressed,
Etc.

Again, I want it so only that thing happens when I press the button, and if the weapon is equipped.

TriggerUp means if you release the mouse, not the 'Up' key.

You can package/override server commands such as servercmdUseSprayCan(%client,%paint) to get when the player presses their Paint button or use Armor::onTrigger() slot 4 for detecting when you jet, etc, but you cannot specifically detect a key on a client's keyboard without clientside mods.

Look at my Portal Gun, Gravity Gun or Dual Guns for how to detect a jet/right click.
I think Qwertyuiopas' Portal Gun uses Paints/E for picking cubes up.
Kaje's Box Truck uses Jump/Space to open the truck.

Could I use numbers for building?

Yes. These functions are called when you press each key:
servercmdShiftBrick(client,x,y,z)
0,1,0 = Shift forwards (Numpad 8)
0,-1,0 = Shift backwards (2)
1,0,0 = Shift right (6)
-1,0,0 = Shift left (4)
0,0,3 = Shift up (+)
0,0,-3 = Shift down (5)
0,0,1 = Shift up 1/3 (3)
0,0,-1 = Shift down 1/3 (1)
servercmdSuperShiftBrick(client,x,y,z)
servercmdPlantBrick(client) (Enter)
servercmdRotateBrick(client,direction) (9 and 3) <- I'm not sure whether this one is the function