Ulysses
Ulysses Stuff => Suggestions => Topic started by: -RJ- on October 08, 2011, 11:36:09 AM
-
This is more of a request than a suggestion, but I was wondering if anyone could make
it where a user is automatically given weapons when they spawn. Also if it could be group
specific, so you set a specific group to spawn with certain weapons and so when a person
spawns they'll be given the specified weapons. (I'm no pro but is it possible to make it so
it uses a "give" command when they spawn?)
If anyone can do this for me I'll greatly appreciate it! Thanks :)
-
http://forums.ulyssesmod.net/index.php/topic,3177.0.html
Though particular question in that FAQ is prevent specific, it leads to many discussions that might allow specific.
-
I don't necessarily want it so that it limits their loadout to only a select amount of weapons.
What I'm getting at is when the user that's in a specific group will have the default weapons
and will be given weapons that are specified.
The reason for this is because I'm running a Fretta server and I need it so that a group like
Donator would get some fun sweps but would also have the smg to kill props or if it were
Deathrun I'd need it so that they still get those fun sweps but won't have an smg.
-
I understand what you're going for, and I still recommend you see the FAQ I suggested.
URS, part of the answer to that question, will allow for specific loadouts for each/every group.
-
Here you go!
function Custom_Loadout( ply )
if ply:IsUserGroup("donator") then --checks to see if the player is a member of the group "donator"
ply:GiveAmmo(30,"buckshot",true) --Gives the player ammo type 'buckshot'
ply:Give("weapon_shotgun") --Gives the player weapon weapon_shotgun
end
end
hook.Add( "PlayerLoadout", "CustomGamemodeLoadoutFunction", Custom_Loadout)
Place this code into a file called customloadout.lua and put that file in your garrysmod/lua/server folder.
You will need to have an if statement for each separate group you wish to give weapons to in this manner.
Individual ply:Give and ply:GiveAmmo can be on separate lines. Be sure you give the player ammo for the weapons you give them if applicable. You can find a list of all the ammo types and weapons here (http://wiki.garrysmod.com/?title=Player.Give) and here (http://wiki.garrysmod.com/?title=Player.GiveAmmo)
-
If this is too complicated for you to do on your own, then be more specific with exactly you want and I will throw it together for you. It's very simple, but taking the time to make something that is robust and modular would take a while and I honestly don't have the time to work on something like that.
-
Work perfectly! Thanks! :D
function Custom_Loadout( ply )
if ply:IsUserGroup("superadmin") then
ply:Give("weapon_raveball")
elseif ply:IsUserGroup("majordonator") then
ply:Give("weapon_raveball")
end
end
hook.Add( "PlayerLoadout", "CustomGamemodeLoadoutFunction", Custom_Loadout)
Tell me if I did anything wrong
-
No, that will work.. but it would be more efficient to do it this way.
function Custom_Loadout( ply )
if ( ply:IsUserGroup( "superadmin" ) or ply:IsUserGroup( "majordonator" ) ) then
ply:Give( "weapon_raveball" )
end
end
hook.Add( "PlayerLoadout", "CustomGamemodeLoadoutFunction", Custom_Loadout )