• Code not running clientside
    26 replies, posted
My code won't run clientside. CLIENT prints false anywhere in the script. I have my cl_init.lua and init.lua setup properly. Here is my code: LINK
The only place you're printing CLIENT in there in WEAPON/PrimaryAttack, which as noted on the prediction page isn't called client side in single player.
Thats the last place I've put it. Everywhere else I've tried also prints false. My if CLIENT doesn't run any any of the code because CLIENT is always false.
prints inside onOwnerPlyThink should run client side Are you sure the script is setup properly?
It was working before, im not sure what I broke. Printing CLIENT in onOwnerPlyThink returns false. I tried to add custom textures to my CloakOverlay and a few other adjustments that I cant remember. When I started up my game to check for errors i fixed any that I got and am now left with my CLIENT not running.
Why don't you just make it a shared file like most sweps?
It is
What file is this exactly? If this is the shared file, I think you need to change AddCSLuaFile("shared.lua") to AddCSLuaFile() Providing no argument will use the file it's being called in.
its my shared.lua and i dont know why i have it including itself but i do
Lemme look at one of my sweps, one sec
I don't think that will fix it.
AddCSLuaFile() is still better than typing the path/name and to be vulnerable to possible mistakes when you don't need to.
Would you stop being so fucking stubborn and just try it? 3 people have told you to do it
If my code is being included by a cl_init and init (server) it doesn't make a difference
Not to my surprise
You still having the same problem?
Yep
Could you re-post your code? Link is down.
There
Bump
Just tested your code and it works. It prints what it should print. Added your files to a dir inside lua/weapons/ and it works fine
Only on multi-player, still prints false on single player.
I think it's supposed to print 'false' on single-player
Yeah it is because im :dumb:, it will print false in primaryattack if its singleplayer, but i don't think it prints the stuff i had in my if CLIENT and i cant test it right now
So it turns out that PostPlayerThink only runs servesride on single player. I blame Garry.
You probably didn't notice, but if it's singleplayer, you're actually the server && the client, so it's normal the behavior is different
but it straight up doesn't run clientside and the wiki doesn't say anything about it
Sorry, you need to Log In to post a reply to this thread.