TTT- spawning with weapons
-
- A semi-regular
- Posts: 16
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Sun Nov 10, 2013 1:00 pm
TTT- spawning with weapons
How can I get all the players to spawn with a deagle during the pre-round?
Re: TTT- spawning with weapons
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
-
- A semi-regular
- Posts: 16
- Joined: Sun Nov 10, 2013 1:00 pm
Re: TTT- spawning with weapons
thanks, but where do I add this?
the int?
the int?
Re: TTT- spawning with weapons
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.
If you have a lua question, the facepunch forums are really good for that.
-
- A semi-regular
- Posts: 16
- Joined: Sun Nov 10, 2013 1:00 pm
Re: TTT- spawning with weapons
thanks, I really new to all this. I really appreciate your helpful and patient attitude!
Re: TTT- spawning with weapons
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.
Anyway, have fun.
-
- A semi-regular
- Posts: 16
- Joined: Sun Nov 10, 2013 1:00 pm
Re: TTT- spawning with weapons
[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
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
Re: TTT- spawning with weapons
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
lua/autorun/server/givedeagle.lua
-
- A semi-regular
- Posts: 16
- Joined: Sun Nov 10, 2013 1:00 pm
Re: TTT- spawning with weapons
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
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
-
- A semi-regular
- Posts: 16
- Joined: Sun Nov 10, 2013 1:00 pm
Re: TTT- spawning with weapons
Edit:
nevermind, I found the right folder
nevermind, I found the right folder
-
- A semi-regular
- Posts: 16
- Joined: Sun Nov 10, 2013 1:00 pm
Re: TTT- spawning with weapons
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
nothing happens with this script