• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
How can I convert the local position of a parented panel into a global position?
[QUOTE=_FR_Starfox64;47430801]How can I convert the local position of a parented panel into a global position?[/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/LocalToScreen]Panel:LocalToScreen[/url]
Is there any reason why the following snippet renders a black square? [lua] lua_run_cl hook.Add("HUDPaint","Test",function()surface.SetDrawColor(255,255,255,255)surface.SetMaterial(Material("models/humans/female/group01/citizen_sheet"))surface.DrawTexturedRect(0,0,1024,1024)end) [/lua] [b]Uncollapsed:[/b] [lua] local mat = Material("models/humans/female/group01/citizen_sheet"); hook.Add("HUDPaint", "Test", function() surface.SetDrawColor(255,255,255,255); surface.SetMaterial(mat); surface.DrawTexturedRect(0,0,1024,1024); end); [/lua] I tried it with player_sheet as well and its the same result.
Rendering model shaders not on model will cause this. ( Basically )
Is there any way to fix it? I'm trying to add badges the the citizen sheet for customization things.
You can find a workaround in DImage/DImageButton's source code, which basically involves creating a new material on the fly with proper shader and using that instead.
Yep just tried Material(path, "unlitgeneric") and that and it works. However, I'm creating another material with a shader of "VertexlitGeneric" using a rendertarget as the basetexture, and I cant use that material in render.MaterialOverrideByIndex (PrePlayerDraw hook), the player just turns white. [editline]31st March 2015[/editline] I can confirm that the rendertarget is what it should be, just the material is being annoying.
Why wont this work :( [code] function WorkshopDownload(curMap) maps = { "253297309 ttt_airbus_b3", "141103402 ttt_bb_teenroom_b2 ttt_bb_teenroom_b2", "253304826 ttt_camel_v1", "253292930 ttt_cluedo_b5_improved1", "131667838 ttt_community_bowling", "145316417 ttt_fastfood_a6", "147635981 ttt_forest_final", "135894827 ttt_foundation_a1", "183797802 TTT_island_2013", "253328325 ttt_rooftops_a2_f1", "253328815 ttt_skyscraper", "186014186 ttt_subway_b4", "157420728 ttt_waterworld", "140410125 TTT_67thway_v7", "397859505 ttt_canyon_a4", "106527577 TTT_Lost_Temple", "121935805 TTT_Vessel", "104518391 ttt_amsterville" } for k,v in pairs(maps) do map = string.Explode(" ", v) if(map[2]==curMap) then resource.AddWorkshop(map[1]) end end WorkshopDownload(game.GetMap()) [/code] Its in init.lua and its meant to download the current map from the workshop when loading in
[QUOTE=Batzz;47431257]Why wont this work :( [code] function WorkshopDownload(curMap) maps = { "253297309 ttt_airbus_b3", "141103402 ttt_bb_teenroom_b2 ttt_bb_teenroom_b2", "253304826 ttt_camel_v1", "253292930 ttt_cluedo_b5_improved1", "131667838 ttt_community_bowling", "145316417 ttt_fastfood_a6", "147635981 ttt_forest_final", "135894827 ttt_foundation_a1", "183797802 TTT_island_2013", "253328325 ttt_rooftops_a2_f1", "253328815 ttt_skyscraper", "186014186 ttt_subway_b4", "157420728 ttt_waterworld", "140410125 TTT_67thway_v7", "397859505 ttt_canyon_a4", "106527577 TTT_Lost_Temple", "121935805 TTT_Vessel", "104518391 ttt_amsterville" } for k,v in pairs(maps) do map = string.Explode(" ", v) if(map[2]==curMap) then resource.AddWorkshop(map[1]) end end WorkshopDownload(game.GetMap()) [/code] Its in init.lua and its meant to download the current map from the workshop when loading in[/QUOTE] You don't need a system like this anyway. The current map is automatically added to the workshop download list *if* the map is gotten from a workshop file. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/resource/AddWorkshop]resource.AddWorkshop[/url]
Yeah but I want it to download that specific map rather than all of them so its just faster, or does it just download that specific map anyway
[QUOTE=Batzz;47431313]Yeah but I want it to download that specific map rather than all of them so its just faster, or does it just download that specific map anyway[/QUOTE] It'll automatically only download the map you're on [i]if[/i] the map you're on is from a workshop addon.
He means, if the server downloaded the map from the workshop and the server is currently on that map, the client will download it.
[QUOTE=Lixquid;47431339]It'll automatically only download the map you're on [i]if[/i] the map you're on is from a workshop addon.[/QUOTE] Wait sorry im confused, if I use resource.AddWorkshop() with all the maps i have (which are all off of the workshop) it will make the user download it from the workshop? Because my friend cant join my server due to the size of the map ( I want to avoid changing net_maxfilesize due to bandwidth )
[QUOTE=Batzz;47431361]Wait sorry im confused, if I use resource.AddWorkshop() with all the maps i have (which are all off of the workshop) it will make the user download it from the workshop? Because my friend cant join my server due to the size of the map ( I want to avoid changing net_maxfilesize due to bandwidth )[/QUOTE] Read my post above.. Also, you made me miss my 1337 posts and I'm very upset...
[QUOTE=G4MB!T;47431367]Read my post above.. Also, you made me miss my 1337 posts and I'm very upset...[/QUOTE] Sorry lol , but anyaways like I said my friend couldnt join the server even though it is off of a workshop collection.
[QUOTE=Batzz;47431361]Wait sorry im confused, if I use resource.AddWorkshop() with all the maps i have (which are all off of the workshop) it will make the user download it from the workshop? Because my friend cant join my server due to the size of the map ( I want to avoid changing net_maxfilesize due to bandwidth )[/QUOTE] Short Version: Don't use resource.AddWorkshop on any map files. The client will automatically download any workshop map file the server's using. (And only the map the server's on right now)
I'm not sure if subscribing to a collection of maps is the same as subscribing to the map itself, you will have to ask someone else about that. I was just trying to clarify what Lixquid said about it.
Hi, I would like to use the [URL="http://www.thecodingbeast.com/products"]Conding Beast's MOTD[/URL] as a help menu for a darkrp server. Is it possible to open it when the players press the F4 key? Maybe this could help you: [CODE] -- Player Spawn local function OpenMotdOnJoin( ply ) if OpenOnJoin == true then umsg.Start( "TcbMotd", ply ) umsg.End() end end hook.Add( "PlayerInitialSpawn", "OpenMotdOnJoin", OpenMotdOnJoin ) -- Console Command local function OpenMotdOnConsoleCommand( ply ) umsg.Start( "TcbMotd", ply ) umsg.End() end concommand.Add( "TcbMotd", OpenMotdOnConsoleCommand ) -- Chat Command local function OpenMotdOnCommand( ply, command, team ) for k,v in pairs(OpenCommands) do if command == v then OpenMotdOnConsoleCommand( ply ) end end end hook.Add( "PlayerSay", "OpenMotdOnCommand", OpenMotdOnCommand ) [/CODE]
[QUOTE=RocknRolla513;47432176]Hi, I would like to use the [URL="http://www.thecodingbeast.com/products"]Conding Beast's MOTD[/URL] as a help menu for a darkrp server. Is it possible to open it when the players press the F4 key? Maybe this could help you: [CODE] code [/CODE][/QUOTE] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ShowSpare2]GM/ShowSpare2[/url] [lua] function GM:ShowSpare2(ply) umsg.Start( "TcbMotd", ply ); umsg.End(); end [/lua]
[QUOTE=G4MB!T;47432363][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ShowSpare2]GM/ShowSpare2[/url] [lua] function GM:ShowSpare2(ply) umsg.Start( "TcbMotd", ply ); umsg.End(); end [/lua][/QUOTE] Thanks a lot G4MB!T Great people here, you really helped me!
I'm trying to make a headshot perk that creates an explosion on their head but for some reason it doesn't run any help would be appreciated [LUA]hook.Add("PlayerDeath", "Explode", function( victim, killer) if victim.lastHitGroup && victim.lastHitGroup == HITGROUP_HEAD then local explode = ents.Create("env_explosion") explode:Spawn() explode:SetPos(victim:EyePos()) explode:SetOwner(ply) explode:SetKeyValue("iMagnitude", 0) explode:Fire("Explode", 1, 0) end end)[/LUA]
Another question, I was looking to modify the [URL="https://scriptfodder.com/scripts/view/669"]purge addon[/URL], to make the players invincible when the purge is not active. Here are the two function from the sv_purge.lua: (if you need the client one, ask me) [CODE] function Purge:Start() timer.Stop("purgeDelay") if !Purge.Enabled then return end timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function() MsgN("The Purge has begun!") timer.Start("purgeLastsFor") net.Start("PurgeStart") net.Broadcast() local playertable = player.GetAll() if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end for k,v in pairs(playertable) do if !v:IsAdmin() then for i,w in pairs(Purge.StrippedWeapons) do v:StripWeapon(w) end end end Purge.Active = true end) end [/CODE] [CODE] function Purge:End() timer.Stop("purgeLastsFor") if !Purge.Enabled then return end timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function() MsgN("End of the purge!") timer.Start("purgeDelay") net.Start("PurgeEnd") net.Broadcast() Purge.Active = false local playertable = player.GetAll() if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end for k,v in pairs(playertable) do if !v:IsAdmin() then for i,w in pairs(Purge.StrippedWeapons) do for j,ww in pairs(RPExtraTeams[v:Team()].weapons) do if w == ww then v:Give(w) break end end for j,ww in pairs(Purge.NoJobWeapons) do if w == ww then v:Give(w) break end end end end end end) end [/CODE] Is that possible?
People who have downloaded my weapons report seeing muzzle flashes every time they go to reload. What is the most likely problem here? I don't even know what code to link.
[QUOTE=RocknRolla513;47432794]Another question, I was looking to modify the [URL="https://scriptfodder.com/scripts/view/669"]purge addon[/URL], to make the players invincible when the purge is not active. Here are the two function from the sv_purge.lua: (if you need the client one, ask me) [CODE] code [/CODE] Is that possible?[/QUOTE] I'm not familiar with this addon and honestly the code looks horrible. I have so many questions about it. Anyways, this should do what you want. [lua] function Purge:Start() timer.Stop("purgeDelay") if !Purge.Enabled then return end timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function() MsgN("The Purge has begun!") timer.Start("purgeLastsFor") net.Start("PurgeStart") net.Broadcast() local playertable = player.GetAll() if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end for k,v in pairs(playertable) do if !v:IsAdmin() then for i,w in pairs(Purge.StrippedWeapons) do v:StripWeapon(w) end end v:GodEnable(true); end Purge.Active = true end) end function Purge:End() timer.Stop("purgeLastsFor") if !Purge.Enabled then return end timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function() MsgN("End of the purge!") timer.Start("purgeDelay") net.Start("PurgeEnd") net.Broadcast() Purge.Active = false local playertable = player.GetAll() if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end for k,v in pairs(playertable) do if !v:IsAdmin() then for i,w in pairs(Purge.StrippedWeapons) do for j,ww in pairs(RPExtraTeams[v:Team()].weapons) do if w == ww then v:Give(w) break end end for j,ww in pairs(Purge.NoJobWeapons) do if w == ww then v:Give(w) break end end end end v:GodEnable(false); end end) end [/lua]
Thanks a lot for your help but it didn't work :/ i keep taking damages...
[QUOTE=RocknRolla513;47432969]Thanks a lot for you help but it didn't work :/ i keep taking damages...[/QUOTE] -snip lol jokes -
I edited the code so retry it now. The old code had it so that admins werent granted god-mode which is fixed. [editline]31st March 2015[/editline] Shoo anon >:(
DarkRP right? Did you heard of sbox_playershurtplayers . With that convar you can activate Player Damage to other Players. It isn't an full Godmode tho. Dunno which State was what ( IIRC 1 was activating the dmg) [lua]function Purge:Start() timer.Stop("purgeDelay") if !Purge.Enabled then return end timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function() MsgN("The Purge has begun!") timer.Start("purgeLastsFor") net.Start("PurgeStart") net.Broadcast() RunConsoleCommand("sbox_playershurtplayers", "1") local playertable = player.GetAll() if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end for k,v in pairs(playertable) do if !v:IsAdmin() then for i,w in pairs(Purge.StrippedWeapons) do v:StripWeapon(w) end end end Purge.Active = true end) end function Purge:End() timer.Stop("purgeLastsFor") if !Purge.Enabled then return end timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function() MsgN("End of the purge!") timer.Start("purgeDelay") net.Start("PurgeEnd") net.Broadcast() Purge.Active = false RunConsoleCommand("sbox_playershurtplayers", "0") local playertable = player.GetAll() if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end for k,v in pairs(playertable) do if !v:IsAdmin() then for i,w in pairs(Purge.StrippedWeapons) do for j,ww in pairs(RPExtraTeams[v:Team()].weapons) do if w == ww then v:Give(w) break end end for j,ww in pairs(Purge.NoJobWeapons) do if w == ww then v:Give(w) break end end end end end end) end [/lua] If you want an full Godmode, change it to sbox_godmode
can someone help me with this pls? [QUOTE=a-cookie;47420275]i can't seem to get SetLocalModelLights to work, killburn said it needs to be used in conjunction with SuppressEngineLighting, but the model just remains fullbright no matter what I do. [code]local lights = { } lights[ "light" ] = { MATERIAL_LIGHT_POINT, Color( 255, 0, 0 ), Vector( 16, 160, 72 ), Vector( 0, 0, 0 ), 0, 5, 45, 45, 1000, 10000, 0, 0, 1 } hook.Add( "PostDrawOpaqueRenderables", "kips", function( ) render.SuppressEngineLighting( true ) render.SetLocalModelLights( lights ) for k, v in pairs( models ) do v:DrawModel( ) end render.SuppressEngineLighting( false ) end ) [/code][/QUOTE]
Maybe use numeric indices for your lights table? You could also look at the paint function for DModelPanel since it has both directional and ambient lighting.
Sorry, you need to Log In to post a reply to this thread.