Author Topic: Check if player holding an item and other Q's  (Read 1069 times)

I'll make this short and simple, is there some way to check if a player is holding an item, or if they have an item in their inventory?

Second, is it possible to make a GUI partially click through, as in one part does something in the GUI, but another part goes through to the game, and while we're on the subject, is it possible to make a part of a GUI invisible?

Third, how do I check what brick a player has selected in the 1234567890 bar?

Fourth, how do I trigger something off of a click of the mouse without an item being held?

Basically what I want is something like the Minecraft-thing, where when you click while a certain brick is selected, something happens.

1. i)
Code: [Select]
if(%client.player.tool[%client.player.currTool] == nameToID("nameofyouritemdatablock"))
{
        //do stuff
}
  ii)
Code: [Select]
for(%i=0;%i<%client.player.dataBlock.maxTools;%i++)
{
        if(%client.player.tool[%i] == nameToID("nameofyouritemdatablock"))
        {
                //do stuff
        }
}
2. i) Got no idea what you're going on about there.
    ii)
Code: [Select]
guiControl.setVisible(0);
3. I'm not quite sure on this one. I'll play around in-game and get back with an answer.
4. package the Player::activateStuff function.

Thanks, was wondering how to do that, will be useful for things I'm planning to do.

Edit: Just thought of another, sort of an extension on #4, what about when a player clicks while holding the brick planter?
« Last Edit: December 19, 2009, 09:49:54 PM by Shad0wyone »

what about when a player clicks while holding the brick planter?
trace(true);
click click click...
trace(false);
Look for armor::onTrigger()
Package & add your own functionality
Ta-Dah!
« Last Edit: December 21, 2009, 09:02:16 PM by BobAndRob »

Strange name for that function but that's fine, thanks for your help.

Basically what I want is something like the Minecraft-thing, where when you click while a certain brick is selected, something happens.
Truce already made a mod that does this.