Author Topic: Inventory Commands  (Read 1687 times)

are there any commands for the inventory? like getting the current slot, current item name, and switching to a slot number? or a way to see what is in each slot without swapping items? (from a scripting view, not player view)

are there any commands for the inventory? like getting the current slot, current item name, and switching to a slot number? or a way to see what is in each slot without swapping items? (from a scripting view, not player view)

Yes, both client sided and server sided.. which one are you trying to do?


Serversided:

serverCmdUseTool(%client, %slot)
serverCmdUnUseTool(%client)
%client.slot[(slotnum)] (ie %client.slot[%client.currtool])
%client.currtool


I'm not entirely certain of anything client-sided, so I guess telling you wouldn't be a great idea. Wouldn't want to give false information, now would I?

hmm, the annoyance of making client mods is that i can't do everything the server can :I

hmm, the annoyance of making client mods is that i can't do everything the server can :I
Is there something specific you're trying to do? Since you're a bro, message me on RTB if you need any help.

i just need a way to find which slot is currently active, and what is in the active slot, that's really about it

Well, serverCmdUseTool( client, slot ) is sent to the server every time the client wishes to change to another inventory slot. You could simply save a variable every time the client sends this (doing some if checks to make sure that they should be sending that first of course). I don't remember if there is already a default variable specifying the currently active slot, but at least the previously mentioned method would work.

client.currTool, I believe. And also: client.slot[ client.currTool ].
« Last Edit: December 30, 2011, 01:02:25 PM by Port »

wouldn't those be server sided though?

HUD_ToolName.getValue() - name of current item
getWord(HUD_ToolActive.position, 1) / 64 - index of current item (starting from 0)

thanks, the commands do exactly what i need :D

edit: for some reason the keybind isn't showing up on options when i run BL, but only after i use exec("add-ons/client_usepill/client.cs");
edit: fixed
« Last Edit: January 01, 2012, 04:12:55 PM by phflack »

What are you making anyway?