Need some help with making users spawn with a certain amount of armor depending on their ULX rank. For example, tier 1 donator spawns with 25% and tier 2 spawns with 50%.
I believe it should be something like this.
Put this in lua/autorun/server/custom_filename.lua
local function spawn( ply )
if table.HasValue({"tier_1_donator"}, ply:GetNWString("usergroup")) then
ply:SetArmor( 25 )
elseif table.HasValue({"tier_2_donator"}, ply:GetNWString("usergroup")) then
ply:SetArmor( 50 )
end
hook.Add( "PlayerInitialSpawn", "GiveArmor", spawn )
Though, this will only set the armor once every PlayerInitialSpawn
imo a better way of doing this ( if using darkrp )
would be to just set up a donator only jobs that spawn with an armor boost.
TEAM_DONATOR = DarkRP.createJob("Donator", {
color = Color(255, 204, 51, 255),
model = "models/player/barney.mdl",
wardrobe = false,
description = [[donators only]],
weapons = {},
command = "donator",
max = 0,
salary = 0,
vote = false,
PlayerSpawn = function(ply) ply:SetArmor(50) --[[ ply:GodEnable() ]] end, -- remove --[[ & ]] to enable godmode.
PlayerDeath = function(ply) ply:GodDisable() end,
customCheck = function(ply) return ply:GetUserGroup() == "tier_1_donator" or ply:IsUserGroup("tier_2_donator") end,
CustomCheckFailMsg = "donators only!"
})
So why not just use PlayerSpawn so they get it every single time they spawn?
BrainFart.
Yeah you're totally right. sorry, it was late when I wrote that ^
Sorry, you need to Log In to post a reply to this thread.