• invisible display of the weapon
    8 replies, posted
Hi, everybody! Whether it is possible? The mode - SandBox How to invisible display of the weapon for guests, users in the weapon tab?
What? Are you trying to make the weapon invisible in the weapon selection, or are you trying to make the weapon selection invisible? In either case - why? You shouldn't have the need to do either.
I trying to make the weapon invisible in the weapon selection tab. Q (or F1) -> Weapons -> Half-Life 2 -> invisible weapon here for users or guests
Try something like this near the top of the SWEP code [LUA] if CLIENT then if LocalPlayer():IsAdmin() then SWEP.Spawnable = true else SWEP.Spawnable = false end end [/LUA] Havent tested may not work and there may be a better way, also to get this to update (EG: players rank changed while ingame) the player will have to reconnect
[QUOTE=rtm516;50350947]Try something like this near the top of the SWEP code [LUA] if CLIENT then if LocalPlayer():IsAdmin() then SWEP.Spawnable = true else SWEP.Spawnable = false end end [/LUA] Havent tested may not work and there may be a better way, also to get this to update (EG: players rank changed while ingame) the player will have to reconnect[/QUOTE] This is the man trying to bring back toybox... (Keep in mind I'm pretty sure what you posted was wrong)
[QUOTE=Tupac;50351016]This is the man trying to bring back toybox... (Keep in mind I'm pretty sure what you posted was wrong)[/QUOTE] Just tested doesnt work making another solution [editline]19th May 2016[/editline] Fixed just place in garrysmod/lua/autorun/client/filenamehere.lua [LUA] local HiddenWeps = {"weapon_flechettegun"} local HiddenGroups = {"user", "guest"} hook.Add("OnSpawnMenuOpen", "RestrictWeapons", function() if table.HasValue(HiddenGroups, LocalPlayer():GetUserGroup()) then local Weapons = list.Get("Weapon") for k,v in pairs(HiddenWeps) do if (IsValid(Weapons[v]) == false) then return end local wep = Weapons[v] wep["Spawnable"]=false list.Set("Weapon", v, wep) end end end) [/LUA]
I tryed it. [CODE] local HiddenWeps = {"weapon_357"} local HiddenGroups = {"superadmin"} hook.Add("OnSpawnMenuOpen", "RestrictWeapons", function() if table.HasValue(HiddenGroups, LocalPlayer():GetUserGroup()) then local Weapons = list.Get("Weapon") for k,v in pairs(HiddenWeps) do if (IsValid(Weapons[v]) == false) then return end local wep = Weapons[v] wep["Spawnable"]=false list.Set("Weapon", v, wep) end end end) [/CODE] Sry, but this doesn't work.
[QUOTE=godred2;50351770]I tryed it. [CODE] local HiddenWeps = {"weapon_357"} local HiddenGroups = {"superadmin"} hook.Add("OnSpawnMenuOpen", "RestrictWeapons", function() if table.HasValue(HiddenGroups, LocalPlayer():GetUserGroup()) then local Weapons = list.Get("Weapon") for k,v in pairs(HiddenWeps) do if (IsValid(Weapons[v]) == false) then return end local wep = Weapons[v] wep["Spawnable"]=false list.Set("Weapon", v, wep) end end end) [/CODE] Sry, but this doesn't work.[/QUOTE] That will hide weapon_357 from superadmin, worked fine for me
[QUOTE=rtm516;50352151]That will hide weapon_357 from superadmin, worked fine for me[/QUOTE] Hmm... I will try Thx you [editline]20th May 2016[/editline] Thx you. Worked fine
Sorry, you need to Log In to post a reply to this thread.