The following code when I add "HUD:isplay(SuperSlugScoreHUD);" makes my computer freeze until I exit tribes through task manager. Why does it do that? How can I fix that? The other problem is - when I have just capped and go into hud mover and exit - it adds five points to my score. Any ideas on either?
Code:
Include("presto\\HUD.cs");
Include("presto\\event.cs");
function SuperSlugScoreHUD::Create()
{
$SuperSlugScoreHUD::Points = 0;
$SuperSlugScoreHUD::add = 0;
HUD::NewFrame(SuperSlugScoreHUD, SuperSlugScoreHUD::Update, 500, 752, 40, 15);
$SuperSlugScoreHUD::Text = object::getName(HUD::AddObject(SuperSlugScoreHUD, FearGuiFormattedText, 0, 0, 40, 40));
// the following line freezes tribes for some reason
//HUD::Display(SuperSlugScoreHUD);
Control::setValue($SuperSlugScoreHUD::Text, "<JC><F1>Me: <F2>0");
}
function SuperSlugScoreHUD::onClientMessage(%client, %msg)
{
if(String::FindSubStr(%msg, "You captured ") != -1)
{
$SuperSlugScoreHUD::add += 5;
SuperSlugScoreHUD::Update();
}
}
function SuperSlugScoreHUD::onKill(%killer, %victim, %weapon)
{
if(%client)
return;
%me = getManagerID();
if (%victim == %me && %weapon == "Suicide")
{
$SuperSlugScoreHUD::add = -1;
SuperSlugSuperSlugScoreHUD::Update();
}
else if (%killer == %me && %weapon == "Team Kill")
{
$SuperSlugScoreHUD::add = -1;
SuperSlugSuperSlugScoreHUD::Update();
}
else if (%killer == %me)
{
$SuperSlugScoreHUD::add = 1;
SuperSlugScoreHUD::Update();
}
}
function SuperSlugScoreHUD::Update()
{
$SuperSlugScoreHUD::Points += $SuperSlugScoreHUD::add;
Control::setValue($SuperSlugScoreHUD::Text, "<JC><f1>Me:<F2> " @ $SuperSlugScoreHUD::Points);
}
function SuperSlugScoreHUD::Reset()
{
$SuperSlugScoreHUD::Points = 0;
$SuperSlugScoreHUD::add = 0;
Control::setvalue($SuperSlugScoreHUD::Text, "<JC><F1>Me:<F2>0");
}
SuperSlugScoreHUD::Create();
Event::Attach(eventClientMessage, SuperSlugScoreHUD::onClientMessage);
Event::Attach(eventKillTrak, SuperSlugScoreHUD::onKill);
Event::Attach(eventChangeMission, SuperSlugScoreHUD::Reset);