Alright I am testing what I made at the moment won’t be long till I send you the code.
[editline]29th April 2012[/editline]
Serverside code lua/autorun/server
[lua]
local use_model = false
hook.Add(“PlayerDeath”, “DeathOfPlayers”, function(victim, weapon, killer)
victim.model = victim:GetModel()
if victim.model == “models/player/combine_soldier_prisonguard.mdl” then
use_model = true
else
use_model = false
end
end)
hook.Add(“PlayerSpawn”, “CheckModel”, function(ply) // Use GM for gamemodes it wouldn’t override for me but I tested it and it worked
if use_model == true then
ply:SetModel(“models/player/combine_soldier_prisonguard.mdl”)
end
end)
[/lua]
This is the SENT:
cl_init.lua
[lua]
include(“shared.lua”)
function ENT:Initialize()
end
function ENT:Draw()
if !LocalPlayer():Alive() then return end
self.Entity:DrawModel()
end
function ENT:Think()
end
[/lua]
init.lua
[lua]
AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(“shared.lua”)
function ENT:Initialize()
self.Entity:SetModel(“models/props_c17/SuitCase_Passenger_Physics.mdl”)
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
local phys = self.Entity:GetPhysicsObject()
self.nodupe = true
self.ShareGravgun = true
if phys and phys:IsValid() then phys:Wake() end
self:SetCollisionGroup(COLLISION_GROUP_INTERACTIVE_DEBRIS)
end
function ENT:Use(activator, caller)
if activator:IsPlayer() and activator:Alive() then
activator:SetModel(“models/player/combine_soldier_prisonguard.mdl”)
end
//self:Remove() remove if you wish
end
[/lua]
shared.lua
[lua]
ENT.Type = “anim”
ENT.Base = “base_gmodentity”
ENT.PrintName = “SuitCase”
ENT.Author = “Inferno, Eh?”
ENT.Spawnable = false
ENT.AdminSpawnable = true
[/lua]
Enjoy 