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 Client side Think() Function not running in plugin.

Discussion in 'Development' started by Mucker, Apr 27, 2017.

  1. Mucker

    Mucker Clockwork Customer

    So, currently working on a plugin that allows you to temporarily ban a character, much in the same way that the player banning works and it's nearly done, except I've come across a snag. Whenever I put the following into cl_hooks.lua or cl_plugin. lua, nothing gets spammed to the client side console like it should:
    Code:
    function PLUGIN:Think()
      print("test");
    end;
    
    and that's it. if I intentionally mess up the function by, say, removing the "end" portion it'll give me a compile error, but after correcting it the function itself isn't running every tick like it should.

    So what I've tried and made sure I have and possible causes(?):

    1. Yes I have cl_hooks.lua and cl_plugin.lua indexed in sh_plugin.lua:
    Code:
    Clockwork.kernel:IncludePrefixed("cl_plugin.lua");
    Clockwork.kernel:IncludePrefixed("cl_hooks.lua");
    Clockwork.kernel:IncludePrefixed("sv_plugin.lua");
    
    2. Tried removing the plugin, starting up the server from .bat, then shutting it down and adding the plugin back in and restarting afterwards.

    3. Tried the Think() function in sv_plugin.lua, worked fine there (which I'll probably be using instead for security reasons)

    4. Tested the Think() function, copy pasted in fact, in another plugin in cl_hooks.lua and it ran how it should've.

    Causes?
    5. The cl_hooks.lua and cl_plugin.lua files were added in after the initial plugin was loaded (initially was just sh_plugin.lua and sv_plugin.lua).

    6. When I indexed the two files I initially made a mistake in the string name.

    Finally, this seems to go for every other function I've tried to hook into with "PLUGIN:<function>" client-side as well.
     
    • Funny Funny x 2
    Last edited: Apr 27, 2017
  2. duck

    duck Phant0m Legend

    Hard to say what it might be without looking at the whole file. There's a few different things that could cause this. First thing I'd do is make sure your file is being ran in the first place by putting a print at the top.
     
  3. Mucker

    Mucker Clockwork Customer

    The problem seems to be happening in sv_plugin.lua now too, so I'm doing my testing from it.

    File is running, the print statement showed up:
    [​IMG]

    I just noticed that on initial startup (not a mapchange but from the .bat) the print statement I put in Think() did infact show up. I also tried changing it to Tick() and same result, print statement shows up once near the end of the loading:
    [​IMG]
    The print statement being "pe" (ignore the lines with fields that's from something else).
     
    • Winner Winner x 1
  4. Mucker

    Mucker Clockwork Customer

    If anyone's curious I just copy pasted everything to a new plugin folder to make it work again (as in copy paste the file contents to other files, not copy the files themselves).

    this can be locked or whatever it needs to be.
     
  5. vexus

    vexus ej rockwell's worst nightmare Staff Member Manager Legend Clockwork Customer

    what a weird problem.
     

Previous Readers (Total: 0)