1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

Other Weird error.

Discussion in 'Development' started by grafikerror, Oct 18, 2017.

  1. grafikerror

    grafikerror Clockwork Customer

    Greetings,

    Tried to run either into ITEM:OnCustomFunction (Not putting self.uniqueID because the item to check isnt this one);
    Code:
    if (player:HasItemByID("npc_cha")) then
    and
    Code:
    if (Clockwork.inventory:HasItemByID(player, "npc_cha")) then
    Both are giving me the same error for strange reason, i can assure you that "npc_cha" is a valid unique ID since I have few instances of this item in my inventory !

    Code:
    The 'InvAction' command has failed to run.
    gamemodes/clockwork/framework/libraries/sh_inventory.lua:181: attempt to call local 'itemTable' (a nil value)
    
    Any idea guys ?
    @kurozael
     
    Last edited: Oct 18, 2017
  2. Svensis

    Svensis Guest

    if (player:HasItemByID(self.uniqueID)) then
    make sure you have set a unique id, this worked for me.
     
  3. grafikerror

    grafikerror Clockwork Customer

    Does "npc_cha" looks like a name ? No, it is a uniqueID.
     
  4. Svensis

    Svensis Guest

    i c+p what i used yesterday, it worked for me you are probs doing something else wrong.
    edit: give the whole code so i can see
     
  5. grafikerror

    grafikerror Clockwork Customer

    Here you go comrade :
    Code:
    https://pastebin.com/KjtrbfAP
    
     
    Last edited: Oct 18, 2017
  6. Svensis

    Svensis Guest

    gamemodes/clockwork/framework/libraries/sh_inventory.lua:181: attempt to call local 'itemTable' (a nil value
    pretty sure if your attempting to port from a different framework or whatever youd need to localize the
    itemTable.whatever to be the same as ITEM.whatever
    unless you've done so?
    Code:
        ITEM.name = ".357 Magnum Bullets";
        ITEM.cost = 100;
        ITEM.classes = {CLASS_EOW};
        ITEM.model = "models/items/357ammo.mdl";
        ITEM.weight = 1;
        ITEM.access = "V";
        ITEM.uniqueID = "ammo_357";
        ITEM.business = true;
        ITEM.ammoClass = "357";
        ITEM.spawnValue = 2;
        ITEM.spawnType = "ammunition";
        ITEM.ammoAmount = 21;
        ITEM.description = "A small box filled with bullets and Magnum printed on the side.";
     
  7. grafikerror

    grafikerror Clockwork Customer

    Its done since all the code i sent you is in :
    function cwPlugin:ClockworkItemInitialized(itemTable)
    All the script beside the "HasItemByID()" is perfectly working, i can assure you.
    Going to wait for kuro's help.
     
  8. Svensis

    Svensis Guest

    alright i doubt he will help you port items from a different framework tho
    local itemTable = nut.item.list[unique]
     
  9. grafikerror

    grafikerror Clockwork Customer

    Its not at all from a different framework, everything i sent you is in plugin folder, i made it from scrap, just tired of doing items one by one, so directly doing it by creating a plugin that modify ClockworkItemInitialized(itemTable). You're off topic.
     
  10. grafikerror

    grafikerror Clockwork Customer

    Problem fixed !
    Close this topic !
     

Previous Readers (Total: 0)