| Blockland Forums > Modification Help |
| Keybinds |
| (1/4) > >> |
| jes00:
How to I script a keybind? |
| adam savage:
$remapDivision[$remapCount] = "Division Name"; $remapName[$remapCount] = "Command Name"; $remapCmd[$remapCount] = "Name_Of_Function"; $remapCount++; function Name_Of_Function(%...) { All Coding here... } |
| jes00:
--- Quote from: adam savage on July 21, 2011, 08:59:47 AM --- $remapDivision[$remapCount] = "Division Name"; $remapName[$remapCount] = "Command Name"; $remapCmd[$remapCount] = "Name_Of_Function"; $remapCount++; function Name_Of_Function(%...) { All Coding here... } --- End quote --- Like this? --- Code: ---$remapDivision[$remapCount] = "Hi And Bye Mod"; $remapName[$remapCount] = "Turn On"; $remapCmd[$remapCount] = "Client_HiAndByeMod"; $remapCount++; --- End code --- |
| Placid:
--- Quote from: jes00 on July 21, 2011, 09:14:45 AM ---Like this? --- Code: ---$remapDivision[$remapCount] = "Hi And Bye Mod"; $remapName[$remapCount] = "Turn On"; $remapCmd[$remapCount] = "Client_HiAndByeMod"; $remapCount++; --- End code --- --- End quote --- that would execute function Client_HiAndByeMod whenever you press the key bound to it. what you want to do is make a function in the file and then when you press the keybind it will do that function. i.e. --- Code: ---$remapDivision[$remapCount] = "Client Kill Mod"; $remapName[$remapCount] = "Self Delete"; $remapCmd[$remapCount] = "loool"; $remapCount++; function lool() { commandtoserver('Self Delete'); } --- End code --- if i pressed the key it would Self Delete me. edit: some people also like to add an if statement: --- Code: ---if(!$ClientKill::Binds) { $remapDivision[$remapCount] = "Client Kill Mod"; $remapName[$remapCount] = "Self Delete"; $remapCmd[$remapCount] = "loool"; $remapCount++; $ClientKill::Binds=1; } function lool() { commandtoserver('Self Delete'); } --- End code --- |
| Nexus:
One more thing to note, is that keys call the command both when they are pressed, and when they are released. say key "K" is bound to command "cake" --- Code: ---function cake(%x) { if(%x) echo("You pressed the key"); else echo("You released the key"); } --- End code --- |
| Navigation |
| Message Index |
| Next page |