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

Share this post


Link to post
Share on other sites
5 minutes ago, DanK said:

+1 

Would be very helpful for the RG/SG regiments and fit for roleplay

Robes should only be worn when not in battle

That is exactly what they are currently, but we have to call staff over and over if we want them changed.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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)

Share this post


Link to post
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|

Share this post


Link to post
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

×
×
  • Create New...