• Force playermodel change
    5 replies, posted
Hey everyone, When I try to run this code to force the playermodel to change, it only changes for a brief moment, then reverts to the old playermodel. [CODE]function SWEP:Attack(attackname, ent, npc, ply) if attackname == "puppeteer" then if npc then //well, this is tr.Entity:IsNPC() local cl_playermodel = ent:GetModel() //get the entity's model! local modelname = player_manager.TranslatePlayerModel( cl_playermodel ) //find that model for the player's use self.Owner:SetModel( modelname ) //set it end if ent and not ent:IsWorld() then self.Owner:EmitSound(self.AttackSounds.transform) end end end[/CODE] Is there some special way that I must do this? Please help me.
Are you doing it serverside or clientside?
[QUOTE=wh1t3rabbit;42910520]Are you doing it serverside or clientside?[/QUOTE] It's in my shared.lua, so I'm not actually certain if it's supposed to favor one over the other.
[QUOTE=Turtle95;42910570]It's in my shared.lua, so I'm not actually certain if it's supposed to favor one over the other.[/QUOTE] While I can't guarantee that not running it serverside is the cause of your issue (it changing back straight away), not running it serverside will cause other players to not see the change (only the client it runs on would see the change). You can add a print() statement and see if it prints in yellow or blue to tell if it is client or server.
[QUOTE=wh1t3rabbit;42910770]While I can't guarantee that not running it serverside is the cause of your issue (it changing back straight away), not running it serverside will cause other players to not see the change (only the client it runs on would see the change). You can add a print() statement and see if it prints in yellow or blue to tell if it is client or server.[/QUOTE] When I try to print modelname and cl_playermodel (looking at an NPC Citizen) it prints in blue: models/humans/group01/male_08.mdl models/player/kleiner.mdl
Turns out the SWEP, "Hidden: Source" was causing my troubles.. Ugh. Well, this is now solved!
Sorry, you need to Log In to post a reply to this thread.