My hud is working fine for me, but I used a custom font, I used surface.CreateFont, and created my font, and used it on the hud, and it worked fine.
But for other people, it's just the default font.
I put my font in resource/fonts, and made them download it with resource.AddFile, and it doesn't work.
Here's a screenshot of what it looks like for me.
[url]http://cloud.steampowered.com/ugc/90...0866BE95008FA/[/url]
And heres a screenshot of what it looks like for other people
[url]http://cloud.steampowered.com/ugc/93...6E97897643A3A/[/url]
My font is called Agency FB.
Here's my resource.AddFile, my FastDL is set up correctly.
resource.AddFile("resource/fonts/AGENCYR.TTF")
The font file name is called AGENCYR.TTF
Where I created the font:
surface.CreateFont ("Agency FB", 32,400, true, false, "afb")
Me drawing the font
draw.SimpleText("Flawless", "afb", ScrW() - 155, -3, Color(0,150,255,255))
Also, I already had this font installed.
Which is why it only works for me.
It's probably a download issue.
Your image links are broken.
Maybe you [i]did[/i] have your fastdl set up correctly, before something happened to it.
Add a new file of some other type, like a model, that neither you or the clients have, then see if that one downloads correctly for everyone.
[QUOTE=Bletotum;37511673]Your image links are broken.
Maybe you [i]did[/i] have your fastdl set up correctly, before something happened to it.
Add a new file of some other type, like a model, that neither you or the clients have, then see if that one downloads correctly for everyone.[/QUOTE]
It works, I can download a model.
Plus, considering I can download the silkicons that come with the hud, also.
Thought it would help if I told you that my resource.AddFile file, is in
gamemodes/deathrun/init.lua
[QUOTE=A Lost Sandwich;37511451]Forgive me for this question, but how do you find the bitcount of a integer when using the new networked library? (net.WriteInt(val, bits), net.ReadInt(bits))[/QUOTE]
An n-bit integer has the range -2^(n-1) -> 2^(n-1)-1 (unsigned is 0 -> 2^n-1) so it depends on the possible range of your number.
[QUOTE=ralle105;37512180]An n-bit integer has the range -2^(n-1) -> 2^(n-1)-1 (unsigned is 0 -> 2^n-1) so it depends on the possible range of your number.[/QUOTE]
Numbers in GMod are clamped to 32 bit integers anyway, right? ( I've never had a number go over 2,1 billion or so )
[QUOTE=James xX;37512310]Numbers in GMod are clamped to 32 bit integers anyway, right? ( I've never had a number go over 2,1 billion or so )[/QUOTE]
Bear in mind none of the networking is done in Lua, the numbers from Lua are then converted to numbers in C++, which are not limited to 32 bit at all. For networking purposes it would be more efficient to send a number between 0 and 255 as an 8 bit integer instead of 32 bit, so garry has given us the ability to do that with the bit argument to net.Read/WriteInt.
[QUOTE=Drakehawke;37512477]Bear in mind none of the networking is done in Lua, the numbers from Lua are then converted to numbers in C++, which are not limited to 32 bit at all. For networking purposes it would be more efficient to send a number between 0 and 255 as an 8 bit integer instead of 32 bit, so garry has given us the ability to do that with the bit argument to net.Read/WriteInt.[/QUOTE]
Yes but my point was, seeing as you declare the numbers in Lua, those numbers are restricted to 32 bits, and so regardless of where the networking is being done, you should never have a number bigger than 32 bits?
[QUOTE=James xX;37512537]Yes but my point was, seeing as you declare the numbers in Lua, those numbers are restricted to 32 bits, and so regardless of where the networking is being done, you should never have a number bigger than 32 bits?[/QUOTE]
Where did having a number bigger than 32 bits even come into it?
All numbers in lua are doubles.
[QUOTE=Drakehawke;37512608]Where did having a number bigger than 32 bits even come into it?[/QUOTE]
[QUOTE=ralle105;37512180]An n-bit integer has the range -2^(n-1) -> 2^(n-1)-1 (unsigned is 0 -> 2^n-1) so it depends on the possible range of your number.[/QUOTE]
[I]Explications[/I]
[QUOTE=Mythikk;37511586]My hud is working fine for me, but I used a custom font, I used surface.CreateFont, and created my font, and used it on the hud, and it worked fine.
But for other people, it's just the default font.
I put my font in resource/fonts, and made them download it with resource.AddFile, and it doesn't work.
Here's a screenshot of what it looks like for me.
[url]http://cloud.steampowered.com/ugc/90...0866BE95008FA/[/url]
And heres a screenshot of what it looks like for other people
[url]http://cloud.steampowered.com/ugc/93...6E97897643A3A/[/url]
My font is called Agency FB.
Here's my resource.AddFile, my FastDL is set up correctly.
resource.AddFile("resource/fonts/AGENCYR.TTF")
The font file name is called AGENCYR.TTF
Where I created the font:
surface.CreateFont ("Agency FB", 32,400, true, false, "afb")
Me drawing the font
draw.SimpleText("Flawless", "afb", ScrW() - 155, -3, Color(0,150,255,255))
Also, I already had this font installed.
Which is why it only works for me.
It's probably a download issue.[/QUOTE]
[QUOTE=Bletotum;37511577]I don't know (I had your problem), but you can use Write/ReadFloat for the same effect without having to find it, so that the number sends correctly. You can also store everything you want to send in a table for Write/ReadTable to shorten your code.[/QUOTE]
That is what I have been doing but I've been told that doing WriteInt is more efficient as long as I'm not using a decimal.
[QUOTE=A Lost Sandwich;37515109]That is what I have been doing but I've been told that doing WriteInt is more efficient as long as I'm not using a decimal.[/QUOTE]
And you're right :P. A float is 8 or 64 bytes while an int is generally 4.
I've probably overlooked my answer several times like an idiot. But I can't seem to find it myself.
Does anybody know of a Lua Editing addon for Gmod that allows you to edit code on the spot and run it without having to restart or do uploading to the server? I want to learn lua, but I'm a bit impatient when it comes to load times and waiting on uploads/downloads.
TL;DR, I'm looking for a Lua Editor that is similar to E2's layout. With Syntax Highlighting and being able to just update the file in-game and have it run.
Though most of my editing will be in single-player until it requires a server.
I plan to make a Gamemode in the future. And possibly evolve that into a stand alone Source game. Many ideas, but they're all a process. Next on the list is Lua. So here I am.
[QUOTE=Zeriga;37517593]I've probably overlooked my answer several times like an idiot. But I can't seem to find it myself.
Does anybody know of a Lua Editing addon for Gmod that allows you to edit code on the spot and run it without having to restart or do uploading to the server? I want to learn lua, but I'm a bit impatient when it comes to load times and waiting on uploads/downloads.
TL;DR, I'm looking for a Lua Editor that is similar to E2's layout. With Syntax Highlighting and being able to just update the file in-game and have it run. Though most of my editing will be in single-player until it requires a server.
I plan to make a Gamemode in the future. And possibly evolve that into a stand alone Source game. Many ideas, but they're all a process. Next on the list is Lua. So here I am.[/QUOTE]
Luapad?
if its single player, just run in window mode and use the command gamemode_reload to reload your gamemode. To reload entities use lua_reloadents
[QUOTE=A Lost Sandwich;37517627]Luapad?[/QUOTE]
Isn't that outdated? Googled it, only downloads I could find mentioned being outdated or something.
[editline]3rd September 2012[/editline]
[QUOTE=Deadman123;37517643]if its single player, just run in window mode and use the command gamemode_reload to reload your gamemode. To reload entities use lua_reloadents[/QUOTE]
Won't be just single player for long.
[QUOTE=Zeriga;37517653]Isn't that outdated? Googled it, only downloads I could find mentioned being outdated or something.
[editline]3rd September 2012[/editline]
Won't be just single player for long.[/QUOTE]
Finalize it in singleplayer and then move it to multiplayer, then.
hey i need help with the sound.add format for a vehicle in gmod13 and since gmod13 dont use normal soundscripts like gmod 12 it needs to be lua instead it seems im a newbie to this and would gladly like to get some help cause its not fun with soundless vehicles
i followed this example:
[CODE]sound.Add(
{
name = "enzo_engine_idle",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 95,
pitchend = 110,
sound = "vehicles/enzo/idle.wav"
} )[/CODE]
and i got a sound on idle reverse and a little on when driving but the sound dissappears
heres how i did it:
[CODE]// ******************************
// JEEP
sound.Add(
{
name = "B_engine_idle",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
sound = "vehicles/v8/B_idle_loop1.wav"
} )
sound.Add(
{
name = "B_engine_null",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
sound = "common/null.wav"
} )
sound.Add(
{
name = "B_engine_start",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
sound = "vehicles/v8/B_start_loop1.wav"
} )
sound.Add(
{
name = "B_engine_stop",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
sound = "vehicles/v8/B_stop1.wav"
} )
sound.Add(
{
name = "B_rev",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 98,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_reverse",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 100,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_firstgear",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 100,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_secondgear",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_thirdgear",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_fourthgear",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 105,
pitchend = 105,
sound = "vehicles/v8/B_cruise_loop3.wav"
} )
sound.Add(
{
name = "B_firstgear_noshift",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 105,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_secondgear_noshift",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 105,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_thirdgear_noshift",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 105,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_fourthgear_noshift",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 105,
pitchend = 105,
sound = "vehicles/v8/B_cruise_loop3.wav"
} )
sound.Add(
{
name = "B_downshift_to_2nd",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_downshift_to_1st",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 105,
sound = "vehicles/v8/B_firstgear_loop1.wav"
} )
sound.Add(
{
name = "B_throttleoff_slowspeed",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 105,
sound = "vehicles/v8/B_slowdown_fast_loop5.wav"
} )
sound.Add(
{
name = "B_throttleoff_fastspeed",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 105,
sound = "vehicles/v8/B_slowdown_fast_loop5.wav"
} )
sound.Add(
{
name = "B_skid_lowfriction",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 110,
sound = "vehicles/v8/skid_lowfriction.wav"
} )
sound.Add(
{
name = "B_skid_normalfriction",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 110,
sound = "vehicles/v8/skid_normalfriction.wav"
} )
sound.Add(
{
name = "B_skid_highfriction",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 110,
sound = "vehicles/v8/skid_highfriction.wav"
} )
sound.Add(
{
name = "B_impact_heavy",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 95,
pitchend = 110,
sound = "vehicles/v8/vehicle_impact_heavy1.wav"
"vehicles/v8/vehicle_impact_heavy2.wav"
"vehicles/v8/vehicle_impact_heavy3.wav"
"vehicles/v8/vehicle_impact_heavy4.wav"
} )
sound.Add(
{
name = "B_impact_medium",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 95,
pitchend = 110,
sound = "vehicles/v8/vehicle_impact_medium1.wav"
"vehicles/v8/vehicle_impact_medium2.wav"
"vehicles/v8/vehicle_impact_medium3.wav"
"vehicles/v8/vehicle_impact_medium4.wav"
} )
sound.Add(
{
name = "B_turbo_on",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 110,
sound = "vehicles/v8/B_turbo_on_loop1.wav"
} )
sound.Add(
{
name = "B_turbo_off",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 90,
pitchend = 110,
sound = "vehicles/v8/B_turbo_off.wav"
} )
sound.Add(
{
name = "B_start_in_water",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 100,
sound = "vehicles/jetski/jetski_no_gas_start.wav"
} )
sound.Add(
{
name = "B_stall_in_water",
channel = CHAN_STATIC,
volume = 1.0,
soundlevel = 80,
pitchstart = 100,
sound = "vehicles/jetski/jetski_off.wav"
} )[/CODE]
what am i doing wrong?
Does Docking only work on DFrame? It seems to do nothing on my own panel.
[QUOTE=AustinDangerPowers;37519593]hey i need help with the sound.add format for a vehicle in gmod13 and since gmod13 dont use normal soundscripts like gmod 12 it needs to be lua instead it seems im a newbie to this and would gladly like to get some help cause its not fun with soundless vehicles
i followed this example:
and i got a sound on idle reverse and a little on when driving but the sound dissappears
heres how i did it:
what am i doing wrong?[/QUOTE]
You need pitchend after every pitchstart
so if pitchstart = 100, then pitchend = 100
if pitchstart = 110, pitchend = 110
[QUOTE=Pig;37510443]Hi, I have a weapon that uses the world model of a default CSS gun but I want to change it's color to blue or silver or something when dropped and if possible when held by a player to distinguish it from it's regular counterpart, how do I do this?[/QUOTE]
Anyone :(?
How did i can change player hitbox? Like, i am making a prone addon. but i cannot pass trough little place. How did i can change that?
[QUOTE=Crap-Head;37510708]Having issues with vehicles causing my server to crash. Whenever i drive around 10mph+, and cut the break (hold down space, handbreak), the server crashs.
Luckly, thank to Python1320, i could upload my crash dump. Garry's is down.
[url]http://dumps.metastruct.uk.to/dumper.py?dump=gmod13dev_srcds_1482030_crash_2012_9_2T16_54_24C0.mdmp[/url]
Heres the dump. Is this something on my part, or is it an issue with GMod 13? Perhaps it would be an issue with the map. It doesn't happen on gm_construct. I've heard something long time ago, about something in the old maps causing this crash.
Hopefully somebody knows whats up, and can help me solve this annoying issue. The map is rp_evocity_v33x if anybody is wondering.[/QUOTE]
Nobody knows anything about this issue, and the crash dump? Would it be better to go to the GMod 13 BETA section instead?
I'm new to LUA, and modding in general, so here's a probably simple question:
How do i make a function call at a very small interval? Like say, every 1/20 of a second? Kinda like the intervals in Expression 2. Thanks in advance.
[QUOTE=littleboyred1;37527351]I'm new to LUA, and modding in general, so here's a probably simple question:
How do i make a function call at a very small interval? Like say, every 1/20 of a second? Kinda like the intervals in Expression 2. Thanks in advance.[/QUOTE]
[b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9643.html]Timer.Create [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Ok Tiramisu 2
von.lua at 537
Code says : _d_meta = {
__call = function(self, str)
return _d_table(,str, nil, #str, true)
end
}
Ingame when I put on clothes a error pops up and the character goes invisble.
-fixed-
Thanks, NonSense, but i've got another problem now.
I'm trying to make a simple SWEP. Just to get used to LUA, but when i start up a singleplayer game in Gmod with this code in C:\Program Files\Steam\steamapps\littleboyred1\garrysmod\garrysmod\lua\weapons\myMod , i get an error. The error is: " [lua\weapons\littlemod\shared.lua:29] '<eof>' expected near 'end' " I can't seem to figure out what the problem is. Here's the code:
[CODE]
if (SERVER) then
AddCSLuaFile( "shared.lua" )
SWEP.HoldType = "ar2"
end
if (CLIENT) then
SWEP.PrintName = "Laser Assault Rifle"
SWEP.Author = "Littleboyred1"
SWEP.Slot = 3
SWEP.SlotPos = 1
SWEP.IconLetter = "w"
killicon.AddFont( "weapon_ak47", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
end
SWEP.DrawCrosshair = true
SWEP.DrawAmmo = true
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP:Initialize()
timer.Create(Interval, 0.05, 0, coneControl)
end
function getSpeed()
return self:Owner():GetVelocity():Distance(Vector(0,0,0))
end
function coneControl()
cone = getSpeed*0.05
end
SWEP:PrimaryAttack()
if(!self:CanPrimaryAttack())then return end
SWEP:ShootBullet(60, 1, cone)
setNextPrimaryFire(CurTime()+0.2)
end
[/CODE]
Please help.
You need to put function in front of SWEP:Initialize() and SWEP:PrimaryAttack().
function SWEP:Initialize()
function SWEP:PrimaryAttack()
Sorry, you need to Log In to post a reply to this thread.