Jump to content

Welcome to the Imperial Gaming

Welcome to my forums, full of great members.
Please register if you'd like to take part.

Star Wars Imperial RP

Join our Imperial RP server

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
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
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...