[QUOTE=Leyserr;49523396]I don't know what I'm doing wrong, but I can't get the CheckPassword hook to return.
Just so that you're aware, I'm trying to disallow family shared members from connecting when the game lender is banned from the server.
[lua]
function PreventBannedFamily(userid64)
http.Fetch(apiurl, function(html)
local totable = util.JSONToTable(html)
local lenderid = util.SteamIDFrom64(totable.response.lender_steamid)
local readbans = file.Read("cfg/banned_user.cfg", "MOD")
if string.find(readbans, lenderid) then
print("works") -- gets called
return false, dcmsg -- this doesn't
end
end)
end
hook.Add("CheckPassword", "PreventBannedFamilyHook", PreventBannedFamily)
[/lua][/QUOTE]
You're returning false in the http.Fetch function, not the CheckPassword hook itself
Because http.fetch takes a few seconds, returning false ordinarily won't work. So, I'd suggest having a variable like "shouldReturn", making it true in the http.fetch function, then running a loop that will return false once shouldReturn is true.
[QUOTE=Leyserr;49523396]I don't know what I'm doing wrong, but I can't get the CheckPassword hook to return.
Just so that you're aware, I'm trying to disallow family shared members from connecting when the game lender is banned from the server.
[lua]
function PreventBannedFamily(userid64)
http.Fetch(apiurl, function(html)
local totable = util.JSONToTable(html)
local lenderid = util.SteamIDFrom64(totable.response.lender_steamid)
local readbans = file.Read("cfg/banned_user.cfg", "MOD")
if string.find(readbans, lenderid) then
print("works") -- gets called
return false, dcmsg -- this doesn't
end
end)
end
hook.Add("CheckPassword", "PreventBannedFamilyHook", PreventBannedFamily)
[/lua][/QUOTE]
You're not returning anything to the hook, you are only returning from the callback function that is called by http.Fetch. Try passing the return value of the callback to a variable, and then returning the variable inside the actual hook.
[editline]13th January 2016[/editline]
Damn it Maxim
This is causing HL2.exe to crash before it can throw any errors. I am using some of Matt's code from an old thread.
[CODE]hook.Add("HUDPaint","NegusModel",function()
hook.Remove("HUDPaint","NegusModel")
if _NegusModel then
_NegusModel:Remove()
_NegusModel = nil
end
_NegusModel = vgui.Create( "DModelPanel" )
local model = _NegusModel
model:SetPos(x,y-r*2)
model:SetSize( r*2,r*2 )
model:SetModel( LocalPlayer():GetModel() )
model:SetCamPos( Vector( 25, -15, 62 ) )
model:SetLookAt( Vector( 0, 0, 62 ) )
model.Entity:SetEyeTarget( Vector( 200, 200, 100 ) )
function model:Think()
if not LocalPlayer():Alive() then
model:SetSize( 0, 0 )
else
model:SetSize( r*2,r*2 )
end
model:SetModel( LocalPlayer():GetModel() )
end
model.LayoutEntity = function()
return false
end
function model:Init()
self:SetPaintedManually(true)
end
local flashmat = Material( "effects/flashlight001" )
function model:Paint(w,h)
render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilWriteMask( 1 )
render.SetStencilTestMask( 1 )
render.SetStencilFailOperation( STENCILOPERATION_REPLACE )
render.SetStencilPassOperation( STENCILOPERATION_ZERO )
render.SetStencilZFailOperation( STENCILOPERATION_ZERO )
render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_NEVER )
render.SetStencilReferenceValue( 1 )
draw.NoTexture( )
surface.SetMaterial( flashmat)
surface.SetDrawColor( Color(0,0,0) )
draw.Circle( x+r, ScrH() - x - r, r*0.9, 200 )
render.SetStencilFailOperation( STENCILOPERATION_ZERO )
render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
render.SetStencilZFailOperation( STENCILOPERATION_ZERO )
render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL )
render.SetStencilReferenceValue( 1 )
model:SetPaintedManually(false)
model:PaintManual()
model:SetPaintedManually(true)
render.SetStencilEnable(false)
render.ClearStencil()
end
end)[/CODE]
[QUOTE=Leyserr;49523396]-snip-
Oh I see, thanks guys.[/QUOTE]
Don't snip your post after you solve it. Leave it up so other people can look back and reference it...
[QUOTE=MPan1;49519661]:snip:[/QUOTE]
GetInflictor is crap
If you want the weapon, just do GetActiveWeapon instead.
So if i wanted to print a message, role specific on TTT, for the purchase of a traitor weapon, how would i pull that off?
I tried take a look at [url]https://wiki.garrysmod.com/page/Global/PrintMessage[/url] but i am still learning.
Anyone know why render.ReadPixel ALWAYS seems to return 3 0's for me? All I'm doing is running it in a concommand hook with any kind of x and y coordinates that are on screen, and it just doesn't work
[QUOTE=MPan1;49525005]Anyone know why render.ReadPixel ALWAYS seems to return 3 0's for me? All I'm doing is running it in a concommand hook with any kind of x and y coordinates that are on screen, and it just doesn't work[/QUOTE]
[url]http://wiki.garrysmod.com/page/render/CapturePixels[/url]
I have no idea why render.ReadPixel's page doesn't mention this
[QUOTE=Willox;49525054][url]http://wiki.garrysmod.com/page/render/CapturePixels[/url]
I have no idea why render.ReadPixel's page doesn't mention this[/QUOTE]
I just fixed that.
Is it possible to include game DLL headers in a GMod module? If so, what #include directory should I be looking in? Or, do I need to link the module to GMod's server DLL?
I'm setting of the hull of the player (with ent:SetHull) but when I do this the bounding box of the player will flicker really fast between the default bounding box and my custom set one. Any ideas why this may be? Thanks.
[editline]13th January 2016[/editline]
It seems to be caused because the bounding box isn't changing clientside, only serverside. I have no clue why this is the case because the code is shared.
With a SWEP's ViewModel/WorldModel/Sound should I use Model(model) and Sound(sound) or just the path string? Or this is just personal preference to do this? I've seen some people use these functions, while others don't and they don't precache it anywhere else in the file.
[QUOTE=PigeonTroll;49526992]With a SWEP's ViewModel/WorldModel/Sound should I use Model(model) and Sound(sound) or just the path string? Or this is just personal preference to do this? I've seen some people use these functions, while others don't and they don't precache it anywhere else in the file.[/QUOTE]
The precaching could be done automatically in the weapon base.
If I wanted to draw an "overlay" on a player's model, how would I do that?
Example, scale their model up by 1.1, set the material I want, draw the model again somehow?
[QUOTE=Z0mb1n3;49527587]If I wanted to draw an "overlay" on a player's model, how would I do that?
Example, scale their model up by 1.1, set the material I want, draw the model again somehow?[/QUOTE]
I'm probably a scrub but could you just override entity:draw()?
I don't think it's possible, you have to overwrite the WHOLE material :(
[QUOTE=MPan1;49527755]I don't think it's possible, you have to overwrite the WHOLE material :([/QUOTE]
I saw someone do it before, but I can't find the thread where it was
Could anyone give me a general idea of how to swap body parts for players? Like to give a combine body a civilian head? I remember seeing this a while back in some RP gamemodes. I'm assuming it would use ClientsideModels, but that's about all I can gather. I appreciate any help :)
Ignore that, I tried to get started, I googled about 500 times to find as much help as I could and I came up with this test code:
[lua]
local stringFinders = {"Hand", "Finger", "Head", "Neck"}
concommand.Add("Bonemerge",function()
local body = ClientsideModel(Models["Female"][2].Model)
body:SetPos(LocalPlayer():GetPos())
body:SetParent(LocalPlayer())
body:AddEffects(EF_BONEMERGE || EF_NOSHADOW)
for i = 1, LocalPlayer():GetBoneCount() do
local boneString = LocalPlayer():GetBoneName(i)
for k,v in pairs(stringFinders) do
if string.find(boneString, v) then
LocalPlayer():ManipulateBoneScale(i, Vector(.1,.1,.1))
else
body:ManipulateBoneScale(i, Vector(.1, .1, .1))
end
end
end
end)
[/lua]
Basically, if the bone has any of those words then we shrink the original player models head, hands, etc. Now, it shrinks, but it also shrinks the clientside model, I'm assuming it has something to do with EF_BONEMERGE. Anyone have an idea on how to fix this?
[img]http://images.akamai.steamusercontent.com/ugc/364030656451039566/E65B61A82BABEEB1D122902A7F2C0A639F18D3A4/[/img]
Is there any way to have one folder which will be synced to the addons/ folder of 2 servers?
It is completely the same addon but I make changes to it like every day and it is a pain in the ass to always change the addon for both servers.
how can i check if an player is 'inside' a prop?
[QUOTE=P4sca1;49530684]Is there any way to have one folder which will be synced to the addons/ folder of 2 servers?
It is completely the same addon but I make changes to it like every day and it is a pain in the ass to always change the addon for both servers.[/QUOTE]
Look into something called Symlinking.
[QUOTE=jrj996;49529074]
Basically, if the bone has any of those words then we shrink the original player models head, hands, etc. Now, it shrinks, but it also shrinks the clientside model, I'm assuming it has something to do with EF_BONEMERGE. Anyone have an idea on how to fix this?[/QUOTE]
Setparent and bonemerge [I]after[/I] you've already made the necessary adjustments to the player model. I'd go so far as to spawn the model after the changes were made rather than before
[QUOTE=solid_jake;49531694]Setparent and bonemerge [I]after[/I] you've already made the necessary adjustments to the player model. I'd go so far as to spawn the model after the changes were made rather than before[/QUOTE]
I just tried this, still the same result :/ I added you on steam, I'd really appreciate the help
Is it possible to create custom animations for the defualt player models?
I looked on the wiki and found this page "https://wiki.garrysmod.com/page/Player_Animations"
I noticed it mentions that it is currently impossible to add onto the existing animations.
I just want to make the player model do a custom animation when equipping a SWEP.
Could someone point me in the right direction?
How to unload texture from buffer? (Created by GetRenderTarget) Because I use 7 textures 512x512 on every player, and it cause lags, for example, if more than 30 players... Please, help!
Does anyone know how i could smoothly transition/move the vector/angle of a RenderView Cam to another vector/angle?
[QUOTE=101kl;49536240]Does anyone know how i could smoothly transition/move the vector/angle of a RenderView Cam to another vector/angle?[/QUOTE]
[url]http://wiki.garrysmod.com/page/Global/LerpVector[/url]
[url]http://wiki.garrysmod.com/page/Global/LerpAngle[/url]
[QUOTE=101kl;49536240]Does anyone know how i could smoothly transition/move the vector/angle of a RenderView Cam to another vector/angle?[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/LerpVector]Global.LerpVector[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/LerpAngle]Global.LerpAngle[/url] probably
[B]EDIT:[/B] Ninja'd
-snip- worked
Sorry, you need to Log In to post a reply to this thread.