• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
It may be a bit late now but you may have more luck using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/DrawTexturedRect]surface.DrawTexturedRect[/url] with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Material]Material[/url] with the smooth parameter set
[code] function TOOL:LeftClick( trace ) if CLIENT then return true end SafeRemoveEntity(trace.Entity) end [/code] i was trying to remove an entity from an stool earlier and it wasn't working, so i stripped out everything other than this. still doesn't work. also trace.Entity:Remove() doesn't work. what am i doing wrong?
[QUOTE=Maltech;51652524][code] function TOOL:LeftClick( trace ) if CLIENT then return true end SafeRemoveEntity(trace.Entity) end [/code] i was trying to remove an entity from an stool earlier and it wasn't working, so i stripped out everything other than this. still doesn't work. also trace.Entity:Remove() doesn't work. what am i doing wrong?[/QUOTE] Try putting the removal into server side: [CODE]if SERVER then SafeRemoveEntity(trace.Entity) end[/CODE]
[QUOTE=papi;51653633]Try putting the removal into server side: [CODE]if SERVER then SafeRemoveEntity(trace.Entity) end[/CODE][/QUOTE] Wrapping your code in an "if SERVER then end" statement doesn't magically make it run server side. From what I can tell his code is already running only server side considering he's returning early client side.
[QUOTE=bigdogmat;51654384]Wrapping your code in an "if SERVER then end" statement doesn't magically make it run server side. From what I can tell his code is already running only server side considering he's returning early client side.[/QUOTE] Sorry for the confusion in that case.
lol, so this is unusual behavior? i've even copy pasted the body from how the remover tool works (left click + DoRemoveEntity function), and that doesn't work either. totally at a loss
[QUOTE=Maltech;51654841]lol, so this is unusual behavior? i've even copy pasted the body from how the remover tool works (left click + DoRemoveEntity function), and that doesn't work either. totally at a loss[/QUOTE] Do you get any errors? Is that function wrapped in a client block itself?
I tried printing when it was being run serverside (if SERVER then print ("whatever") end), and it never adds anything to the server console. If I do the same thing in a different script (file structure is addons/name/lua/autorun/server), it does print to the server when the hook is supposed to run. very weird EDIT: i finally decided to just remake the whole file structure and save it under a different name, and it works. maybe i did something wrong the first time, maybe a broken version was cached or something. idk.
Is there any easy way to 'unlock' the player's view so it keeps going past 90 degrees pitch? I still need to be able to get the player's aim position on both client and server.
Does it matter if i use ply:SteamID() or ply:SteamID64()? Is either one better than the other?
Also, while creating a lua file for sql stuff like in here: [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexb23a.html[/url] Should I make the file server, shared, or client?
[QUOTE=Austin1346;51657049]Does it matter if i use ply:SteamID() or ply:SteamID64()? Is either one better than the other?[/QUOTE] Depends what application you're using it for. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID64]Player:SteamID64[/url] will return a 64 bit number that can easily be stored as BIGINT in databases. Server side for bots it will always return a unique value (noted on the page). [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/SteamID]Player:SteamID[/url] will return the more recognized version that people easily spot and use, although unlike the above is stored in a string and as such will take up more space if using it for something such as a database key. Also for bots this will always return "BOT" server side, and "NULL" client side. If you're using these to store information into a database, I'd recommend [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AccountID]Player:AccountID[/url], it's the 32 bit version of the steam id. For the most part they all identify a player and in many cases serve no difference. Edit: ninja'd, should refresh more often
Getting this error in gmpublish. Can't find any info about it, because it has no error code [QUOTE][IMG]https://vgy.me/HrbmdG.png[/IMG][/QUOTE] Tried all tools from [url=http://wiki.garrysmod.com/page/Workshop_Addon_Creation]this[/url] wiki tutorial, they're all says addon is fine, but can't upload it.
[QUOTE=keeperman;51649633]how do I play a sequence animation when noclipping?[/QUOTE] Sorry to bump but there is nothing to go on
[QUOTE=keeperman;51660861]Sorry to bump but there is nothing to go on[/QUOTE] Use this hook: [url]http://wiki.garrysmod.com/page/GM/HandlePlayerNoClipping[/url]
[QUOTE=iJohnny;51659817]Getting this error in gmpublish. Can't find any info about it, because it has no error code Tried all tools from [url=http://wiki.garrysmod.com/page/Workshop_Addon_Creation]this[/url] wiki tutorial, they're all says addon is fine, but can't upload it.[/QUOTE] Hm... Self-solved, maybe there was a problem with steam servers.
Is there any problem with includeing or AddCSLuaFile-ing tons and tons of stuff? I wrote some stuff that scans my gamemode path and includes files in the order I want them included, and a console command to re-run it. After 5 or 6 times, gmod crashes. Not a big deal I guess since it's just for development, and it never seems to crash when starting up, but it'd be nice if I don't have to restart gmod occasionally. I can post the code, but it's ~200 lines.
Hi, I would like to check variables while constructing a string without using millions of if statements. Is there a way to do it? For example: green=true print("This object is ".. <check if green true, then return "green" otherwise return "red">) So the result would be "This object is green". Thank you in advance!
[QUOTE=papi;51665048]Hi, I would like to check variables while constructing a string without using millions of if statements. Is there a way to do it? For example: green=true print("This object is ".. <check if green true, then return "green" otherwise return "red">) So the result would be "This object is green". Thank you in advance![/QUOTE] print("This object is ".. (green and "green" or "red")) The syntax is pretty much: <statement> <operator> <variable>.
[QUOTE=papi;51665048]Hi, I would like to check variables while constructing a string without using millions of if statements. Is there a way to do it? For example: green=true print("This object is ".. <check if green true, then return "green" otherwise return "red">) So the result would be "This object is green". Thank you in advance![/QUOTE] [code] "This object is " .. (green and "green" or "red") [/code]
[QUOTE=mijyuoon;51665058][code] "This object is " .. (green and "green" or "red") [/code][/QUOTE] Thank you very much!
[QUOTE=code_gs;51661633]Use this hook: [url]http://wiki.garrysmod.com/page/GM/HandlePlayerNoClipping[/url][/QUOTE] Thanks but I cant seem to get it to work, the hook isnt called and I really have no clue how to do this. Could anyone explain what I'm wrong? [code] local State = boolean hook.Add( "PlayerNoClip", "isInNoClip", function( ply, desiredNoClipState ) Stated = desiredNoClipState end) function Noclapping( ply, velocity ) if ( !State ) then return false end ply:AddVCDSequenceToGestureSlot(GESTURE_SLOT_CUSTOM, ply:LookupSequence("sit"), 0, false) ply:AnimSetGestureWeight(GESTURE_SLOT_CUSTOM, 1) return true end hook.Add("HandlePlayerNoClipping", "HPNoClip", Noclapping) [/code]
[QUOTE=keeperman;51665423]Thanks but I cant seem to get it to work, the hook isnt called and I really have no clue how to do this. Could anyone explain what I'm wrong? [code] local State = boolean hook.Add( "PlayerNoClip", "isInNoClip", function( ply, desiredNoClipState ) Stated = desiredNoClipState end) function Noclapping( ply, velocity ) if ( !State ) then return false end ply:AddVCDSequenceToGestureSlot(GESTURE_SLOT_CUSTOM, ply:LookupSequence("sit"), 0, false) ply:AnimSetGestureWeight(GESTURE_SLOT_CUSTOM, 1) return true end hook.Add("HandlePlayerNoClipping", "HPNoClip", Noclapping) [/code][/QUOTE] [CODE] local State = boolean [/CODE] This is equivalent to false as it's trying to find a variable called boolean and can't. Try true
[QUOTE=keeperman;51665423]:snip:[/QUOTE] For starters you shouldn't return false if you haven't changed anything, that breaks other hooks. Second is you're setting `Stated` within the "PlayerNoClip", but using `State` in the "HandlePlayerNoClipping" hook. Third is you shouldn't be doing the noclip check like this at all, you should use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetMoveType]Entity:GetMoveType[/url] and check if it's equal to MOVETYPE_NOCLIP
Nutscript entities dont stay after a restart, I am using the talker and cctv plugin and all of the entities Ive placed disappeared. How can I make them stay without breaking them?
I want to draw text above an entity, like a sprite of some text. How would I do that?
[QUOTE=DavidRalphsky;51668693]I want to draw text above an entity, like a sprite of some text. How would I do that?[/QUOTE] [url]https://facepunch.com/showthread.php?t=1440586[/url] First code block adapted to an entity would work Whoops, didn't see all the bone stuff. It's p much the same thing though, just need to find the pos and angle for the entity. [url]https://wiki.garrysmod.com/page/cam/Start3D2D[/url]
My class does not seem to be working This is what is in my class file [code] AddCSLuaFile() DEFINE_BASECLASS( "player_default" ) local PLAYER = {} PLAYER.WalkSpeed = 100 PLAYER.RunSpeed = 1 function PLAYER:Loadout() self.Player:RemoveAllAmmo() self.Player:GiveAmmo( 256, "Pistol", true ) self.Player:Give( "weapon_pistol" ) end player_manager.RegisterClass( "player_custom", PLAYER, "player_default" ) When I try use player_manager.SetPlayerClass( ply, "player_custom" ) [/code] it just spawns the player with nothing, please help!
Hi, I am trying to set spawnicon bodygroups but it is not working at all, spawnicon displays empty space. Could someone tell me how is it done properly, please? My code is the following: [CODE]helm=vgui.Create("SpawnIcon", invpanel) helm:SetSize(Sw(100),Sh(100)) helm:SetModel("models/rpg/headarmor.mdl",0,1)[/CODE] Thank you very much in advance!
I'm trying to remove something from a database upon removal of a specific entity. This is what I have, but the problem is the server shuts down it also gets removed from database, which I dont want. [code] function ENT:Remove() local query = "DELETE FROM spawnpoints WHERE id = '" .. id .. "'"; sql.Query(query); end [/code]
Sorry, you need to Log In to post a reply to this thread.