1. 5311

    5311 Scavenger

    Hello, I dont know how to use:

    Code (Text):
    void OnItemSelected(ItemInstance item, EquippedHandlerServer player, int slot, byte sessionId)
    {
        Puts("OnItemSelected works!");
    }
    I need:
    > Detecting when player select Ruby and who does it.
    > Remove select Ruby from player inventory.
     
  2. onStyle

    onStyle Scavenger

    anyone help? :/
     
  3. Noviets

    Noviets Master Researcher Plugin Developer

    Code (Text):
    void OnItemSelected(ItemInstance item, EquippedHandlerServer player)
    {
        if(item.Item.GetNameKey() == "Items/Ruby")
        {
            PlayerIdentity identity = player.gameObject.GetComponent<PlayerStatManager>().AttachedIdentity;
            Puts(identity.Name.ToString() + " selected a Ruby");
            //identity.Name.ToString() <-- This is the name of the player.
            //identity.SteamId.ToString() <-- This is the SteamID of the player.
        }
    }