Also, for some reason my gamemode name won't show up... It keeps saying it's the Base Gamemode in scoreboard and TTT in the server browser...
Any errors on launch?
-snip- No.
You getting Sandbox too in the gamemode?
DeriveGamemode( "sandbox" );
In both cl_init.lua and init.lua
[editline]24th February 2012[/editline]
And do you have GM.Name = "..." in init.lua?
I have it in the shared.lua (As the skeleton gamemode puts it in there) and I'm not getting the sandbox, I'll try the DeriveGamemode, though.
GM.Name goes in init.lua AFAIK.
And base scoreboard, is because sandbox isn't overwriting it.
Well, I can't use the Q menu either... I derived the gamemode from sandbox and it didn't do much, and I don't really want that anyways. I'm going to remove it if it doesn't change much. Let me move GM.Name
Alright.
You sure no errors on starting? How many files you including? It could be an error in some of those, that stops the rest from running?
^ Still didn't do anything. Damn you automerge D:
Anyways, no errors, only the cl_hud.lua
[editline]24th February 2012[/editline]
Ok so for some reason, the name is working now, but it still says Base Gamemode and I'm assuming that's because it hasn't overwritten the scoreboard yet. ( I found out why it was fixed... I changed sv_defaultgamemode from terrortown to my gamemode... When I use evolve to change the gamemode, why does it not change the gamemode name??? )
Back to the real issue, the HUDs are still not hiding.
If the gamemode name isn't being set that means there's an error somewhere
[url]http://oi44.tinypic.com/1z1uyj7.jpg[/url]
your gamemode is deriving from base, there's no spawn menu in base man
I realize that... He thought that I was getting the sandbox gamemode.
Just set GM.Name in shared.lua? Or in both init.lua and cl_init.lua. That should fix the Base Scoreboard. It uses "GAMEMODE.Name .. " - " .. GAMEMODE.Author" in it's title.
[QUOTE=Freze;34855148]Just set GM.Name in shared.lua? Or in both init.lua and cl_init.lua. That should fix the Base Scoreboard. It uses "GAMEMODE.Name .. " - " .. GAMEMODE.Author" in it's title.[/QUOTE]
*sigh*... I put it in init.lua, shared.lua, and cl_init.lua.... still not working. THE FUCK IS WRONG WITH MY SERVER / GAMEMODE!?!?!? :S
lua_run_cl PrintTable( hook.GetTable()["HUDShouldDraw"] )
if you use ', you get " HUDShouldDraw " which won't return anything.
Try:
lua_run_cl print(GM.Name)
See if it's actually set.
[editline]25th February 2012[/editline]
Also set this before includes.
[QUOTE=InfernalCookie;34763747]I used the Skeleton gamemode then made it from scratch using that.
[editline]19th February 2012[/editline]
Oh and also, the code in the same file as this that makes my custom HUD doesn't work either. I just noticed that.[/QUOTE]
Could you paste the ENTIRE file? It might help work out what's going on.
Edit: PS, definitely not a problem with how the HUD is being removed. Ran the code on my client and it worked fine. Something's clearly interfering somewhere.
Have you tried putting the code into a file of its own, putting it in garrysmod/lua and running it with lua_openscript_cl?
Are you sure your file is even running properly? Put print"File is running"; somewhere just to be sure.
[editline]25th February 2012[/editline]
[QUOTE=Freze;34840226]I just remembered this thread, when i saw my own code.
This works:
[lua]function GM:HUDShouldDraw( id )
local nodraw = {
"CHudHealth",
"CHudAmmo",
"CHudSecondaryAmmo",
"CHudBattery",
}
for k, v in pairs( nodraw ) do
if( id == v ) then
return false;
end
end
return true;
end[/lua]
If it doesn't something else is blocking it.[/QUOTE]
It's unnecessary to make a new table everytime the hook runs. Don't do this.
[editline]25th February 2012[/editline]
It's even more unnecessary to make a local table is you're only going to use it once. Only make variables if you use whatever it is the variable is more than one time.
[QUOTE=_NewBee;34862563]Are you sure your file is even running properly? Put print"File is running"; somewhere just to be sure.
[editline]25th February 2012[/editline]
It's unnecessary to make a new table everytime the hook runs. Don't do this.
[editline]25th February 2012[/editline]
It's even more unnecessary to make a local table is you're only going to use it once. Only make variables if you use whatever it is the variable is more than one time.[/QUOTE]
I'm not saying it's the best way, I'm saying that it's working? There's plenty of better ways of doing it.
I did:
[lua]
function GM:PlayerInitialSpawn( ply )
ply:PrintMessage( HUD_PRINTTALK, "Hello, welcome to the server." )
end
[/lua]
And it didn't print. I'm assuming this means the file isn't running... I also put it in cl_init.lua and it didnt work which surprises me.. :S
[url]http://pastebin.com/rSDMF9y2[/url]
^ I didn't work on any of the HUD that's under it, it's from my previous coding.
PlayerInitialSpawn isn't a clientside function bud
[QUOTE=Banana Lord.;34869361]PlayerInitialSpawn isn't a clientside function bud[/QUOTE]
Oh, right... -_- lol, thanks. Wait... Wouldn't that give me an error if it tried running?
[QUOTE=InfernalCookie;34871931]Oh, right... -_- lol, thanks. Wait... Wouldn't that give me an error if it tried running?[/QUOTE]
it doesn't try to run
Use something else than HUD:****() ? Not sure, but that's all I noticed.
[QUOTE=Freze;34877441]Use something else than HUD:****() ? Not sure, but that's all I noticed.[/QUOTE]
why? they are elements of a table, it'll work fine if he could get it to run
[QUOTE=Banana Lord.;34878453]why? they are elements of a table, it'll work fine if he could get it to run[/QUOTE]
isnt HUD used somewhere else
but you're right.. what else is included before this?
[code]Banana Lord ran Lua 'Banana( ):SendLua([[PrintTable( HUD )]]);'
[@lua\includes\util.lua:35] bad argument #1 to 'pairs' (table expected, got nil)
[/code]
Fair enough. I wasn't at home, so I wasn't able to test so myself.
[QUOTE=InfernalCookie;34871931]Oh, right... -_- lol, thanks. Wait... Wouldn't that give me an error if it tried running?[/QUOTE]
The way you do it now you're simply defining it as a function that doesn't get ran, all a hook does it call your function at certain events, but in this case, it only calls it on the server.
Sorry, you need to Log In to post a reply to this thread.