Jump to content

Recommended Posts

Hey everybody,

Since I became the RG Commander, I have noticed that if we want to change from our battle armour to our robes, we need to call staff and waste there time.  To fix this, I have written a small, lightweight script that can be put in the servers serverside autorun that allows people to switch between their battle armor and robes using a simple chat command !switch.  The addon has been made in such a way that other regiments can be added with minimal effort.  Thanks for considering this @Martibo @Caboose and @Wolf.

 

The code is as follows and should be placed in garrysmod\lua\autorun\server:

local SwitchPairs = {
  {"models/player/starwars/mistersweetroll/imperialguard.mdl","models/player/ven/guard.mdl"},
  // just add a pair of models here
}
local SwitchTable = {}
for k,v in pairs(SwitchPairs) do
  table.insert(SwitchTable,0,v)
  table.insert(SwitchTable,0,table.Reverse(v))
end
hook.Add("PlayerSay","SwitchModel",function (ply,txt)
  if string.lower(txt) == "!switch" then
    for k,v in pairs(SwitchTable) do
      if ply:GetModel() == v[1] then
        ply:SetModel(v[2])
        return ""
      end
    end
  end

end)
 

 

  • Upvote 4
Link to comment
Share on other sites

14 minutes ago, |Stryker| said:

instead of having that as an autorun they could just change the model you get in the job code.......... (dots continue for 3 years)

Then we would have to call staff to change our robes back to the other ones...................(dots continue for 4 years)

Link to comment
Share on other sites

46 minutes ago, pinejack said:

Then we would have to call staff to change our robes back to the other ones...................(dots continue for 4 years)

Probably would have helped if i read it... lool

I was tooo busy playing bf2

Edited by |Stryker|
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...