From 73c3a720c23bb854c6efbde7593b6ae3a2be1233 Mon Sep 17 00:00:00 2001 From: icedream Date: Sat, 21 Dec 2013 03:53:33 +0100 Subject: [PATCH] Only support models of type *_prop_*/prop_*/*_prop. Fixes #1 once again. --- lua/weapons/disguiser/init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/weapons/disguiser/init.lua b/lua/weapons/disguiser/init.lua index ce7118d..4e7a973 100644 --- a/lua/weapons/disguiser/init.lua +++ b/lua/weapons/disguiser/init.lua @@ -192,12 +192,12 @@ function SWEP:Undisguise() // Make sure we have an old model to revert to if (self.UndisguiseAs == nil) then return false end - // Make sure the new model is not a non-studio model as that - // might crash out the server. - // I did not yet find a better solution as I was not bothering to - // debug it by using the model class. Would take far too long to - // experiment. - if (string.sub(entity:GetModel(), 1, 1) == "*") then return false end + // Make sure the new model is actually marked as a prop + if ( + !string.sub(string.lower(entity:GetClass()), 1, 5) == "prop_" + && !string.sub(string.lower(entity:GetClass()), -5, 5) == "_prop" + && string.find(string.lower(entity:GetClass()), "_prop_") == nil + ) then return false end local owner = self.Owner local ophysobj = owner:GetPhysicsObject()