Weapons not being given

Im working on a gamemode and right now im trying to add some weapons to it. I put the folders in gamemodename/entities/weapons and I called them weapon_ak47 and so on so that they spawn on the map. So when I pick them up in the map they work but when I try to give them to a player on PlayerSpawn nothing happens. Here is what I have:

[LUA]function GM:PlayerSpawn( ply )
ply:SetWalkSpeed( 260 )
ply:SetJumpPower( 240 )
ply:SetRunSpeed ( 260 )
if ply:IsGuard() then
ply:SetModel(“models/player/Police.mdl”)
ply:ChatPrint(“You are a Guard”)
ply:Give(“weapon_ak47”)
ply:Give(“weapon_crowbar”)
elseif ply:IsPrisoner() then
ply:SetModel(“models/player/group01/female_04.mdl”)
ply:ChatPrint(“You are a Prisoner”)
ply:Give(“weapon_crowbar”)
elseif ply:IsSpec() then
ply:ChatPrint(“You are a Spectator”)
end
end[/LUA]

The weird thing is when I spawn, the ChatPrint works so I get for example “You are a Prisoner” but I dont get a weapon. I tried adding weapon_crowbar but that doesnt work either. I also have the code for making viewmodel hands show in my GM:PlayerSpawn function but It’s just from the wiki so I didn’t include that.

Any errors?
Where did you put this function?
Perhaps IsGuard() doesn’t get executed or doesn’t return a value.
Post whole code

The function is in my init.lua file and IsGuard() is located in a file called sh_meta.player which looks like this:

[LUA]local meta = FindMetaTable(“Player”)

function meta:IsPrisoner()
return self:Team() == TEAM_PRISON
end

function meta:IsGuard()
return self:Team() == TEAM_GUARDS
end

function meta:IsSpec()
return self:Team() == TEAM_SPEC
end[/LUA]

The teams are setup in shared.lua which looks like this:

[LUA]GM.Name = “Jailbreak”
GM.Author = “Zebra”
GM.Email = “”
GM.Website = “”

CL_BLUE = Color(179, 188, 209)
CL_BLUELBL = Color(144, 151, 167)
CL_RED = Color(210, 177, 177)
CL_REDLBL = Color(170, 142, 142)

ROUND_WAITING = 0 --This stuff is for the round system I have
ROUND_STARTING = 1
ROUND_ACTIVE = 2
ROUND_ENDING = 3

TEAM_PRISON = 1
TEAM_GUARDS = 2
TEAM_SPEC = 3

team.SetUp (TEAM_PRISON, “Prisoners”, Color (255, 0, 0, 255))
team.SetUp (TEAM_GUARDS, “Guards”, Color (0, 0, 255, 255))
team.SetUp (TEAM_SPEC, “Guards”, Color (100, 100, 255, 255))[/LUA]

I also have this in init.lua:

[LUA]AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
AddCSLuaFile(“cl_hud.lua”)
AddCSLuaFile(“sh_meta.lua”)

include(“shared.lua”)
include(“sh_meta.lua”)[/LUA]

I also tried this:

[LUA]function GiveAK( ply )
ply:Give(“weapon_ak47”)
ply:ChatPrint(“Ak Given!”)
end
concommand.Add(“ak”, GiveAK)[/LUA]

This does print Ak Given! in chat but doesn’t give me the gun.
Also no lua errors in client or server console.

Try giving another weapon, preferably one you haven’t overriden.

I tried weapon_crowbar but that didn’t work either.

edit:

A PlayerCanPickupWeapon hook was returning false and that apparently blocks Give() completely… :suicide: