SA-MP Forums Archive
Count++ problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Count++ problem (/showthread.php?tid=567479)



Count++ problem - Nabster - 14.03.2015

Well it shows wrong values in textdraw

Code:
forward CountBar(playerid);
public CountBar(playerid)
{
	new string[5];
	BarCount++;
	SetPlayerProgressBarValue(playerid, Bar, BarCount);
	format(string,sizeof(string),"%i",BarCount);
    PlayerTextDrawSetString(playerid,Capture[playerid],string);
	return 1;
}



Re: Count++ problem - Luis- - 14.03.2015

What values is it showing, an what values is it meant to show?


Re: Count++ problem - Smileys - 14.03.2015

What values does it give?

What is the default value?

Why did you make a PLAYER progress bar without using [playerid]?("bar" is your's, should be "bar[playerid]" or something like that).


Re: Count++ problem - Nabster - 14.03.2015

Timer[playerid][CAPZONE] = SetTimerEx("CAPZONETimer", 30000, false,"i",playerid);
CountBarTimer = SetTimerEx("CountBar", 1000, true, "i", playerid);

stock CAPZONECaptured(playerid)
{

GangZoneCaptured[playerid][CAPZONE] = 1;
UnderAttack[CAPZONE] = 0;
KillTimer(Timer[playerid][CAPZONE]);
KillTimer(CountBarTimer);

Its a timer and its stops when 30 secs are completed,it should show 1 to 30 and default value is 0 but its showing values like 1042040 etc and about that playerid thing i am using progressbar2 by southclaw so it uses per player bars


Re: Count++ problem - Smileys - 14.03.2015

What I would do is run the CountBar timer only, run it every 1 sec just like you do now, make a check inside the timer that checks if the BarCount = 30, if it is, you kill the timer and do the stuff the 30s timer does now.

as for the playerprogressbar2, I've noticed you use that, still you should use per-player variables, as it'll mess up with the variables as soon as 2 players are capturing a zone.


Re: Count++ problem - Nabster - 14.03.2015

You don't understand me i am just using 1 zone for learning i know it will bug if 2 players are capturing 2 zones but i am just making 1 zone to learn making bars etc and my problem is not zone related its count related what i mean is it shows wrong value in textdraw it should count from 1 to 30 seconds if player is capturing but it is showing numbers like 104240 140243 etc,thats my problem