Here the faction file:
Code:
--[[
© 2012 CloudSixteen.com do not share, re-distribute or modify
without permission of its author ([email protected]).
--]]
local FACTION = Clockwork.faction:New("Metropolice Force Command");
FACTION.isCombineFaction = true;
FACTION.whitelist = true;
FACTION.material = "halfliferp/factions/mpf";
FACTION.models = {
female = {
"models/humans/combine/female_01.mdl",
"models/humans/combine/female_02.mdl",
"models/humans/combine/female_03.mdl",
"models/humans/combine/female_04.mdl",
"models/humans/combine/female_06.mdl",
"models/humans/combine/female_07.mdl"
},
male = {
"models/humans/combine/male_01.mdl",
"models/humans/combine/male_02.mdl",
"models/humans/combine/male_03.mdl",
"models/humans/combine/male_04.mdl",
"models/humans/combine/male_05.mdl",
"models/humans/combine/male_06.mdl",
"models/humans/combine/male_07.mdl",
"models/humans/combine/male_08.mdl",
"models/humans/combine/male_09.mdl"
};
};
-- Called when a player's name should be assigned for the faction.
function FACTION:GetName(player, character)
return "MPF-Ofc."..Clockwork.kernel:ZeroNumberToDigits(math.random(1, 99999), 5);
end;
-- Called when a player is transferred to the faction.
function FACTION:OnTransferred(player, faction, name)
if (faction.name == FACTION_OTA) then
if (name) then
Clockwork.player:SetName(player, string.gsub(player:QueryCharacter("name"), ".+(%d%d%d%d%d)", "MPF-Ofc.%1"), true);
else
return false, "You need to specify a name as the third argument!";
end;
else
Clockwork.player:SetName( player, self:GetName( player, player:GetCharacter() ) );
end;
if (player:QueryCharacter("gender") == GENDER_MALE) then
player:SetCharacterData("model", self.models.male[1], true);
else
player:SetCharacterData("model", self.models.female[1], true);
end;
end;
FACTION_MPFCMD = FACTION:Register();
And the class file:
Code:
--[[
© 2012 CloudSixteen.com do not share, re-distribute or modify
without permission of its author ([email protected]).
--]]
local CLASS = Clockwork.class:New("Metropolice Officer");
CLASS.color = Color(148, 112, 255, 255);
CLASS.wages = 50;
CLASS.factions = {FACTION_MPFCMD};
CLASS.isDefault = true;
CLASS.wagesName = "Allowance";
CLASS.description = "A metropolice office working as Civil Protection";
CLASS.defaultPhysDesc = "Wearing a neat uniform with a thigh holster.";
CLASS_MPFOFC = CLASS:Register();