SA-MP Forums Archive
Need help race counter... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help race counter... (/showthread.php?tid=87833)



Need help race counter... - robanswe - 22.07.2009

Some problem whits writing out decimal in a textdraw.. I have made a drag race counter but it only show the whole seconds and not the comma. Example instead of 10.6 it's show 10 only-_- Here is the code:

Код:
new Float:precord[MAX_PLAYERS];
public timerrec()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	if(IsPlayerConnected(i))
	{
	if(inrace[i] == 2)
	{
	precord[i] = precord[i] + 0.1;
    TextDrawHideForPlayer(i,Textdrawbomb[i]);
    format(strnh, sizeof(strnh), "Time:%d",floatround(precord[i]));
    TextDrawSetString(Textdrawbomb[i],strnh);
    TextDrawShowForPlayer(i,Textdrawbomb[i]);
	}
	}
	}
	return 1;
}



Re: Need help race counter... - robanswe - 22.07.2009

*Bump* More info added and wtf only 3 Views? I relly need help pls anyone?


Re: Need help race counter... - mprofitt - 22.07.2009

Quote:
Originally Posted by Roban[swe
]
Some problem whits writing out decimal in a textdraw.. I have made a drag race counter but it only show the whole seconds and not the comma. Example instead of 10.6 it's show 10 only-_- Here is the code:

Код:
new Float:precord[MAX_PLAYERS];
public timerrec()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	if(IsPlayerConnected(i))
	{
	if(inrace[i] == 2)
	{
	precord[i] = precord[i] + 0.1;
    TextDrawHideForPlayer(i,Textdrawbomb[i]);
    format(strnh, sizeof(strnh), "Time:%d",floatround(precord[i]));
    TextDrawSetString(Textdrawbomb[i],strnh);
    TextDrawShowForPlayer(i,Textdrawbomb[i]);
	}
	}
	}
	return 1;
}
Try this....

Код:
 format(strnh, sizeof(strnh), "Time:%f",floatround(precord[i]));



Re: Need help race counter... - robanswe - 22.07.2009

Quote:
Originally Posted by mprofitt
Quote:
Originally Posted by Roban[swe
]
Some problem whits writing out decimal in a textdraw.. I have made a drag race counter but it only show the whole seconds and not the comma. Example instead of 10.6 it's show 10 only-_- Here is the code:

Код:
new Float:precord[MAX_PLAYERS];
public timerrec()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	if(IsPlayerConnected(i))
	{
	if(inrace[i] == 2)
	{
	precord[i] = precord[i] + 0.1;
    TextDrawHideForPlayer(i,Textdrawbomb[i]);
    format(strnh, sizeof(strnh), "Time:%d",floatround(precord[i]));
    TextDrawSetString(Textdrawbomb[i],strnh);
    TextDrawShowForPlayer(i,Textdrawbomb[i]);
	}
	}
	}
	return 1;
}
Try this....

Код:
 format(strnh, sizeof(strnh), "Time:%f",floatround(precord[i]));
Tanks it's works but it stands 10:500009 insted of 10.5 how to fix this?