I know there are alot of threads, but they don't seem to work for me. I may just be being retarded, but I would appreciate some help. What codes do I have to add and where? If I want TEAM_POLICE to have 50 armour when they spawn?
[url]http://facepunch.com/showthread.php?t=1250283[/url]
Add spawn hook, check for player:IsCP() and then player:SetArmor(50)
Also, easiest but kinda dumb way is adding item_battery to weapon list
Sorry, i know nothign about LUA, would you/someone be able to help me with the code? I've tried numerous things any help is appreciated
[lua]
local function SpawnArmorForCPs(ply)
if ply:IsCP() then
ply:SetArmor(50)
end
end
hook.Add("PlayerSpawn", "CPArmor", SpawnArmorForCPs)
[/lua]
Place in [B]autorun/server/cparmor.lua[/B].
[QUOTE=Phoenixf129;42531775][lua]
local function SpawnArmorForCPs(ply)
if ply:IsCP() then
ply:SetArmor(50)
end
end
hook.Add("PlayerSpawn", "CPArmor", SpawnArmorForCPs)
[/lua]
Place in [B]autorun/server/cparmor.lua[/B].[/QUOTE]
That worked for police chief, but how would I apply this for swat?
Make SWAT part of CP
[QUOTE=KnoxvilleLAD;42532101]Make SWAT part of CP[/QUOTE]
Yes but I wanted to have SWAT as a different hp but that works fine thanks! It worked, changed nothing restarted server, now it doesn't work? Would this be a dodgy addon?
-snip-
[QUOTE=alexj12;42532393]Yes but I wanted to have SWAT as a different hp but that works fine thanks! It worked, changed nothing restarted server, now it doesn't work? Would this be a dodgy addon?[/QUOTE]
[LUA]
local function PoliceSpawn( _p )
if ( _p:IsCP() ) then
_p:SetArmor( 50 );
if ( _p:Team() == TEAM_SWAT ) then
_p:SetHealth( 150 );
_p:SetArmor( 75 );
elseif ( _p:Team() == TEAM_SPIDERMANSWAT ) then
_p:SetHealth( 300 );
_p:SetArmor( 100 );
end
end
end
hook.Add( "PlayerSpawn", "PoliceSpawnExtras", PoliceSpawn );
[/LUA]
like that you can have different health for different police jobs.
[QUOTE=Busan1;42534311][LUA]
local function PoliceSpawn( _p )
if ( _p:IsCP() ) then
_p:SetArmor( 50 );
if ( _p:Team() == TEAM_SWAT ) then
_p:SetHealth( 150 );
_p:SetArmor( 75 );
elseif ( _p:Team() == TEAM_SPIDERMANSWAT ) then
_p:SetHealth( 300 );
_p:SetArmor( 100 );
end
end
end
hook.Add( "PlayerSpawn", "PoliceSpawnExtras", PoliceSpawn );
[/LUA]
like that you can have different health for different police jobs.[/QUOTE]
This didn't work for me :/ but thanks for trying :)
[QUOTE=alexj12;42535154]This didn't work for me :/ but thanks for trying :)[/QUOTE]
[code]
local function PoliceSpawn( _p )
if ( _p:IsCP() ) then
_p:SetArmor( 50 );
elseif ( _p:Team() == TEAM_SWAT ) then
_p:SetHealth( 150 );
_p:SetArmor( 75 );
elseif ( _p:Team() == TEAM_SPIDERMANSWAT ) then
_p:SetHealth( 300 );
_p:SetArmor( 100 );
end
end
hook.Add( "PlayerSpawn", "PoliceSpawnExtras", PoliceSpawn );[/code]
[QUOTE=Koolsami7;42536567][code]
local function PoliceSpawn( _p )
if ( _p:IsCP() ) then
_p:SetArmor( 50 );
elseif ( _p:Team() == TEAM_SWAT ) then
_p:SetHealth( 150 );
_p:SetArmor( 75 );
elseif ( _p:Team() == TEAM_SPIDERMANSWAT ) then
_p:SetHealth( 300 );
_p:SetArmor( 100 );
end
end
hook.Add( "PlayerSpawn", "PoliceSpawnExtras", PoliceSpawn );[/code][/QUOTE]
then SWAT won't get armor
Sence this has not been put as solved, I'll try to post something that works for my DarkRP Server.
Go here. garrysmod/gamemodes/darkrp/gamemode/modules
Create a file named "classhealth.lua" (Or anything you want)
Put this inside.
[CODE]
function ArmorSpawn( ply )
if ply:Team() == TEAM_POLICE then
ply:SetArmor(150)
ply:SetHealth(150)
ply:SetRunSpeed(265)
ply:SetWalkSpeed(200)
end
if ply:Team() == TEAM_CHIEF then
ply:SetArmor(200)
ply:SetHealth(200)
ply:SetRunSpeed(265)
ply:SetWalkSpeed(200)
end
end
hook.Add( "PlayerLoadout", "ArmorSpawn", ArmorSpawn )[/CODE]
You can use anything that has ply: before it in these settings. Basically you just need to copy/paste the repeating parts and rename the TEAM_.
Good luck!
Sorry, you need to Log In to post a reply to this thread.