(Posted this anyway because I was typing before kurozael replied)
With all this information, you should just go ahead and build a plugin.
Never edit the framework.
Kurchio Saves The Day Kruzel replied before I was done typing.
Look at this Clockwork hook:
Code:
-- Called when the progress bar info is needed.
function Clockwork:GetProgressBarInfo()
local action, percentage = self.player:GetAction(self.Client, true);
if (!self.Client:Alive() and action == "spawn") then
return {text = "You will be respawned shortly.", percentage = percentage, flash = percentage < 10};
end;
if (!self.Client:IsRagdolled()) then
if (action == "lock") then
return {text = "The entity is being locked.", percentage = percentage, flash = percentage < 10};
elseif (action == "unlock") then
return {text = "The entity is being unlocked.", percentage = percentage, flash = percentage < 10};
end;
elseif (action == "unragdoll") then
if (self.Client:GetRagdollState() == RAGDOLL_FALLENOVER) then
return {text = "You are regaining stability.", percentage = percentage, flash = percentage < 10};
else
return {text = "You are regaining conciousness.", percentage = percentage, flash = percentage < 10};
end;
elseif (self.Client:GetRagdollState() == RAGDOLL_FALLENOVER) then
local fallenOver = self.Client:GetSharedVar("FallenOver");
if (fallenOver and self.plugin:Call("PlayerCanGetUp")) then
return {text = "Press 'jump' to get up.", percentage = 100};
end;
end;
end;
Now take a look at this:
Code:
Clockwork.player:SetAction(player, action, duration, priority, Callback)
player is the player whose action needs to be set.
action is the name of the action
duration is how long the action lasts
priority is the priority of the action, it's a number. It determines if the old action can be overridden.
Callback is the function ran when the action ends.
Example Code:
On the server, anywhere
Code:
Clockwork.player:SetAction(player, "dinosaur", 10);
Inside the hook
Code:
local action, percentage = self.player:GetAction(self.Client, true);
if (!self.Client:Alive() and action == "dinosaur") then
return {text = "Your character is walking the dinosaur.", percentage = percentage, flash = percentage < 10};
end;
A little overview on GetAction.
Code:
Clockwork.player:GetAction(player, percentage)
player is the player whose action should be retrieved.
percentage is a boolean (true, false) value, if true, it will return the action name and the percentage of the current action. If false, it will return the action name, the duration of the action, and when the action started.
Explaining the hook:
The hook must return a table at all times, Clockwork will then build a progressbar based on the table.
It usually contains the text, the percentage, and if the progressbar should flash. (In this case "percentage < 10", will be replaced by true if percentage is less than 10, otherwise it's false.)
I've never seen the progressbar actually flashing, but the way the code seems to be, it should start flashing white.
It is also possible to specify a color, so that the progressbar has a different color than the standard one.
Code:
return {text = "Red Colored Progressbar", percentage = percentage, flash = false, color = Color(255, 0, 0, 255)}