• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
In the next gmod update, they've added a second argument to this [URL="http://wiki.garrysmod.com/page/Player/Give"]function[/URL] - until that update comes out what's the best way to do this? Thanks
Subtract the DefaultClip1/2 values from the weapon's ammo type.
Did you util.AddNetworkString openShop? Also, IsValid(call) is useless since the caller will always be an entity.
[QUOTE=dx9er;51719665]Yes, I put it serverside (it wouldn't have worked clientside anyways), and I'll remove the IsValid check.[/QUOTE] Put prints in your code to see if it goes past that if statement, and to see if it actually networks it.
[QUOTE=dx9er;51719713]Tested, didn't even get through ENT:Use. Might be because my entity is supposed to be an NPC? [code]function ENT:Initialize() self:SetModel("models/odessa.mdl") self:SetHullType( HULL_HUMAN ) self:SetHullSizeNormal() self:SetNPCState( NPC_STATE_SCRIPT ) self:SetSolid( SOLID_BBOX ) bit.bor( CAP_ANIMATEDFACE , CAP_TURN_HEAD) self:SetUseType( SIMPLE_USE ) self:DropToFloor() end[/code][/QUOTE] If I remember correctly, `ENT:Use()` isn't called on NPCs and you have to use "PlayerUse" hook with a check instead.
How can I manually call ent:DrawModel on the viewmodel with the correct FOV? Calling it in the Pre/PostDrawViewModel hook naturally crashes the game, but other hooks seem to lack the correct fov.
Why will my functions in the shared file only work on the server file after I to manually refresh the shared file? My shared file location: addonname\lua\autorun\shared.lua My server file location: addonname\lua\autorun\server\server.lua Any response would be fantastic, i'm at a complete loss.
[QUOTE=Bings;51722447]Why will my functions in the shared file only work on the server file after I to manually refresh the shared file? My shared file location: addonname\lua\autorun\shared.lua My server file location: addonname\lua\autorun\server\server.lua Any response would be fantastic, i'm at a complete loss.[/QUOTE] Single-player, listen, or dedi?
[QUOTE=code_gs;51722472]Single-player, listen, or dedi?[/QUOTE] Here is where it gives me a headache, on single player and on a dedicated server, but it works fine running SRCDS on the same machine as the client. [B]Edit:[/B] Nvm my fix un-fixed, grrr
[QUOTE=Bings;51722522]Here is where it gives me a headache, on single player and on a dedicated server, but it works fine running SRCDS on the same machine as the client. [B]Edit:[/B] Nvm my fix un-fixed, grrr[/QUOTE] OS?
[QUOTE=code_gs;51722606]OS?[/QUOTE] Windows [B]Edit:[/B] Nvm once again, think ive fixed it (again). Its 2:30am for me so im lost in my own thoughts, sorry for filling up the thread. [B]Edit[/b] I just forgot to put autorun\ in an include, eurgh I need sleep. Thanks code_gs for trying to help though <3
What Hook should I override to disable making client-side corpse of player on death? And do flashlight work by default when I derive from sandbox? Cuz for a weird reason flashlight doesn't work in my gamemode
[QUOTE=YoutoYokodera;51722760]What Hook should I override to disable making client-side corpse of player on death? And do flashlight work by default when I derive from sandbox? Cuz for a weird reason flashlight doesn't work in my gamemode[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CreateClientsideRagdoll]GM:CreateClientsideRagdoll[/url] You'll probably need to return true in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSwitchFlashlight]GM:PlayerSwitchFlashlight[/url] and run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowFlashlight]Player:AllowFlashlight[/url]
Should I use vgui.Register or derma.DefineControl when creating custom panels? (what's the difference?)
[QUOTE=code_gs;51722808][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/CreateClientsideRagdoll]GM:CreateClientsideRagdoll[/url] You'll probably need to return true in [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerSwitchFlashlight]GM:PlayerSwitchFlashlight[/url] and run [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/AllowFlashlight]Player:AllowFlashlight[/url][/QUOTE] Isn't that will disable NPCs corpse as well?
[QUOTE=YoutoYokodera;51722760]What Hook should I override to disable making client-side corpse of player on death? And do flashlight work by default when I derive from sandbox? Cuz for a weird reason flashlight doesn't work in my gamemode[/QUOTE] I had this same problem when I was making my player revival addon for the workshop and what I eventually had to do was just make it invisible. I don't remember if I set nodraw or just set their color to completely transparent, but it was one of those two. If you use the addon and listen closely you can still hear the original body hit the ground.
[QUOTE=YoutoYokodera;51723034]Isn't that will disable NPCs corpse as well?[/QUOTE] ent:IsPlayer()?
[QUOTE=YoutoYokodera;51723034]Isn't that will disable NPCs corpse as well?[/QUOTE] [url]https://facepunch.com/showthread.php?t=1527762&p=50754359&viewfull=1#post50754359[/url]
[QUOTE=TFA;51720539]How can I manually call ent:DrawModel on the viewmodel with the correct FOV? Calling it in the Pre/PostDrawViewModel hook naturally crashes the game, but other hooks seem to lack the correct fov.[/QUOTE] Untested, should work though: [lua] hook.Add("PreDrawEffects", "drawViewModel", function() local wep = LocalPlayer():GetActiveWeapon() if not IsValid(wep) then return end local viewmodel = LocalPlayer():GetViewModel() if not IsValid(viewmodel) then return end local fov = wep.ViewModelFOV or 54 cam.Start3D(EyePos(), EyeAngles(), fov) cam.IgnoreZ(true) viewmodel:DrawModel() cam.IgnoreZ(false) cam.End3D() end) [/lua]
[QUOTE=SFArial;51723546]Untested, should work though: hook.Add("PreDrawEffects", "drawViewModel", function() local wep = LocalPlayer():GetActiveWeapon() if not IsValid(wep) then return end local viewmodel = LocalPlayer():GetViewModel() if not IsValid(viewmodel) then return end local fov = wep.ViewModelFOV or 54 cam.Start3D(EyePos(), EyeAngles(), fov) cam.IgnoreZ(true) viewmodel:DrawModel() cam.IgnoreZ(false) cam.End3D() end)[/QUOTE] First thing I tried, actually. The wep.ViewModelFOV isn't actually the same FOV which the viewmodel is drawn as, and I can't figure out the ratio. For HL2 weapons, I had to add 12.5 for whatever reason, and it varies wildly.
Did you also try something silly like this: [lua] local VM_DRAW_COUNTER = 0 local VM_DRAW_LIMIT = 2 function GM:PreDrawViewModel(vm, pl, wep) VM_DRAW_COUNTER = VM_DRAW_COUNTER + 1 if VM_DRAW_COUNTER >= VM_DRAW_LIMIT then return end vm:DrawModel() end function GM:PostDrawViewModel(vm, pl, wep) VM_DRAW_COUNTER = VM_DRAW_COUNTER - 1 end [/lua]
[QUOTE=TFA;51723561]First thing I tried, actually. The wep.ViewModelFOV isn't actually the same FOV which the viewmodel is drawn as, and I can't figure out the ratio. For HL2 weapons, I had to add 12.5 for whatever reason, and it varies wildly.[/QUOTE] Here's are the sources: [url]https://github.com/LestaD/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/client/view.cpp#L611-L614[/url] [url]https://github.com/LestaD/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/client/view.cpp#L796-L798[/url]
So I'm working on a system to allow you to walk up walls right now, but since there doesn't seem to be a way to set the angles of a player when the player reaches an angle >45 degrees they can't go any further. Simulated gravity has been implemented, so how would I: a. Rotate the player b. Stop the player from sliding down a slope
You can't rotate the player afaik, atleast not on the server side (aka where it would be the most relevant). Not to mention that in source, the player's collision hull is an axis aligned bounding box, so you can't rotate that either. As for sliding, you would need to modify the existing player movement, or better yet, implement your own from scratch that can account for direction of gravity.
Is there a way to have higher resolution auto-generated spawn icons in a game mode? By auto-generated, I mean spawn icons made by the engine of current models, using DSpawnIcon class. Thanks in advance! [editline]25th January 2017[/editline] [QUOTE=meharryp;51724012]So I'm working on a system to allow you to walk up walls right now, but since there doesn't seem to be a way to set the angles of a player when the player reaches an angle >45 degrees they can't go any further. Simulated gravity has been implemented, so how would I: a. Rotate the player b. Stop the player from sliding down a slope[/QUOTE] You can rotate player models if you use GetModel():SetAngles(), but then you need to network the rotation to every client. Which creates a lot of network activity when a large number of players are online. The bounding box and collision hull can be modified as well, but as SFArial pointed out, it will not rotate with the player model. In which case the best solution would be an appropriately sized square bounding box around the pelvis area (32*32*32). To stop the player sliding down a slope, you could utilize a trace which if hits, applies force towards the brush equal to the gravitational force*player mass, faking gravity. It might work, might not :/
How do i make people cant aim with the context menu :p tried ContextMenuOpen and it wont work for a weird reason
Why doesn't SetKeyValue work on an Entities CreationID? Printing out the result returns the correct entity however the KeyValue is not applied. Maybe I'm overthinking this slightly.
[QUOTE=Aeternal;51726683]Why doesn't SetKeyValue work on an Entities CreationID? Printing out the result returns the correct entity however the KeyValue is not applied. Maybe I'm overthinking this slightly.[/QUOTE] Why are you trying to change an entities CreationID?
[QUOTE=bigdogmat;51726740]Why are you trying to change an entities CreationID?[/QUOTE] Sorry, that's not what I meant. I'm trying to change the KeyValue (namely speed) of an entity using its creationID. However, its value does not change.
[QUOTE=Aeternal;51726751]Sorry, that's not what I meant. I'm trying to change the KeyValue (namely speed) of an entity using its creationID. However, its value does not change.[/QUOTE] Make sure the entity you're attempting to do it on is valid and of the correct type for this keyvalue. If it doesn't work then you may have to fire an input to change it depending on the entity type.
Sorry, you need to Log In to post a reply to this thread.