Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: John on October 30, 2007, 02:35:59 PM

Title: Can you set server defaults with ULX
Post 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
Title: Re: Can you set server defaults with ULX
Post by: Megiddo on October 30, 2007, 02:48:02 PM
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.
Title: Re: Can you set server defaults with ULX
Post by: MulleDK13 on October 30, 2007, 02:58:12 PM
To the no weapons question. I think I got the answer (by accident)..

Code: [Select]
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!
Title: Re: Can you set server defaults with ULX
Post by: spbogie on October 30, 2007, 03:09:05 PM
2) Put this in a file named "limitedloadout.lua" in gmod/lua/autorun/server
Code: [Select]
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
Title: Re: Can you set server defaults with ULX
Post by: John on October 30, 2007, 06:31:09 PM
Wow, thanks for the quick, good replies guys, I'll go test this now.
Title: Re: Can you set server defaults with ULX
Post by: Avien on November 02, 2007, 11:01:22 PM
If on a dedicated server:
Simply edit the file garrysmod/gamemodes/sandbox/gamemode/init.lua

Code: [Select]
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.
Title: Re: Can you set server defaults with ULX
Post by: JamminR on November 03, 2007, 10:26:47 AM
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.
Title: Re: Can you set server defaults with ULX
Post by: spbogie on November 03, 2007, 10:31:14 AM
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.
Title: Re: Can you set server defaults with ULX
Post by: JamminR on November 03, 2007, 10:32:59 AM
Gotcha. I was wondering if that was the case. Thanks for verifying Spbogie
Title: Re: Can you set server defaults with ULX
Post by: meeces2911 on January 06, 2008, 10:58:03 PM
2) Put this in a file named "limitedloadout.lua" in gmod/lua/autorun/server
Code: [Select]
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 ??
Title: Re: Can you set server defaults with ULX
Post by: meeces2911 on January 07, 2008, 10:08:18 PM
Nevermind, i found another way, modifying the Uteam function to accept weapons... :)