Re: [Clockwork]Primary Needs v1.0
It's somewhere in the framework, I'll see if I can find it, One minute.
Edit:
Code:
function Schema:IsCombineFaction(faction)
return (faction == FACTION_MPF or faction == FACTION_OTA);
end;
This should be it, Either that or it's to get if the faction is a combine faction.
Edit2: Oh you meant to get their rank.
Code:
-- A function to check if a player is a Combine rank.
function Schema:IsPlayerCombineRank(player, rank, realRank)
local name = player:Name();
local faction = player:GetFaction();
if (self:IsCombineFaction(faction)) then
if (type(rank) == "table") then
for k, v in ipairs(rank) do
if (self:IsPlayerCombineRank(player, v, realRank)) then
return true;
end;
end;
elseif (rank == "EpU" and !realRank) then
if (string.find(name, "%pSeC%p") or string.find(name, "%pDvL%p")
or string.find(name, "%pEpU%p")) then
return true;
end;
else
return string.find(name, "%p"..rank.."%p");
end;
end;
end;
-- A function to get a player's Combine rank.
function Schema:GetPlayerCombineRank(player)
local faction = player:GetFaction();
if (faction == FACTION_OTA) then
if (self:IsPlayerCombineRank(player, "OWS")) then
return 0;
elseif (self:IsPlayerCombineRank(player, "EOW")) then
return 1;
else
return 2;
end;
elseif (self:IsPlayerCombineRank(player, "RCT")) then
return 0;
elseif (self:IsPlayerCombineRank(player, "04")) then
return 1;
elseif (self:IsPlayerCombineRank(player, "03")) then
return 2;
elseif (self:IsPlayerCombineRank(player, "02")) then
return 3;
elseif (self:IsPlayerCombineRank(player, "01")) then
return 4;
elseif (self:IsPlayerCombineRank(player, "OfC")) then
return 6;
elseif (self:IsPlayerCombineRank(player, "EpU", true)) then
return 7;
elseif (self:IsPlayerCombineRank(player, "DvL")) then
return 8;
elseif (self:IsPlayerCombineRank(player, "SeC")) then
return 9;
elseif (self:IsPlayerCombineRank(player, "SCN")) then
if (!self:IsPlayerCombineRank(player, "SYNTH")) then
return 10;
else
return 11;
end;
else
return 5;
end;
end;
That should be it.