Generally, I tend to get whatever custom content I can from the steam workshop for my DarkRP server. I haven't however been able to find any sort of items that give players armour upon picking it up. I have seen other servers use entities like combine orbs to act as armour sets.
My question is if anybody knows some workshop items I may be looking for, or if there is a way to simply create my own. Ideally, the final product I want is medics having the ability to sell Full Armour sets (giving the player 100 Armour), and Armour pieces (giving the player 20 armour per piece).
SetArmor( 100 )
[QUOTE=Gamz365;42210223]SetArmor( 100 )[/QUOTE]
Where and how would I apply this? (don't know too much about lua)
[lua]
function ENT:Use(activator,caller)
activator:SetArmor( 100 )
self:Remove()
end
[/lua]
Go into DarkRP/entities/entities/
copy one folder, rename it to "armor".
cl_init.lua:
[CODE]
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
[/CODE]
shared.lua:
[CODE]
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Armor"
ENT.Author = "Blabla"
ENT.Spawnable = false
ENT.AdminSpawnable = false
[/CODE]
init.lua:
[CODE]
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
include("shared.lua");
function ENT:Initialize()
self:SetModel( "models/props_interiors/BathTub01a.mdl" );
self:PhysicsInit( SOLID_VPHYSICS );
self:SetMoveType( MOVETYPE_VPHYSICS );
self:SetSolid( SOLID_VPHYSICS );
self:SetUseType( SIMPLE_USE );
self:SetCollisionGroup( COLLISION_GROUP_INTERACTIVE_DEBRIS );
local phys = self:GetPhysicsObject();
phys:Wake();
hook.Add( "PlayerDisconnected", self, self.onPlayerDisconnected );
end
function ENT:Use(ply)
ply:SetArmor( 100 );
self:Remove();
end
[/CODE]
Go into addentities.lua:
[CODE]
AddCustomShipment( "Armor", "models/props_interiors/BathTub01a.mdl", "armor", 123, 1, true, 1, true, {TEAM_???} );
[/CODE]
Change the 1 before the last true to the price, change models/ in both init.lua and addentities.lua to whatever model you want it to be. Go ingame, click Q, right click a prop > Copy to clipboard.
Change TEAM_??? to the team(s) that should sell it, more than one team: TEAM_???, TEAM_???
[QUOTE=Gamz365;42210384][lua]
function ENT:Use(activator,caller)
activator:SetArmor( 100 )
self:Remove()
end
[/lua][/QUOTE]
Where exactly would I put this? A little more information would be helpful. (when I said I don't know much, I'm talking bare minimum sorry :S)
[B]
Edit:[/B]
Answered immediately as I posted this. Woops. :P
[editline]16th September 2013[/editline]
[QUOTE=Busan1;42210633]Go into DarkRP/entities/entities/
copy one folder, rename it to "armor".
cl_init.lua:
[CODE]
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
[/CODE]
shared.lua:
[CODE]
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Armor"
ENT.Author = "Blabla"
ENT.Spawnable = false
ENT.AdminSpawnable = false
[/CODE]
init.lua:
[CODE]
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
include("shared.lua");
function ENT:Initialize()
self:SetModel( "models/props_interiors/BathTub01a.mdl" );
self:PhysicsInit( SOLID_VPHYSICS );
self:SetMoveType( MOVETYPE_VPHYSICS );
self:SetSolid( SOLID_VPHYSICS );
self:SetUseType( SIMPLE_USE );
self:SetCollisionGroup( COLLISION_GROUP_INTERACTIVE_DEBRIS );
local phys = self:GetPhysicsObject();
phys:Wake();
hook.Add( "PlayerDisconnected", self, self.onPlayerDisconnected );
end
function ENT:Use(ply)
ply:SetArmor( 100 );
self:Remove();
end
[/CODE]
Go into addentities.lua:
[CODE]
AddCustomShipment( "Armor", "models/props_interiors/BathTub01a.mdl", "armor", 123, 1, true, 1, true, {TEAM_???} );
[/CODE]
Change the 1 before the last true to the price, change models/ in both init.lua and addentities.lua to whatever model you want it to be. Go ingame, click Q, right click a prop > Copy to clipboard.
Change TEAM_??? to the team(s) that should sell it, more than one team: TEAM_???, TEAM_???[/QUOTE]
This is exactly what I needed. Thank you!
Sorry, you need to Log In to post a reply to this thread.