[QUOTE=markusmarkusz;51973113]This way works too:
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/terrortown/gamemode/player.lua#L277-L292[/url]
Very simple solution.[/QUOTE]
Thank you, this was helpful.
--snip--
Solved.
[CODE]
-- sh_policeinsignias.lua
local modelsStagiaire = {
"models/player/darkley/police_national_01.mdl",
"models/player/darkley/police_national_02.mdl"
}
function ChangeModelStagiaire (ply, before, after)
if after == TEAM_POLICE and ply:GetPData("PoliceInsignia", "None") == "None" then
if SERVER then
ply:ChatPrint("ok")
ply:SetModel( table.Random( modelsStagiaire ) )
end
end
end
hook.Add( "OnPlayerChangedTeam", "PlayerModelStagiaire", ChangeModelStagiaire)
[/CODE]
Hello,
Why doesn't my SetModel work ? The ChatPrint does. :\
It does not come from the table, I tried to change with a simple string.
Something else is probably setting the model afterward. Either use a different hook or put the SetModel call in a timer.
For some reason, players appear twice in the darkrp_player table. Does anyone know of a solution to this?
[IMG]https://puu.sh/uOnxc/06b5f05b64.png[/IMG]
[QUOTE=Lenkio;51974742]:snip:
Hello,
Why doesn't my SetModel work ? The ChatPrint does. :\
It does not come from the table, I tried to change with a simple string.[/QUOTE]
[DEL]You can't use this hook.
It's not a hook which is called with hook.Call.[/DEL]
Didn't realized that this is for DarkRP. :b
[QUOTE=SkitZz;51978010]For some reason, players appear twice in the darkrp_player table. Does anyone know of a solution to this?
[IMG]https://puu.sh/uOnxc/06b5f05b64.png[/IMG][/QUOTE]
Most likely, one of your addons still uses UniqueID and is for some reason accessing the table directly. You'd probably get better help in the DarkRP forums.
[QUOTE=NeatNit;51978071]Most likely, one of your addons still uses UniqueID and is for some reason accessing the table directly. You'd probably get better help in the DarkRP forums.[/QUOTE]
It's still stored in dark for backwards compatibility.
[QUOTE=andreblue;51978129]It's still stored in dark for backwards compatibility.[/QUOTE]
is it supposed to appear in a separate row though?
[QUOTE=NeatNit;51978130]is it supposed to appear in a separate row though?[/QUOTE]
[url=https://github.com/FPtje/DarkRP/blob/master/gamemode/modules/base/sv_data.lua#L349]Yep[/url]
[QUOTE=Fruitwesp;51978159][url=https://github.com/FPtje/DarkRP/blob/master/gamemode/modules/base/sv_data.lua#L349]Yep[/url][/QUOTE]
So nothing is wrong with my setup? It's just how it's supposed to be now?
How do I make clients download my custom content in my custom gamemode? I have everything in "mygamemode/content/", in the appropriate materials/sound/models folders, but when someone joins it doesn't download. If they don't have the gamemode on their machine everything shows up as errors/purple-black.
[QUOTE=Rory;51980218]How do I make clients download my custom content in my custom gamemode? I have everything in "mygamemode/content/", in the appropriate materials/sound/models folders, but when someone joins it doesn't download. If they don't have the gamemode on their machine everything shows up as errors/purple-black.[/QUOTE]
[url]http://wiki.garrysmod.com/page/resource/AddFile[/url]
[QUOTE=Fruitwesp;51980245][url]http://wiki.garrysmod.com/page/resource/AddFile[/url][/QUOTE]
I tried to do that prior to posting, and it didn't work.
[code]
-- Path: garrysmod/gamemodes/mygamemode/content/sound/fyre/test_sound.wav
-- Repeated for every single file in the content directory:
resource.AddFile("sound/fyre/test_sound.wav")
[/code]
You have to either have sv_allowdownload set to 1 or have a valid webhost set to sv_downloadurl.
Why doesn't DFrame:SetBackgroundBlur work on a painted frame? What is the workaround? Don't link Derma_DrawBackgroundBlur please, I have tested it and it's really just a motion blur, not the same as DFrame:SetBackgroundBlur.
[QUOTE=MrRalgoman;51981614]Why doesn't DFrame:SetBackgroundBlur work on a painted frame? What is the workaround? Don't link Derma_DrawBackgroundBlur please, I have tested it and it's really just a motion blur, not the same as DFrame:SetBackgroundBlur.[/QUOTE]
It's literally the exact same thing
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dframe.lua#L197-L199[/url]
[post=51982150]:snip:[/post]
[QUOTE=Rory;51980296]I tried to do that prior to posting, and it didn't work.
[code]
-- Path: garrysmod/gamemodes/mygamemode/content/sound/fyre/test_sound.wav
-- Repeated for every single file in the content directory:
resource.AddFile("sound/fyre/test_sound.wav")
[/code][/QUOTE]
You need to define your download url in a cfg file (sv_downloadurl "http://yourdownloadlink.com/")
Is it possible to have a horizontal scrollbar with DScrollBar?
So instead of it looking like:
[img]http://i.imgur.com/dryzHEM.png[/img]
It's like this:
[img]http://i.imgur.com/BEkiIUX.png[/img]
[QUOTE=MPan1;51981692]It's literally the exact same thing
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/vgui/dframe.lua#L197-L199[/url][/QUOTE]
The blur density isn't the same and there isn't a parameter for it with either function...
[QUOTE=NiandraLades;51982740]Is it possible to have a horizontal scrollbar with DScrollBar?
So instead of it looking like:
[img]http://i.imgur.com/dryzHEM.png[/img]
It's like this:
[img]http://i.imgur.com/BEkiIUX.png[/img][/QUOTE]
Yes, but you'd need to set up your own scrollable panel and everything, like a custom DScrollPanel.
DHorizontalScrollBar already exists. (or however it is called)
-snip-
Forgot to end my paint function. It was redrawing every frame. Whoops.
How do I convert the string returned from [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/LookupBinding]input.LookupBinding[/url] to be usable for [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/IsKeyDown]input.IsKeyDown[/url]?
[QUOTE=JasonMan34;51988019]How do I convert the string returned from [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/LookupBinding]input.LookupBinding[/url] to be usable for [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/IsKeyDown]input.IsKeyDown[/url]?[/QUOTE]
_G["KEY_" .. input.LookupBinding(cmd):upper()]
[QUOTE=txike;51988069]_G["KEY_" .. input.LookupBinding(cmd):upper()][/QUOTE]
Wouldn't that fail with keypad keys?
So I'm bascially trying to make this simple text at the top right of the screen that shows the server uptime, but when i try to convert it to hours, it just throws an error. It works just fine with milliseconds, seconds and minutes, and it says that string.FormattedTime supports hours?
[code]
local times = string.FormattedTime( CurTime(), "%02i:%02i:%02i:%02i" )
draw.DrawText( times, "TheDefaultSettings", ScrW(), 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_RIGHT )
[/code]
[QUOTE=SkitZz;51988394]So I'm bascially trying to make this simple text at the top right of the screen that shows the server uptime, but when i try to convert it to hours, it just throws an error. It works just fine with milliseconds, seconds and minutes, and it says that string.FormattedTime supports hours?
[code]
local times = string.FormattedTime( CurTime(), "%02i:%02i:%02i:%02i" )
draw.DrawText( times, "TheDefaultSettings", ScrW(), 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_RIGHT )
[/code][/QUOTE]
[URL="http://image.prntscr.com/image/cfee4e1899e7409689cd52aaac1bb8de.png"]Seems as if the function returns only up to minutes in format, but includes hours in table[/URL]
Probably unintended
[editline]20th March 2017[/editline]
utime defines its own command to get weeks and days too, you could just remove weeks and days from this to get what you want
[lua]function timeToStr( time )
local tmp = time
local s = tmp % 60
tmp = math.floor( tmp / 60 )
local m = tmp % 60
tmp = math.floor( tmp / 60 )
local h = tmp % 24
tmp = math.floor( tmp / 24 )
local d = tmp % 7
local w = math.floor( tmp / 7 )
return string.format( "%02iw %id %02ih %02im %02is", w, d, h, m, s )
end[/lua]
[QUOTE=JasonMan34;51988419][URL="http://image.prntscr.com/image/cfee4e1899e7409689cd52aaac1bb8de.png"]Seems as if the function returns only up to minutes in format, but includes hours in table[/URL]
Probably unintended
[editline]20th March 2017[/editline]
utime defines its own command to get weeks and days too, you could just remove weeks and days from this to get what you want
[lua]function timeToStr( time )
local tmp = time
local s = tmp % 60
tmp = math.floor( tmp / 60 )
local m = tmp % 60
tmp = math.floor( tmp / 60 )
local h = tmp % 24
tmp = math.floor( tmp / 24 )
local d = tmp % 7
local w = math.floor( tmp / 7 )
return string.format( "%02iw %id %02ih %02im %02is", w, d, h, m, s )
end[/lua][/QUOTE]
Awesome, thanks a lot!
If there anyway to make a trace hit a trigger entity, e.g. trigger_teleport, custom Lua triggers? Only way I've found through Lua is to do
[code]
Trigger:SetNotSolid(false)
-- Do trace
Trigger:SetNotSolid(true)
[/code]
IEngineTrace->EnumerateEntities would be useful with a Lua binding in some way.
Sorry, you need to Log In to post a reply to this thread.