ULX

Author Topic: Can you set server defaults with ULX  (Read 8485 times)

0 Members and 1 Guest are viewing this topic.

John

  • Guest
Can you set server defaults with ULX
« 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

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Can you set server defaults with ULX
« Reply #1 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.
Experiencing God's grace one day at a time.

Offline MulleDK13

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Can you set server defaults with ULX
« Reply #2 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!

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: Can you set server defaults with ULX
« Reply #3 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
« Last Edit: October 30, 2007, 03:11:23 PM by spbogie »
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

John

  • Guest
Re: Can you set server defaults with ULX
« Reply #4 on: October 30, 2007, 06:31:09 PM »
Wow, thanks for the quick, good replies guys, I'll go test this now.

Offline Avien

  • Full Member
  • ***
  • Posts: 168
  • Karma: 4
Re: Can you set server defaults with ULX
« Reply #5 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.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can you set server defaults with ULX
« Reply #6 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.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline spbogie

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: 41
Re: Can you set server defaults with ULX
« Reply #7 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.
I have not failed. I've just found 10,000 ways that won't work. - Thomas A. Edison
I reject your reality and substitute my own. - Adam Savage

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can you set server defaults with ULX
« Reply #8 on: November 03, 2007, 10:32:59 AM »
Gotcha. I was wondering if that was the case. Thanks for verifying Spbogie
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

meeces2911

  • Guest
Re: Can you set server defaults with ULX
« Reply #9 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 ??

meeces2911

  • Guest
Re: Can you set server defaults with ULX
« Reply #10 on: January 07, 2008, 10:08:18 PM »
Nevermind, i found another way, modifying the Uteam function to accept weapons... :)