Nothing in my Gamemode Works!

Hey.
I’m making a little Gamemode. Its just a Simple Modification for the Sandbox.
But nothing in my Gamemode Works!
Here is a Small Example
[lua]
function GM:ScalePlayerDamage(ply,hitgroup,dmginfo)
Msg ("Player “…ply:Name()…” took “…dmginfo:GetDamage()…” damage!
")
end
[/lua]
I know its from gmod.com. But its just a Test.
And, it does not work. Nothing.

have you tried bert?


(User was banned for this post ("Can't help? Don't reply." - mahalis))

bert?

everybody gets a piece

I really dont know what you mean.

Ignore him, also, in what file did you place it?

init.lua but i dont know why. Now it works -.- .
I made a Hud after that it works.
But now my Problem is, when i die i get a "
Hook ‘PaintOurHud’ Failed: advancedsandbox\gamemode\hud.lua:147: attempt to call method ‘Clip1’ (a nil value)
"
:expressionless:

A value is nil, add a check somewhere to check of Clip1 is nil or not.

Yepp, that’s the Problem.
[lua]
local prammo = client:GetActiveWeapon():Clip1();
[/lua]
Its a Variable for the
[lua]
local text = string.format( “Primary: %i AMMO”, prammo );
[/lua]
But, if i use client:armor
it works.
But with Clip1() … not :confused:

you need to check GetActiveWeapon() to see if it’s nil or not

Uhm. If the Player is Dead, its Nil. Because… He does not have any Weapons.
But the “if !client:Alive then return end” is ignored :frowning:

I think you need to check, like SteveUK said, if the active weapon is valid or has a clip?