General > Developers Corner

Lua Help (Player Models)

(1/1)

Duke Nukem:
So, this isn't exactly ULX, but, I want to make it so certain players, or groups, have a certain model, I've figured this out so far, by modding scoreboardcolors.lua.


--- Code: ---      if ply:IsUserGroup("owner") then
         ply:SetModel(ply._OldModel)
      end
--- End code ---

But I can't figure out what to do with the rest of this.


--- Code: ---if SERVER then
   AddCSLuaFile("scoreboardcolors.lua")
else
   function MySBColors(ply)
      if ply:IsUserGroup("co-owner") then
         ply:SetModel(ply._OldModel)
      end
      if ply:IsUserGroup("owner") then
         ply:SetModel(ply._OldModel)
      end
   end
   hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end
--- End code ---
Any suggestions?

nathan736:
the logic flow would be

--- Code: ---if target is in the group owner then
set targets model to ply._oldmodel
end

--- End code ---
for the next one it would be

--- Code: ---if server then
add other lua for server only
else -- this means not the server then
create function  mysbcolors with args  ply
if the player is in the group co-owner then
set players model to ply._oldmodel
end
if player is in the group is owner then
set players model to ply._oldmodel
end
end
--ADDING CLIENT HOOK  this is clientside
   hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end

--- End code ---

Navigation

[0] Message Index

Go to full version