Has anyone been crashing when trying to enable phong in lua created materials?
Matproxies, the example on the wiki is weird and hard to understand. How did Garry do that one where he added a proxy for the entire server world materials?
[url]http://glua.me/bin/?path=/lua/matproxy[/url]
You might find some better examples there
[QUOTE=Drakehawke;38262147]Dermas mostly done in Lua, read through the source if you really want to understand it:
[url]http://glua.me/bin/?path=/lua/derma[/url]
[url]http://glua.me/bin/?path=/lua/skins[/url]
[url]http://glua.me/bin/?path=/lua/vgui[/url][/QUOTE]
thanks :D ill look into it :)
[QUOTE=G4MB!T;38257388]wtf are you doing? seriously.
PreDrawHalos doesnt have any args[/QUOTE]
so your saying its impossible (or really really hard) just to draw green halos for team 1 and red halos for team 2?
...
[SUP]ok and how do i see how much players are on team? i dont want the id/name of them, i want the amount.[/SUP]
omfg... i want to punch you so bad.
[lua]
-- Shared
TEAM_ONE = 1;
TEAM_TWO = 2;
TEAM_THREE = 3;
TEAM_FOUR = 4;
team.SetUp(TEAM_ONE, "Team One", color_white);
team.SetUp(TEAM_TWO, "Team Two", Color(255, 0, 0, 255));
team.SetUp(TEAM_THREE, "Team Three", Color(0, 255, 0, 255));
team.SetUp(TEAM_FOUR, "Team Four", Color(0, 0, 255, 255))
-- Client
local Halos = {}
hook.Add("PreDrawHalos", "pgrp_PreDrawHalos", function()
if ( !Halos || #Halos == 0 ) then return end
local size = math.random( 1, 2 );
for i = 1, 4 do
effects.halo.Add( team.GetPlayers(i), team.GetColor(i), size, size, 1, true, false );
end
Halos = {};
end)
[/lua]
[QUOTE=lua_error;38261720]Please help to fix inventory
[url]http://codepad.org/YUuGERce[/url][/QUOTE]
[QUOTE=Cushie;38261856]Sorry but if you cant be bothered to even try and give some basic information about your code and what is wrong with it then how can you expect someone to bother trying to help you fix it?[/QUOTE]
This part of code derp inventory for gmod 12, after gmod 13 update module glon has been removed.
Now im trying to make it workable for gmod 13.
[lua]
[ERROR] ...terrortown/entities/weapons/weapon_ttt_turret/shared.lua:211: bad argument #1 to 'SetAngles' (Angle expected, got userdata)
1. SetAngles - [C]:-1
2. HealthDrop - ...terrortown/entities/weapons/weapon_ttt_turret/shared.lua:211
3. unknown - ...terrortown/entities/weapons/weapon_ttt_turret/shared.lua:127[/lua]
This is the code for the SWEP
[lua]
if SERVER then
AddCSLuaFile( "shared.lua" )
resource.AddFile( "materials/VGUI/ttt/icon_ldttttturret.vtf" )
resource.AddFile( "materials/VGUI/ttt/icon_ldttttturret.vmt" )
end
SWEP.HoldType = "normal"
if CLIENT then
SWEP.PrintName = "Turret"
SWEP.Slot = 6
SWEP.ViewModelFOV = 10
SWEP.EquipMenuData = {
type = "item_weapon",
desc = [[
Automatic Turret that only attacks
Innocents.
Not very stable.]]
};
SWEP.Icon = "VGUI/ttt/icon_ldttttturret"
end
SWEP.Base = "weapon_tttbase"
SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
SWEP.WorldModel = "models/props/cs_office/microwave.mdl"
SWEP.DrawCrosshair = false
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Primary.Delay = 1.0
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.Delay = 1.0
-- This is special equipment
SWEP.Kind = WEAPON_EQUIP
SWEP.CanBuy = { ROLE_TRAITOR }
SWEP.LimitedStock = true -- only buyable once
SWEP.AllowDrop = false
SWEP.NoSights = true
function SWEP:OnDrop()
self:Remove()
end
function SWEP:PrimaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:HealthDrop()
end
function SWEP:SecondaryAttack() return end
local throwsound = Sound( "Weapon_SLAM.SatchelThrow" )
-- ye olde droppe code
function SWEP:HealthDrop()
if SERVER then
local ply = self.Owner
if not IsValid(ply) then return end
if self.Planted then return end
local vsrc = ply:GetShootPos()
local vang = ply:GetAimVector()
local vvel = ply:GetVelocity()
local turret = ents.Create("npc_turret_floor")
local vec = Vector( ply:GetAngles():Forward().x, ply:GetAngles():Forward().y, 0 )
local pos = ply:GetPos() + vec*40
local ang = Angle( 0, ply:GetAngles().y, 0 )
turret:SetPos(pos)
turret:SetOwner(ply)
turret:SetMaterial( "Models/props_combine/tprotato1_sheet" )
turret:SetColor( 255, 0, 0, 255 )
turret:Spawn()
turret:SetDamageOwner(ply)
for _, v in pairs(player.GetAll()) do
if v:IsActiveTraitor() or !v:Alive() or v:IsSpec() then
turret:AddEntityRelationship(v, D_LI, 99 )
constraint.NoCollide( turret, v, 0, 0 )
end
end
for _, v in pairs(ents.GetAll()) do
if !v:IsPlayer() and !v:IsWorld() then
constraint.NoCollide( turret, v, 0, 0 )
end
end
local vectur = Vector(0, ply:GetAngles().y, 0)
turret:SetAngles(vectur)
turret:PhysWake()
turret:SetHealth(400)
local phys = turret:GetPhysicsObject()
self:Remove()
self.Planted = true
end
self.Weapon:EmitSound(throwsound)
end
function SWEP:Reload()
return false
end
function SWEP:OnRemove()
if CLIENT and IsValid(self.Owner) and self.Owner == LocalPlayer() and self.Owner:Alive() then
RunConsoleCommand("lastinv")
end
end
function SWEP:Initialize()
if CLIENT then
self:AddHUDHelp(
"MOUSE1 places the turret.",
false,
false
)
end
end
function SWEP:Deploy()
if SERVER and IsValid(self.Owner) then
self.Owner:DrawViewModel(false)
end
return true
end
function SWEP:DrawWorldModel()
end
function SWEP:DrawWorldModelTranslucent()
end
[/lua]
[lua] local vectur = Vector(0, ply:GetAngles().y, 0)
turret:SetAngles(vectur)
[/lua]
Also just wondering.. can someone write me a quick script that stores steam ID's of people that run test_workshop? I already remove the command, now I want to ban anyone that attempts to abuse it.
[QUOTE=Drakehawke;38262303][url]http://glua.me/bin/?path=/lua/matproxy[/url]
You might find some better examples there[/QUOTE]
the examples are the same as the ones on the wiki, I can't find anything on simple matproxies like changing adding to one specific material, say
[QUOTE=G4MB!T;38262571]omfg... i want to punch you so bad.[/QUOTE]
Don't encourage him, even if it is with code that doesn't work.
[QUOTE=Revenge282;38261058]When using an HTML panel in-game. The user can click on links, text boxes, etc., and input text. But, when trying to open a dropdown menu, it fails to show the dropdown list. Is there anyway to work around that?[/QUOTE]
I noticed this too, it's very annoying as my donation page relies on it :/
Are the silkicons still in Gmod 13?
If I do:
[lua]texture = surface.GetTextureID "gui/silkicons/heart",[/lua]
It just gives me a purple and black texture.
[QUOTE=Staneh;38264729]Are the silkicons still in Gmod 13?
If I do:
[lua]texture = surface.GetTextureID "gui/silkicons/heart",[/lua]
It just gives me a purple and black texture.[/QUOTE]
You have to use
[lua]local mat = Material( "icon16/heart.png" )
...
surface.SetMaterial( mat ) -- NOT surface.SetTexture
[/lua]
[editline]31st October 2012[/editline]
Also the entire silkicons collection is in there now, not just the ones garry used
Thank you!
Ah damn, seems like i'm always having problems with resource.AddFile..
My gamemode files that I want to add to the clientside downloadlist are in
gamemodename/content/materials/folder/
and my gamemode's init.lua has
[lua]
resource.AddFile("materials/folder/texture.vtf")
[/lua]
I've tried everything, but it's just not downloading anything when i join. And yes, i have checked my materials folder, it didn't even create the folder.
[QUOTE=ollie;38265142]Ah damn, seems like i'm always having problems with resource.AddFile..
My gamemode files that I want to add to the clientside downloadlist are in
gamemodename/content/materials/folder/
and my gamemode's init.lua has
[lua]
resource.AddFile("materials/folder/texture.vtf")
[/lua]
I've tried everything, but it's just not downloading anything when i join. And yes, i have checked my materials folder, it didn't even create the folder.[/QUOTE]
They download to downloads/materials now.
Is sv_downloadurl set to ""/is your stuff on the FastDL server?
[editline]31st October 2012[/editline]
Try adding the .vmt instead, the old Wiki says adding the vmt includes the vtf, but doesn't mention the other way around
Last time I posted a huge ammount of shit so i'll trim it down, I did some messing and now I get this error instead.
[lua]
gamemodes/tacoscript/gamemode/player_server.lua:505: attempt to index local 'ply' (a nil value)
[/lua]
[lua]
local function DoCharacterCreate( ply )
if( ply:GetNumberOfSaves() < TS.ConfigData["MaxCharacters"] ) then <- 505
ply.StatPointsRemaining = 15;
ply:SetNWFloat( "StatPointsRemaining", 15 );
ply:DoUmsg( "CCM" );
end
local savelist = ply:ListOtherSaves( ply:TSNick() );
umsg.Start( "CCCM", ply );
umsg.Short( math.Clamp( #savelist, 0, TS.ConfigData["MaxCharacters"] ) );
for n = 1, math.Clamp( #savelist, 0, TS.ConfigData["MaxCharacters"] ) do
umsg.String( savelist[n] );
end
umsg.End();
ply:SetNoDraw( true );
ply:SetNotSolid( true );
end
[/lua]
Ply is only nil inside that local function.
[url]http://pastebin.com/20ARfnRz[/url] The whole file
[QUOTE=Drakehawke;38265161]They download to downloads/materials now.
Is sv_downloadurl set to ""/is your stuff on the FastDL server?
[editline]31st October 2012[/editline]
Try adding the .vmt instead, the old Wiki says adding the vmt includes the vtf, but doesn't mention the other way around[/QUOTE]
Oh thanks it is working now, but why the hell did garry change it to /downloads/? That is just retarded in my opinion..
[QUOTE=ollie;38265269]Oh thanks it is working now, but why the hell did garry change it to /downloads/? That is just retarded in my opinion..[/QUOTE]
So you don't have to clean your entire GMod folder whenever you join a server with hundreds of downloads
[QUOTE=ollie;38265269]Oh thanks it is working now, but why the hell did garry change it to /downloads/? That is just retarded in my opinion..[/QUOTE]
being able to find and clear downloaded content [i]very[/i] easily is very retarded
Hmm.. Didn't think of that, i never clear my download or anything like that.
Might be better for some users then.
e: it was a linux issue and not actually my gamemode...
Can't seem to get sh_advert3 from evolve to work, complains about improperly called timers.
[CODE]timer.Create("Advert_"..adverts.Stored[info[1]], adverts.Stored[info[1]].Time, 0, function()
if (#player.GetAll() > 0) then
evolve:Notify(adverts.Stored[info[1]].Colour, adverts.Stored[info[1]].Msg)
end
end)
[/CODE]
Full code is here: [url]https://gmod-13-evolve.googlecode.com/svn/trunk/lua/ev_plugins/sh_advert3.lua[/url]
It should be working AFAIK, any ideas?
What's the difference between DHTML and HTML classes in the GM13 changelog? [url]http://wiki.garrysmod.com/page/Porting/GM12[/url]
How can we draw HTML panels in 3D? Is there an equivalent to GetHTMLMaterial?
snip fixed
Panel:SetVisible() isn't working properly?
I'm calling this function everytime that player enters some command. Frame here is DFrame with some stuff in it.
[lua]local function ToggleMenu()
if FrameOpen == true then
gui.EnableScreenClicker(false)
Frame:SetVisible(false)
elseif FrameOpen == false then
gui.EnableScreenClicker(true)
Frame:SetVisible(true)
end[/lua]
My problem that this frame just won't dissapear (mouse dissapears though) when I enter that command in console the second time
try Frame:Show() and Frame:Hide()
[QUOTE=Azaz3l;38273464]Panel:SetVisible() isn't working properly?
I'm calling this function everytime that player enters some command. Frame here is DFrame with some stuff in it.
[lua]local function ToggleMenu()
if FrameOpen == true then
gui.EnableScreenClicker(false)
Frame:SetVisible(false)
elseif FrameOpen == false then
gui.EnableScreenClicker(true)
Frame:SetVisible(true)
end[/lua]
My problem that this frame just won't dissapear (mouse dissapears though) when I enter that command in console the second time[/QUOTE]
You are not changing FrameOpen variable?
Sorry, you need to Log In to post a reply to this thread.