1. Post #1
    n0mi's Avatar
    May 2010
    98 Posts
    yeah sorry for that,

    what i need is like if you press on "E" on a suitcase then you change model from like "models/player/breen.mdl" to models/player/combine_soldier_prisonguard.mdl so it just change you model and if you can make it so when you die it stay with that i mean is if you die with the suitcase on you like used it so you got the model models/player/combine_soldier_prisonguard.mdl so it don't change back to models/player/breen.mdl,


    hope you understand


    myold post:http://facepunch.com/threads/1077524?highlight=
    my second old post:http://facepunch.com/threads/1180262?highlight=


    wonder if someone can put this togheter
    Reply With Quote Edit / Delete Reply Windows 7 Sweden Show Events Dumb Dumb x 1 (list)

  2. Post #2
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    Do you want the suitcase to be a SENT? What do you mean by having the suitcase "on"?

  3. Post #3
    n0mi's Avatar
    May 2010
    98 Posts
    yes i want it as en sent i was meaning when you wear the suit it change your model when you spawn the sent and press on it you change model
    Reply With Quote Edit / Delete Reply Windows 7 Sweden Show Events Dumb Dumb x 1 (list)

  4. Post #4
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    Are you familiar with SENTS? Let me try something because I bet you know your english isn't the greatest but i'll give it a go.

    You want a SENT to change your model to a different model. It will only change to the other model if your model is the model previous to the change. When you die it stays as is? Is this what you are asking specifically?

  5. Post #5
    n0mi's Avatar
    May 2010
    98 Posts
    Are you familiar with SENTS? Let me try something because I bet you know your english isn't the greatest but i'll give it a go.

    You want a SENT to change your model to a different model. It will only change to the other model if your model is the model previous to the change. When you die it stays as is? Is this what you are asking specifically?
    yeah if you mean it stay as the model you changed to
    Reply With Quote Edit / Delete Reply Windows 7 Sweden Show Events Dumb Dumb x 1 (list)

  6. Post #6
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    Alright I am testing what I made at the moment won't be long till I send you the code.

    Edited:

    Serverside code lua/autorun/server
    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)
    

    This is the SENT:
    cl_init.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
    

    init.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
    

    shared.lua
    ENT.Type = "anim"
    ENT.Base = "base_gmodentity"
    ENT.PrintName = "SuitCase"
    ENT.Author = "Inferno, Eh?"
    ENT.Spawnable = false
    ENT.AdminSpawnable = true
    

    Enjoy :)
    Reply With Quote Edit / Delete Reply Windows 7 Canada Show Events Friendly Friendly x 1 (list)

  7. Post #7
    n0mi's Avatar
    May 2010
    98 Posts
    Alright I am testing what I made at the moment won't be long till I send you the code.

    Edited:

    Serverside code lua/autorun/server
    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)
    

    This is the SENT:
    cl_init.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
    

    init.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
    

    shared.lua
    ENT.Type = "anim"
    ENT.Base = "base_gmodentity"
    ENT.PrintName = "SuitCase"
    ENT.Author = "Inferno, Eh?"
    ENT.Spawnable = false
    ENT.AdminSpawnable = true
    

    Enjoy :)
    doest seems it works for me i put in first code to lua/autorun/server and the other 3 to 3 lua files in to a foldercalled suit in lua/entities
    i found it in entities in gmod but can't spawn it

  8. Post #8
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    Change this to true if you want non-admins to spawn it:
    ENT.Spawnable = false

    The model saving i'm not sure how to keep it unless you place directly inside of the gamemode's PlayerSpawn Hook which you would have to do yourself. Are you using this in sandbox?

  9. Post #9
    n0mi's Avatar
    May 2010
    98 Posts
    Change this to true if you want non-admins to spawn it:
    ENT.Spawnable = false

    The model saving i'm not sure how to keep it unless you place directly inside of the gamemode's PlayerSpawn Hook which you would have to do yourself. Are you using this in sandbox?
    i mean that its a icon on entities of that you upload but when you press on it(spawn it ) it never spawns on the map

  10. Post #10
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    I'm not sure. You can always spawn it with ent_create "name" in console.

  11. Post #11
    n0mi's Avatar
    May 2010
    98 Posts
    I'm not sure. You can always spawn it with ent_create "name" in console.
    did you test this self on your gmod, if this worked for you upload it to mediafire.

    P.S are this for gmod 12?

  12. Post #12
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    I did test it myself and it doesn't spawn from the spawn menu. I don't know how to fix it because I don't usually make addons for others. Sorry but I can't help you any further than that.

  13. Post #13
    n0mi's Avatar
    May 2010
    98 Posts
    I did test it myself and it doesn't spawn from the spawn menu. I don't know how to fix it because I don't usually make addons for others. Sorry but I can't help you any further than that.
    found this maybe you can just make this perment so it stay when you dies as the model you change to

    Shared.lua
    Code:
    ENT.Type = "anim"
    ENT.Base = "base_gmodentity"
    ENT.PrintName = "model_alyx"
    ENT.Author = "darkrp"
    ENT.Spawnable = false
    ENT.AdminSpawnable = true
    cl_init.lua
    Code:
    include('shared.lua')
    
    function ENT:Initialize()
    end
    
    function ENT:Draw()
        if !LocalPlayer():Alive() then return end
        self.Entity:DrawModel()
    end
    
    function ENT:Think()
    end
    init.lua
    Code:
    AddCSLuaFile("cl_init.lua")
    AddCSLuaFile("shared.lua")
    
    include('shared.lua')
    
    
    function ENT:SpawnFunction( ply, tr )
    
    	if ( !tr.Hit ) then return end
    	
    	local SpawnPos = tr.HitPos + tr.HitNormal * 16
    	
    	local ent = ents.Create( "clothes_combine" )
    		ent:SetPos( SpawnPos )
    	ent:Spawn()
    	ent:Activate()
    	
    	
    	return ent
    	
    end
    
    function ENT:Initialize()
    	self.Entity:SetModel( "models/props/de_tides/Vending_tshirt.mdl")
    	self.Entity:PhysicsInit(SOLID_VPHYSICS)
    	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
    	self.Entity:SetSolid(SOLID_VPHYSICS)
    	local phys = self.Entity:GetPhysicsObject()
    	if(phys:IsValid()) then phys:Wake() end
    end
    
    function ENT:OnTakeDamage(dmg)
    	    
    	    self.Entity:EmitSound("/player/goprone.wav")
    		self.Entity:Remove()
    		
    end
    
    
    function ENT:Think()
    end 
    
    function ENT:Use(ply)
    if ply:Team() == TEAM_CHIEF then return false
    end
    if ply:Team() == TEAM_POLICE then return false
    end
    if ply:Team() == TEAM_MAYOR then return false
    end
    if ply:Team() == TEAM_SWAT then return false
    end
        ply:SetModel("models/player/alyx.mdl")
    	self.Entity:TakeDamage()
    
    end

  14. Post #14
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    function ENT:SpawnFunction( ply, tr )
    
    	if ( !tr.Hit ) then return end
    	
    	local SpawnPos = tr.HitPos + tr.HitNormal * 16
    	
    	local ent = ents.Create( "classname" ) -- Edit the classname to the Sent folder name
    		ent:SetPos( SpawnPos )
    	ent:Spawn()
    	ent:Activate()
    	
    	
    	return ent
    	
    end
    
    Just use this for the spawning for the SENT in the init.lua. You should have told me this was for DarkRP. Just wondering but is english your first language?

  15. Post #15
    n0mi's Avatar
    May 2010
    98 Posts
    function ENT:SpawnFunction( ply, tr )
    
    	if ( !tr.Hit ) then return end
    	
    	local SpawnPos = tr.HitPos + tr.HitNormal * 16
    	
    	local ent = ents.Create( "classname" ) -- Edit the classname to the Sent folder name
    		ent:SetPos( SpawnPos )
    	ent:Spawn()
    	ent:Activate()
    	
    	
    	return ent
    	
    end
    
    Just use this for the spawning for the SENT in the init.lua. You should have told me this was for DarkRP. Just wondering but is english your first language?
    no my first language are swedish

  16. Post #16
    Awesome Gmod Servers!
    brandonj4's Avatar
    September 2011
    2,065 Posts
    Well try using that function I gave you tell me if it works. If not I will try this out later :)

    Here we GOOOOOOOOOOOOOO :D

    function ENT:SpawnFunction( ply, tr )
        if ( !tr.Hit ) then return end
        local ent = ents.Create( self.Classname )
        ent:SetPos( tr.HitPos + tr.HitNormal * 16 ) 
        ent:Spawn()
        ent:Activate()
     
        return ent
    end
    
    Copy and paste that inside of the entities init.lua folder and you should be all set! Happy suit changing!