04-06-2011, 15:52
(This post was last modified: 04-06-2011, 15:53 by 4FunPlayin.)
Either it's magic or I have memory problems, the bar stopped working
init
captureObjectiveArray
and the bar updating:
WHY
init
Code:
init()
{
level.captureBarValue = 0;
}
map = getDvar("mapname");
switch(map)
{
case "mp_array":
thread captureObjectiveArray((-95, 933, 353));
captureObjectiveArray
Code:
captureObjectiveArray(org)
{
level endon("game_ended");
rad = 120;
while(1)
{
for ( i = 0; i < level.players.size; i++ )
{
player = level.players[i];
dis = distance(player.origin, org);
if(dis < rad)
{
if(player.pers["team"] == "axis")
level.captureBarValue++;
else if(player.pers["team"] == "allies")
{
if(level.captureBarValue >= 0)
level.captureBarValue--;
}
wait 1;
}
}
if(level.captureBarValue == 100)
{
thread maps\mp\gametypes\_globallogic::endGame( "axis", "Satellite-C3 was captured" );
}
wait .1;
}
}
and the bar updating:
Code:
updateCustomBar()
{
self endon("disconnect");
v = createPrimaryProgressBar( -300 );
v.bar.horzAlign = "LEFT";
v.bar.vertAlign = "MIDDLE";
v.bar.y = -100;
v.bar.x = -410;
v.y = -100;
v.x = -350;
while(1)
{
v.bar updateBar(level.captureBarValue/100); //even v updateBar(level.captureBarValue/100); fail
v.bar.color=(0,0,1);
wait .1;
}
}
Code:
onPlayerSpawned()
{
self endon("disconnect");
self thread showWelcomeMessage();
self thread updateCustomBar();
for(;;)
{
WHY