Is the lua source of GM13 stored anywhere? I'd like to get the template DFrame off of which I could base my own frame. Thanks!
[QUOTE=Panto;36325876]Is the lua source of GM13 stored anywhere?[/QUOTE]
I hope this is irony.
It's saved in the GCF file located in steamapps folder.
[QUOTE=James xX;36325892]I hope this is irony.
It's saved in the GCF file located in steamapps folder.[/QUOTE]
It's ironic how you use the definition of irony. :v:
In all seriousness though, thanks.
[QUOTE=Panto;36326057]It's ironic how you use the definition of irony. :v:
In all seriousness though, thanks.[/QUOTE]
My definition of irony isn't ironic because the source code of a game [U]has[/U] to be stored somewhere.
and you're welcome. I think someone ( banana lord ) has a website ( glua.me ) containing the source code extracted from the GCF ( lua bin ) made by Overv.
[QUOTE=ralle105;36322253][lua]
local isBreakable = entity:Health() > 0
[/lua][/QUOTE]
Why didn't I think of that...
Thanks
[QUOTE=James xX;36326108]and you're welcome. I think someone ( banana lord ) has a website ( glua.me ) containing the source code extracted from the GCF ( lua bin ) made by Overv.[/QUOTE]
*see title to left/shameless advertising/yes it's me*
Setting model scale of models inside the DModelPanel in Gmod 13.
Anyone?
[editline]15th June 2012[/editline]
I got that part.. Now what about using the new ManipulateBoneScale on client entities in the DModelPanels? :S
ply:SetColor ain't working
init:
[lua]concommand.Add( "Ability2", function( ply )
if Points > 0 then
Points = Points - 1
if Race == 1 then
ply:SetColor( 255, 255, 255, 150 )
end
else
PrintMessage( HUD_PRINTTALK, "You are not able to do that!" )
end
end )[/lua]
[QUOTE=Fixed;36367154]ply:SetColor ain't working
init:
[lua]concommand.Add( "Ability2", function( ply )
if Points > 0 then
Points = Points - 1
if Race == 1 then
ply:SetColor( 255, 255, 255, 150 )
end
else
PrintMessage( HUD_PRINTTALK, "You are not able to do that!" )
end
end )[/lua][/QUOTE]
[lua]
ent:SetColor( Color( r, g , b , a ) )
[/lua]
[QUOTE=TheTrueAndy;36367209][lua]
ent:SetColor( Color( r, g , b , a ) )
[/lua][/QUOTE]
The wiki says you don't need to have the Color() in ent:SetColor()
[url]http://bananatree.im/wiki/wiki.garrysmod.com/index18fc.html?title=CLuaParticle.SetColor[/url]
[QUOTE=TheTrueAndy;36367209][lua]
ent:SetColor( Color( r, g , b , a ) )
[/lua][/QUOTE]
Thanks, but how do I apply it on the player?
[QUOTE=josh980;36367350]The wiki says you don't need to have the Color() in ent:SetColor()
[url]http://bananatree.im/wiki/wiki.garrysmod.com/index18fc.html?title=CLuaParticle.SetColor[/url][/QUOTE]
Garry changed that in the update.
Is there an easy-ish way to make it so players can shoot weapons while in a vehicle? Not like the attached gun in the jeep, but their actual weapons they have when walking around.
I'm sure this has been asked, but google search didn't immediately return anything useful.
You can probably call player:FireBullets(tableOfBulletStuff).
[QUOTE=FoohyAB;36372688]Is there an easy-ish way to make it so players can shoot weapons while in a vehicle? Not like the attached gun in the jeep, but their actual weapons they have when walking around.
I'm sure this has been asked, but google search didn't immediately return anything useful.[/QUOTE]
The hackiest way would be to parent the player to the seat manually so he isn't really in the vehicle for the engine and still can use his weapons, there's no other simple way to do it and make it compatible with c++ weapons.
You can use capsadmin's seat addon which exactly does that.
I don't think Caps released the last version though, so ask him directly for it.
[QUOTE=Jvs;36379612]The hackiest way would be to parent the player to the seat manually so he isn't really in the vehicle for the engine and still can use his weapons, there's no other simple way to do it and make it compatible with c++ weapons.
You can use capsadmin's seat addon which exactly does that.
I don't think Caps released the last version though, so ask him directly for it.[/QUOTE]
just remember to do ply:SetViewOffset(Vector(0,0,0)) and make sure the player can't move
changing the view offset to 0 0 0 makes it so when you rotate the parent prop, the player will rotate properly with it making him able to aim properly regardless of the angle of the prop
Sorry if this isn't the right place but I'm reading the PiL and I'm at the part about tables and I'm a little confused. What do they mean when they say index? I looked up the definition online but couldn't find anything that was relevant. Heres the full sentence: For Lua, this means "index the table io using the string "read" as the key."
[QUOTE=I Fail At Lua;36385038]Sorry if this isn't the right place but I'm reading the PiL and I'm at the part about tables and I'm a little confused. What do they mean when they say index? I looked up the definition online but couldn't find anything that was relevant. Heres the full sentence: For Lua, this means "index the table io using the string "read" as the key."[/QUOTE]
Indexes are what are used to identify values in tables, they are unique, i.e. you can't have two different elements with the same index, it's one or the other. In Lua indexes can be any type of data at all, a number (most efficient), a string, even a player or an entity.
To index as a verb means the process of using an index to find a value in a table. If you had a table called "io" and it contained a function, it would make sense to have the index of that function as it's name, to make it easy to access. So you would call io["read"]() or a cleaner way - io.read() .
They're also often referred to as "keys", (hence the common notation for k, v in pairs - key, value), because each one is unique and to access a value in the table you need it's associated unique key, just like you need the key to a lock to open it, and only one key will open that lock.
[lua]resource.AddFile("sound/ttt/tators.wav")
resource.AddFile("sound/ttt/roundstart.mp3")
resource.AddFile("sound/ttt/roundend.mp3")
CreateConVar( "roundmusic", 1, { FCVAR_SERVER_CAN_EXECUTE, FCVAR_CLIENTCMD_CAN_EXECUTE } )
local CValue = GetConVar( "roundmusic" ):GetInt()
if CValue = 1 then
local function PlayMusic(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua('surface.PlaySound("ttt/roundend.mp3")')
else
BroadcastLua('surface.PlaySound("ttt/tators.wav")')
end
end
hook.Add("TTTEndRound", "PlayMusic", PlayMusic)
local function PlayStartMusic()
BroadcastLua('surface.PlaySound("ttt/roundstart.mp3")')
end
hook.Add("TTTBeginRound", "PlayStartMusic", PlayStartMusic)
elseif CValue = 0 then
end
[/lua]
I am trying to make it that the client can turn off a convar to stop the music. I have it in the server CFG so it is set to one... But it says "Command invalid" when I test it. Help? (NOTE: The sounds are proven to work without the commad)
[QUOTE=Charrax;36386501]I am trying to make it that the client can turn off a convar to stop the music. I have it in the server CFG so it is set to one... But it says "Command invalid" when I test it. Help? (NOTE: The sounds are proven to work without the commad)[/QUOTE]
You need to use CreateClientConVar, not CreateConVar. Then use a for loop through all players, and use Player:GetInfoNum("convarname") to see if they have the convar enabled.
[lua]
if !CLIENT then return end
local music = CreateClientConVar("music", "1", true, false)
hook.Add("TTTBeginRound", "BeginMusic", function()
if music:GetInt() != 1 then return end
surface.PlaySound("ttt/roundstart.mp3")
end)
hook.Add("TTTEndRound", "PlayMusic", function( winner )
if music:GetInt() != 1 then return end
if winner == WIN_INNOCENT or winner == WIN_TIMELIMIT then
surface.PlaySound("ttt/roundend.mp3")
else
surface.PlaySound("ttt/tators.wav")
end
end)
[/lua]
All client sided. No need to make the server do the work. Sever still needs to make the client download the sounds.
[QUOTE=Aide;36391354][lua]
if !CLIENT then return end
local music = CreateClientConVar("music", "1", true, false)
hook.Add("TTTBeginRound", "BeginMusic", function()
if music:GetInt() != 1 then return end
surface.PlaySound("ttt/roundstart.mp3")
end)
hook.Add("TTTEndRound", "PlayMusic", function( winner )
if music:GetInt() != 1 then return end
if winner == WIN_INNOCENT or winner == WIN_TIMELIMIT then
surface.PlaySound("ttt/roundend.mp3")
else
surface.PlaySound("ttt/tators.wav")
end
end)
[/lua]
All client sided. No need to make the server do the work. Sever still needs to make the client download the sounds.[/QUOTE]
Haha thanks I kept trying and failing so hard with the ClientConVar
[QUOTE=elitefroggy;36300395]I've been making custom SWEPS (never coded anything before) and i cant seem to get the reload sounds working...
Also when the recoil affects the gun, the bullets still shoot in the same place :(
[lua]//General Settings \\
SWEP.CSMuzzleFlashes = true
SWEP.AdminSpawnable = true // Is the swep spawnable for admin
SWEP.ViewModelFOV = 64 // How much of the weapon do u see ?
SWEP.ViewModel = "models/weapons/v_rif_aa3.mdl" // The viewModel, the model you se when you are holding it-.-
SWEP.WorldModel = "models/weapons/w_rif_aa3.mdl" // The worlmodel, The model yu when it's down on the ground
SWEP.AutoSwitchTo = false // when someone walks over the swep, chould i automatectly change to your swep ?
SWEP.Slot = 3 // Deside wich slot you want your swep do be in 1 2 3 4 5 6
SWEP.HoldType = "smg" // How the swep is hold Pistol smg greanade melee
SWEP.PrintName = "AUG A3" // your sweps name
SWEP.Author = "Elitefroggy" // Your name
SWEP.Spawnable = true // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true.
SWEP.ViewModelFlip = true
SWEP.AutoSwitchFrom = false // Does the weapon get changed by other sweps if you pick them up ?
SWEP.FiresUnderwater = false // Does your swep fire under water ?
SWEP.Weight = 5 // Chose the weight of the Swep
SWEP.DrawCrosshair = false // Do you want it to have a crosshair ?
SWEP.Category = "Elitefroggy's SWEPS" // Make your own catogory for the swep
SWEP.SlotPos = 3 // Deside wich slot you want your swep do be in 1 2 3 4 5 6
SWEP.DrawAmmo = true // Does the ammo show up when you are using it ? True / False
SWEP.ReloadSound = "none" // Reload sound, you can use the default ones, or you can use your one; Example; "sound/myswepreload.waw"
SWEP.Instructions = "Left click to fire, 'r' to reload." // How do pepole use your swep ?
SWEP.Contact = "xbox.corman@gmail.com" // How Pepole chould contact you if they find bugs, errors, etc
SWEP.Purpose = "Kills Stuff" // What is the purpose with this swep ?
SWEP.base = "weapon_cs_base"
//General settings\\
//PrimaryFire Settings\\
SWEP.Primary.Recoil = 1.5
SWEP.Primary.BulletShot = true
SWEP.Primary.Sound = "none" // The sound that plays when you shoot :]
SWEP.Primary.Damage = 32 // How much damage the swep is doing
SWEP.Primary.TakeAmmo = 1 // How much ammo does it take for each shot ?
SWEP.Primary.ClipSize = 32 // The clipsize
SWEP.Primary.Ammo = "smg1" // ammmo type pistol/ smg1
SWEP.Primary.DefaultClip = 64 // How much ammo does the swep come with `?
SWEP.Primary.Spread = 0 // Does the bullets spread all over, if you want it fire exactly where you are aiming leave it o.1
SWEP.Primary.Cone = 0.15 //cone is the acuracy, the less the cone the more acurate and more cone means big spread
SWEP.MoveSpread = 1.5 //multiplier for spread when you are moving
SWEP.JumpSpread = 5 //multiplier for spread when you are jumping
SWEP.CrouchSpread = 0.5 //multiplier for spread when you are crouching
SWEP.Primary.NumShots = 1 // How many bullets you are firing each shot.
SWEP.Primary.Automatic = true // Is the swep automatic ?
SWEP.Primary.Recoil = 5 // How much we should punch the view
SWEP.Primary.Delay = 0.1 // How long time before you can fire again
SWEP.Primary.Force = 10 // The force of the shot
SWEP.Primary.Recoil = 1.5
//PrimaryFire settings\\
//Secondary Fire Variables\\
SWEP.IronSightsPos = Vector (2.7843, -3.0914, 0.0344)
SWEP.IronSightsAng = Vector (0, 0, 0)
SWEP.Secondary.Sound = "none" // The sound that plays when you shoot
SWEP.Secondary.Damage = 0 // How much damage the swep is doing
SWEP.Secondary.TakeAmmo = 0 // How much ammo does it take for each shot ?
SWEP.Secondary.ClipSize = -1 // The clipsize
SWEP.Secondary.Ammo = "none" // ammmo type pistol/ smg1
SWEP.Secondary.DefaultClip = -1 // How much ammo does the swep come with `?
SWEP.Secondary.Spread = 0 // Does the bullets spread all over, if you want it fire exactly where you are aiming leave it o.1
SWEP.Secondary.NumShots = 0 // How many bullets you are firing each shot.
SWEP.Secondary.Automatic = false // Is the swep automatic ?
SWEP.Secondary.Recoil = 0 // How much we should punch the view
SWEP.Secondary.Delay = 0 // How long time before you can fire again
SWEP.Secondary.Force = 0 // The force of the shot
//Secondary Fire Variables\\
local IRONSIGHT_TIME = 0.25
/*---------------------------------------------------------
Name: GetViewModelPosition
Desc: Allows you to re-position the view model
---------------------------------------------------------*/
function SWEP:GetViewModelPosition( pos, ang )
if ( !self.IronSightsPos ) then return pos, ang end
local bIron = self.Weapon:GetNetworkedBool( "Ironsights" )
if ( bIron != self.bLastIron ) then
self.bLastIron = bIron
self.fIronTime = CurTime()
if ( bIron ) then
self.SwayScale = 0.3
self.BobScale = 0.1
else
self.SwayScale = 1.0
self.BobScale = 1.0
end
end
local fIronTime = self.fIronTime or 0
if ( !bIron && fIronTime < CurTime() - IRONSIGHT_TIME ) then
return pos, ang
end
local Mul = 1.0
if ( fIronTime > CurTime() - IRONSIGHT_TIME ) then
Mul = math.Clamp( (CurTime() - fIronTime) / IRONSIGHT_TIME, 0, 1 )
if (!bIron) then Mul = 1 - Mul end
end
local Offset = self.IronSightsPos
if ( self.IronSightsAng ) then
ang = ang * 1
ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul )
ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul )
ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul )
end
local Right = ang:Right()
local Up = ang:Up()
local Forward = ang:Forward()
pos = pos + Offset.x * Right * Mul
pos = pos + Offset.y * Forward * Mul
pos = pos + Offset.z * Up * Mul
return pos, ang
end
/*---------------------------------------------------------
SetIronsights
---------------------------------------------------------*/
function SWEP:SetIronsights( b )
self.Weapon:SetNetworkedBool( "Ironsights", b )
end
SWEP.NextSecondaryAttack = 0
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
if ( !self.IronSightsPos ) then return end
if ( self.NextSecondaryAttack > CurTime() ) then return end
bIronsights = !self.Weapon:GetNetworkedBool( "Ironsights", false )
self:SetIronsights( bIronsights )
self.NextSecondaryAttack = CurTime() + 0.3
end
/*---------------------------------------------------------
DrawHUD
Just a rough mock u
[lua]
SWEP.ReloadSound = "none"
[/lua]
That's line 21.
What is the proper bitwise for getting the servers IP from hostip?
[code]
local hostip=GetConVarNumber("hostip")
local a=hostip&0x000000FF
local b=(hostip&0x0000FF00)>>8
local c=(hostip&0x00FF0000)>>16
local d=(hostip&0xFF000000)>>24
print(a.."."..b.."."..c.."."..d)
[/code]
doesn't seem to work for me.
[editline]19th June 2012[/editline]
While on the topic of hostip, is it possible to get the servers hostname in menu state?
The bitwise operators in gmod freak out with numbers larger than 0x7fffffff so you'll have to create your own functions to emulate them.
Oh yeah I remember that from hex colors.. That sucks.
[editline]19th June 2012[/editline]
Damn you integer limits
When creating buttons, I feel there must be an easier way then
[lua]
button1 = vgui.Create("DButton", frame)
button1:SetSize(90, 20)
button1:SetPos(5, 25)
button1.DoClick = function()
end
button2 = vgui.Create("DButton", frame)
button2:SetSize(90, 20)
button2:SetPos(5, 50)
button2.DoClick = function()
end
[/lua]
Over and over taking up space and I presume resources.
Is there an easier way to get the same result using less copy/pasta?
Any help is appreciated.
[QUOTE=NintendoEKS;36406007]When creating buttons, I feel there must be an easier way then
[lua]
button1 = vgui.Create("DButton", frame)
button1:SetSize(90, 20)
button1:SetPos(5, 25)
button1.DoClick = function()
end
button2 = vgui.Create("DButton", frame)
button2:SetSize(90, 20)
button2:SetPos(5, 50)
button2.DoClick = function()
end
[/lua]
Over and over taking up space and I presume resources.
Is there an easier way to get the same result using less copy/pasta?
Any help is appreciated.[/QUOTE]
Make a function, like so
[lua]
function EasyButton(x,y,w,h,parent)
local button = vgui.Create("DButton",parent)
button:SetSize(w,h)
button:SetPos(x,y)
return button
end
[/lua]
You would use it like
[lua]
local button = EasyButton(90,20,5,50,frame)
button.DoClick = function()
end
[/lua]
Does anybody know what happened to string.dump?
Sorry, you need to Log In to post a reply to this thread.