I have looked everywhere for this...I have ULX, URS, etc. I have restricted weapons from certain groups I have created (they are denied from spawning them), but they spawn WITH them. Here are my questions to keep it concise:
How do I control what groups spawn with?
Where does this code go in? (With my assumption that it takes code) Please be specific in the "C:/steam/steamapps/etc.".
That is about it, I greatly appreciate your help if anyone has an idea for this.
Make a new file, name it something like "preventspawn.lua".
Put this code inside it;
[lua]
hook.Add("PlayerLoadout", "disallow_illegal_spawn", function(ply)
ply:Give("gmod_tool") -- Give the player a toolgun
ply:Give("gmod_camera") -- Give the player the camera
ply:Give("weapon_physgun") -- Give the player the physgun
ply:Give("weapon_physcannon") -- Give the player the gravity gun
-- Add any more similar statements here to give the player more starting weapons
return true -- Stop the player from being given any other weapons
end )
[/lua]
Put this file inside "C:/steam/steamapps/common/garrysmod/garrysmod/lua/autorun/server", and it should automatically give the player the four basic gmod weapons (toolgun, physgun, gravity gun, camera) and prevent them from getting anything else.
Awesome! That is the most crucial, through my search in garrysmod wiki, I found this gem (below). If I were to say add this to the beginning of the code and change the usergroup to my ulx group, would that be valid in executing the command to give player in the specified group the following items?
[CODE]if ( Player(2):IsUserGroup("superadmin") ) then[/CODE]
Example:
[CODE]hook.Add("PlayerLoadout", "disallow_illegal_spawn", function(ply)
if ( Player(2):IsUserGroup("superadmin") ) then
ply:Give("gmod_tool") -- Give the player a toolgun
ply:Give("gmod_camera") -- Give the player the camera
ply:Give("weapon_physgun") -- Give the player the physgun
ply:Give("weapon_physcannon") -- Give the player the gravity gun
-- Add any more similar statements here to give the player more starting weapons
return true -- Stop the player from being given any other weapons
end )[/CODE]
[QUOTE=conviper30;47434223]Awesome! That is the most crucial, through my search in garrysmod wiki, I found this gem (below). If I were to say add this to the beginning of the code and change the usergroup to my ulx group, would that be valid in executing the command to give player in the specified group the following items?
[CODE]if ( Player(2):IsUserGroup("superadmin") ) then[/CODE]
Example:
[CODE]hook.Add("PlayerLoadout", "disallow_illegal_spawn", function(ply)
if ply:IsUserGroup("superadmin") then
ply:Give("gmod_tool") -- Give the player a toolgun
ply:Give("gmod_camera") -- Give the player the camera
ply:Give("weapon_physgun") -- Give the player the physgun
ply:Give("weapon_physcannon") -- Give the player the gravity gun
-- Add any more similar statements here to give the player more starting weapons
return true -- Stop the player from being given any other weapons
end
end )[/CODE][/QUOTE]
Yeee close mate, take a look at what I changed in the quote.
That'll make super admins only spawn with those weapons
[QUOTE=conviper30;47434223]Awesome! That is the most crucial, through my search in garrysmod wiki, I found this gem (below). If I were to say add this to the beginning of the code and change the usergroup to my ulx group, would that be valid in executing the command to give player in the specified group the following items?
[CODE]if ( Player(2):IsUserGroup("superadmin") ) then[/CODE]
Example:
[CODE]hook.Add("PlayerLoadout", "disallow_illegal_spawn", function(ply)
if ( Player(2):IsUserGroup("superadmin") ) then
ply:Give("gmod_tool") -- Give the player a toolgun
ply:Give("gmod_camera") -- Give the player the camera
ply:Give("weapon_physgun") -- Give the player the physgun
ply:Give("weapon_physcannon") -- Give the player the gravity gun
-- Add any more similar statements here to give the player more starting weapons
return true -- Stop the player from being given any other weapons
end )[/CODE][/QUOTE]
Target the player somehow else. Like from a concommand or something, or even use the hooks ply variable.
Also, the check would be. (you have 2 options):
ply:GetUserGroup() == "superadmin"
ply:IsSuperAdmin()
[editline] Edit [/editline]
Yeah, anon, it's GetUserGroup not IsUserGroup
[QUOTE=Exploderguy;47434329]
ply:IsUserGroup() == "superadmin"
[/QUOTE]
That wouldn't work, IsUserGroup returns true or false
:GetUserGroup() returns their group.
Thank you guys, you were awesome help. It worked well!
Sorry, you need to Log In to post a reply to this thread.