| Blockland Forums > Modification Help |
| Getting last used tool |
| (1/2) > >> |
| Jorgur:
How do I get the slot of the last wielded tool when the player does not have a tool raised? The player raises this tool when you press Q again, so it should be possible. %Player.currTool is -1 regardless of what was last held. |
| Daenth:
--- Code: ---function serverCmdUnUseTool(%client) { %player = %client.player; %player.lastUsedTool = %player.currTool; Parent::serverCmdUnUseTool(%client); } --- End code --- There you go, when the player presses Q to hide their inventory, a variable is assigned to their player with the last tool used. |
| Jorgur:
I was hoping there was an easier way... |
| Daenth:
--- Quote from: Jorgur on July 13, 2011, 12:07:24 PM ---I was hoping there was an easier way... --- End quote --- I believe that's as easy as it gets. More simplified: --- Code: ---function serverCmdUnUseTool(%client) { %client.player.lastUsedTool = %client.player.currTool; Parent::serverCmdUnUseTool(%client); } --- End code --- 5 lines of code is pretty easy. =/ |
| Chrono:
It needs to be in a package. |
| Navigation |
| Message Index |
| Next page |