• Multi-gamemode weapon compatability
    6 replies, posted
I'm trying to make my weapon compatable with gamemodes other than TTT. So far, I am having little luck. I've tried something like this: [lua]if GetConVarString("gamemode") == "terrortown" then local gmslot = 6 else local gmslot = 2 end SWEP.Slot = gmslot[/lua] but it just appears in slot 1 for both TTT and SB. Is there a better way of doing this and am I doing something wrong? Thanks in advance for any help! :)
[url=http://wiki.garrysmod.com/page/engine/ActiveGamemode]engine.ActiveGamemode()[/url]
Would I just replace GetConVarString("gamemode") with engine.ActiveGamemode()?
[QUOTE=Baron von Hax;47334269]Would I just replace GetConVarString("gamemode") with engine.ActiveGamemode()?[/QUOTE] You can try, I am not 100% certain that will fix your bug.
Didn't seem to help much, althought I'll remember that as a better alternative to finding the gamemode :P I think it's more the method I'm using to do it. There must be another way to do it :P
Is because you are declaring gmslot as local within the if statement, so as soon as you reach the end of the if statement it no longer exists. Declare it above the if and it will work. [lua]local gmslot = 2 if checkthegamemode then gmslot = 6 end SWEP.Slot = gmslot[/lua]
[QUOTE=wh1t3rabbit;47336573]Is because you are declaring gmslot as local within the if statement, so as soon as you reach the end of the if statement it no longer exists. Declare it above the if and it will work. [lua]local gmslot = 2 if checkthegamemode then gmslot = 6 end SWEP.Slot = gmslot[/lua][/QUOTE] Godspeed, sir.
Sorry, you need to Log In to post a reply to this thread.