TTT- spawning with weapons

Post Reply
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sun Nov 10, 2013 1:00 pm

TTT- spawning with weapons

Post by fuzzlefluff »

How can I get all the players to spawn with a deagle during the pre-round?
ahoffman
New to forums
New to forums
Posts: 9
Joined: Mon Nov 11, 2013 3:53 pm

Re: TTT- spawning with weapons

Post by ahoffman »

Code: Select all

local function GiveWeapon()
	for k,v in pairs( player.GetAll() ) do // Loop through the table of players, where k (key) is the player index and v (value) is the actual entity
      v:Give( "weapon_zm_grevolver" ) // give them a deagle. yeah, revolver is deagle in ttt
   end
end
hook.Add( "TTTPrepareRound", "GiveOutGuns", GiveWeapon ) -- Hook the function, so it is called when TTT starts the round
Taken from facepunch, modified a bit. Should work, but untested
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
Joined: Sun Nov 10, 2013 1:00 pm

Re: TTT- spawning with weapons

Post by fuzzlefluff »

thanks, but where do I add this?

the int?
ahoffman
New to forums
New to forums
Posts: 9
Joined: Mon Nov 11, 2013 3:53 pm

Re: TTT- spawning with weapons

Post by ahoffman »

Just name it whatever, like givedeagle.lua or whatever and place it in the lua/autorun/server folder.

If you have a lua question, the facepunch forums are really good for that.
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
Joined: Sun Nov 10, 2013 1:00 pm

Re: TTT- spawning with weapons

Post by fuzzlefluff »

thanks, I really new to all this. I really appreciate your helpful and patient attitude!
ahoffman
New to forums
New to forums
Posts: 9
Joined: Mon Nov 11, 2013 3:53 pm

Re: TTT- spawning with weapons

Post by ahoffman »

Oh yeah no problem man, I'm waiting for the map to change so a script on my server will update. Can't switch right now since there's 18 people on, I don't think they'd be happy.

Anyway, have fun.
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
Joined: Sun Nov 10, 2013 1:00 pm

Re: TTT- spawning with weapons

Post by fuzzlefluff »

[ERROR] lua/autorun/givedeagle.lua:3: attempt to call method 'Give' (a nil value)
1. fn - lua/autorun/givedeagle.lua:3
2. Call - addons/ulib/lua/ulib/shared/hook.lua:183
3. RoundStateChange - gamemodes/terrortown/gamemode/cl_init.lua:136
4. Function - gamemodes/terrortown/gamemode/cl_init.lua:214
5. unknown - lua/includes/modules/usermessage.lua:87



I'm getting these errors with the script you gave me, and I'm not sure what they mean exactly or how to fix them
any help would be appreciated
ahoffman
New to forums
New to forums
Posts: 9
Joined: Mon Nov 11, 2013 3:53 pm

Re: TTT- spawning with weapons

Post by ahoffman »

It's running the variables on a client. Make sure it's in the server autorun, not main autorun folder.

lua/autorun/server/givedeagle.lua
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
Joined: Sun Nov 10, 2013 1:00 pm

Re: TTT- spawning with weapons

Post by fuzzlefluff »

I am unable to find an autorun folder on my server that is not in the garrysmod folder


the base folders I have are

bin
sourceengine
garrysmod
exec_(servername).exe
steam_appid.txt

any clue where I am? placing the lua next to the exe does nothing
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
Joined: Sun Nov 10, 2013 1:00 pm

Re: TTT- spawning with weapons

Post by fuzzlefluff »

Edit:

nevermind, I found the right folder
fuzzlefluff
A semi-regular
A semi-regular
Posts: 16
Joined: Sun Nov 10, 2013 1:00 pm

Re: TTT- spawning with weapons

Post by fuzzlefluff »

So, I have applied this to my server and do not get any errors, but I also don't get any benefit

nothing happens with this script
Post Reply