I just downloaded a new weapon from Steam, I would like to give this to certain ranks, is there anyway to do that?
Since you're using this for TTT I would just add a check on weapon loadout for the players ulx group. Think the file is called sv_weps.lua. Read and understand the file.
Then just use this function
[url]http://wiki.garrysmod.com/page/Player/IsUserGroup[/url]
Something like this should work if I recall correctly.
[lua]if ply:IsUserGroup('user') then
ply:Give('weapon_ttt_sword')
else
ply:Give('weapon_zm_improvised')
end
[/lua]
Alternatively you could use a table and a for loop, depending on how many different weapons you're planning on adding.
Note: I am not sure this is the most efficient way, but is how I would do it.
From a very lesser being, where would I place this text?
[editline]6th March 2014[/editline]
My main issue is that there is no file named sv_weps.lua
Ahh sorry I just looked into it. The file will be called weaponry.lua inside your terrortown/gamemode folder.
Try understanding the code a bit, if you need some more help then read it again. Follow the functions, if you're still stuck. Then add me on steam.
Don't edit the TTT core unless you know what you're doing.
[url]www.coderhire.com[/url]
Here's a freebie:
[code]
hook.Add("PlayerLoadout", "SwordPls", function()
if ply:IsUserGroup("donator") then
ply:StripWeapon("weapon_zm_improvised")
ply:Give("weapon_ttt_sword")
end
end)[/code]
I use coderhire quite often, but that code does not work, I placed it in the lua and lua/autorun not being sure which was correct and all it does do is strip me weapons.
[QUOTE=fast0nitro;44151238]I use coderhire quite often, but that code does not work, I placed it in the lua and lua/autorun not being sure which was correct and all it does do is strip me weapons.[/QUOTE]
Do you have a weapon called "weapon_ttt_sword"?
This no longer works with the new gmod
Place it in lua/autorun/server instead
Doesn't work, all I change is the user group and the name of the weapon
Well his syntax isn't right either, fix it.
Sorry, you need to Log In to post a reply to this thread.