Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: John on October 30, 2007, 02:35:59 PM
-
Probably a stupid question, but I need to figure out how to set the default amount of set props etc, and find a way to have users spawn with no weapons.
Anyone feel like helping? ??? :D
-
Answer 1: http://garrysmod.com/wiki/?title=Admin#Setting_Limits
Answer 2: I don't know of anything that makes users spawn with no weapons, sorry.
-
To the no weapons question. I think I got the answer (by accident)..
local function noWeaponsSpawn( ply )
return ""
end
hook.Add( "PlayerSpawn", "ULXNoWeaponsSpawn", noWeaponsSpawn, -15 ) -- Very low priority
Just put that at the bottom of fun.lua located in ulx\lua\ulx\modules
or create a new module... This works but you won't even have the phys gun! so you would need to spawn that somehow!
-
2) Put this in a file named "limitedloadout.lua" in gmod/lua/autorun/server
local weapons = { "weapon_physgun", "weapon_physcannon", "gmod_camera", "gmod_tool" }
local function LimitedLoadout( ply )
for _, v in pairs( weapons ) do
ply:Give( v )
end
ply:SelectWeapon( weapons[ 1 ] )
return true
end
hook.Add( "PlayerLoadout", "LimitedLoadout", LimitedLoadout)
Place any weapons you want people to spawn with in the weapons table.
weapon_physgun = Phys Gun
weapon_physcannon = Grav Gun
gmod_camera = Camera
gmod_tool = Tool Gun
-
Wow, thanks for the quick, good replies guys, I'll go test this now.
-
If on a dedicated server:
Simply edit the file garrysmod/gamemodes/sandbox/gamemode/init.lua
function GM:PlayerLoadout( pl )
// Remove any old ammo
pl:RemoveAllAmmo()
if ( server_settings.Bool( "sbox_weapons", true ) ) then
pl:GiveAmmo( 256, "Pistol", true )
pl:GiveAmmo( 256, "SMG1", true )
pl:GiveAmmo( 5, "grenade", true )
pl:GiveAmmo( 64, "Buckshot", true )
pl:GiveAmmo( 32, "357", true )
pl:GiveAmmo( 32, "XBowBolt", true )
pl:GiveAmmo( 6, "AR2AltFire", true )
pl:Give( "weapon_ar2" )
pl:Give( "weapon_crowbar" )
pl:Give( "weapon_pistol" )
pl:Give( "weapon_smg1" )
pl:Give( "weapon_frag" )
pl:Give( "weapon_physcannon" )
pl:Give( "weapon_crossbow" )
pl:Give( "weapon_shotgun" )
pl:Give( "weapon_357" )
pl:Give( "weapon_rpg" )
pl:Give( "weapon_ar2" )
// The only reason I'm leaving this out is because
// I don't want to add too many weapons to the first
// row because that's where the gravgun is.
//pl:Give( "weapon_stunstick" )
end
pl:Give( "gmod_tool" )
pl:Give( "gmod_camera" )
pl:Give( "weapon_physgun" )
local cl_defaultweapon = pl:GetInfo( "cl_defaultweapon" )
if ( pl:HasWeapon( cl_defaultweapon ) ) then
pl:SelectWeapon( cl_defaultweapon )
end
end
Just simply remove the items you don't want, or change how much ammo you start with...
You can also add in a line saying if the player's steamid is not an admin id, then remove the weapons, else spawn with them all.
-
I was under the impression that Garrysmod no longer allowed editing of the 'default' files.
Thought that was done by Garry to prevent all the broken ways people were coding various things.
-
It does not allow editing of the default files on the CLIENT, however, SRCDS does not use gcf files, so it is imposible for him to force an override there.
-
Gotcha. I was wondering if that was the case. Thanks for verifying Spbogie
-
2) Put this in a file named "limitedloadout.lua" in gmod/lua/autorun/server
local weapons = { "weapon_physgun", "weapon_physcannon", "gmod_camera", "gmod_tool" }
local function LimitedLoadout( ply )
for _, v in pairs( weapons ) do
ply:Give( v )
end
ply:SelectWeapon( weapons[ 1 ] )
return true
end
hook.Add( "PlayerLoadout", "LimitedLoadout", LimitedLoadout)
I like spbogie idea, but it dosnt work ... :( does anyone have a working copy of this ??
-
Nevermind, i found another way, modifying the Uteam function to accept weapons... :)