Skip to content

Commit

Permalink
Dont use umsg anymore, use OnScreenSizeChanged hook (#3107)
Browse files Browse the repository at this point in the history
  • Loading branch information
wrefgtzweve authored Jul 26, 2024
1 parent bf12c22 commit 4038ae0
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions lua/entities/gmod_wire_egp/lib/egplib/usefulfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,19 @@ end


-- Saving Screen width and height
if (CLIENT) then
usermessage.Hook("EGP_ScrWH_Request",function(um)
RunConsoleCommand("EGP_ScrWH",ScrW(),ScrH())
end)
if CLIENT then
hook.Add( "InitPostEntity", "EGP_ScrWH_Init", function()
RunConsoleCommand("EGP_ScrWH", ScrW(), ScrH())
end )

hook.Add( "OnScreenSizeChanged", "EGP_ScrWH_Update", function( _, _, newW, newH )
RunConsoleCommand("EGP_ScrWH", newW, newH)
end )
else
hook.Add("PlayerInitialSpawn","EGP_ScrHW_Request",function(ply)
timer.Simple(1,function()
if (ply and ply:IsValid() and ply:IsPlayer()) then
umsg.Start("EGP_ScrWH_Request",ply) umsg.End()
end
end)
end)

EGP.ScrHW = WireLib.RegisterPlayerTable()

concommand.Add("EGP_ScrWH",function(ply,cmd,args)
if (args and tonumber(args[1]) and tonumber(args[2])) then
concommand.Add("EGP_ScrWH", function(ply, cmd, args)
if args and tonumber(args[1]) and tonumber(args[2]) then
EGP.ScrHW[ply] = { tonumber(args[1]), tonumber(args[2]) }
end
end)
Expand Down

0 comments on commit 4038ae0

Please sign in to comment.