• Restricting Playermodels?
    7 replies, posted
Hello. I'm looking for a small code that will allow admins, and higher ranks only to be allowed a specific playermodel. I Hope this is enough Info! thanks - James.
[lua]if ply:IsAdmin() then ply:SetModel ("playermodelname") [/lua] untested and if you want to make it so other people can't be that model [lua] function nomodelforu ( ply ) if ply:GetModel() == "thesameplayermodelname") then ply:SetModel ("models/player/Kleiner.mdl") hook.Add( "PlayerSpawn", "derpderpderpadminonlymodel", nomodelforu ) [/lua] also untested. [editline] box [/editline] Box me, I :downs:'d while doing the 2nd snippet
Hm. I Don't really want every admin to be that model, i just want it to make it so that they can be it if they want, but normal players cant. Is there a way to do that? Thanks anyway,
sorry your OP confuzzed me :psyduck: [lua] function nomodelforu ( ply ) if ply:IsAdmin() then end elseif ply:GetModel() == "admin only player model name") then ply:SetModel ("models/player/Kleiner.mdl") end end hook.Add( "PlayerSpawn", "derpderpderpadminonlymodel", nomodelforu ) [/lua] yeah its kinda the same from my other post but I fucked up on the other one. untested, there might be an easier way but whatever didn't pay attention while putting the ends in so there might be too many or not enough, test it though
You could use this to have a variety of models which admins can change to via typing a console command. [lua] function setadminmodel( ply ) if ply:IsAdmin() then ply:SetModel("models/player/Kleiner.mdl") end end concommand.Add("changemodel1", setadminmodel) function setadminmodeltwo( ply ) if ply:IsAdmin() then ply:SetModel("models/player/tellytubby.mdl") end end concommand.Add("changemodel2", setadminmodeltwo) function setadminmodelthree( ply ) if ply:IsAdmin() then ply:SetModel("models/player/chucknorris.mdl") end end concommand.Add("changemodel3", setadminmodelthree)[/lua]
[QUOTE=sintwin;21291984]You could use this to have a variety of models which admins can change to via typing a console command. [lua] function setadminmodel( ply ) if ply:IsAdmin() then ply:SetModel("models/player/Kleiner.mdl") end end concommand.Add("changemodel1", setadminmodel) function setadminmodeltwo( ply ) if ply:IsAdmin() then ply:SetModel("models/player/tellytubby.mdl") end end concommand.Add("changemodel2", setadminmodeltwo) function setadminmodelthree( ply ) if ply:IsAdmin() then ply:SetModel("models/player/chucknorris.mdl") end end concommand.Add("changemodel3", setadminmodelthree)[/lua][/QUOTE] he already explained what he wanted ._. we both didn't read it well enough [editline]08:04PM[/editline] And also that really does nothing because last I checked every playermodel you add will automatically get added to the options>playermodel menu [editline]08:05PM[/editline] Oh shit, don't use mine I think it will make it so you can't spawn if your an admin since I ended it lemme fix it ._.
[QUOTE=DocDoomsday;21292193] Oh shit, don't use mine I think it will make it so you can't spawn if your an admin since I ended it lemme fix it ._.[/QUOTE] No yours is just riddled with errors and will never work. [QUOTE=sintwin;21291984]You could use this to have a variety of models which admins can change to via typing a console command. [/QUOTE] And yours is bypassable via the Q model menu. [lua] hook.Add("Think", "ModelDenial", function() for k,v in pairs(player.GetAll()) do if v:IsAdmin or v:IsSuperAdmin() then return end if v:GetModel() == "RestrictedModel" then v:SetModel("models/player/odessa.mdl") end end end) [/lua] Replace "RestrictedModel" with the model that you don't want people to use and then admins can change to that model using the Q menu. Put this in a text file and name it anything.lua then put it in garrysmod/lua/autorun/server.
Or you could make a table of restricted models, and put them into the seach function.
Sorry, you need to Log In to post a reply to this thread.