I tried to give players a weapon when they join depending on their level, but for some reason it only works if they are an admin. I used the DarkRP weapons, any help? There are no errors what so ever. Thanks
[lua]
hook.Add(“PlayerLoadout”, “GivePlayerSWEPS”, function(ply)
Msg("
Loadout hook called
“)
timer.Simple(2, function()
if DarkRPWeapons[ply.Level] then
ply:Give(DarkRPWeapons[ply.Level])
ply:SelectWeapon(DarkRPWeapons[ply.Level])
Msg(”
Given wep
")
Msg("Given “…ply:Nick()…” “…DarkRPWeapons[ply.Level]…”
")
else
Msg(“They don’t have a level or the weapon for that level is invalid!”)
end
end)
end)
[/lua]
[lua]
DarkRPWeapons = {}
DarkRPWeapons[1] = “weapon_glock2”
DarkRPWeapons[2] = “weapon_fiveseven2”
DarkRPWeapons[3] = “weapon_p2282”
DarkRPWeapons[4] = “weapon_deagle2”
DarkRPWeapons[5] = “weapon_smg1”
DarkRPWeapons[6] = “weapon_mp52”
DarkRPWeapons[7] = “weapon_mac102”
DarkRPWeapons[8] = “weapon_m42”
DarkRPWeapons[9] = “weapon_pumpshotgun2”
DarkRPWeapons[10] = “ls_sniper”
DarkRPWeapons[11] = “weapon_ak472”
DarkRPWeapons[12] = “weapon_ak472”
[/lua]
– FIXED
It was the gunlicense, I didn’t think that would stop the Give() function. I fixed it by changing the GM:PlayerCanPickupWeapon function.