Tabsize strings.
#3

if you want 3 tabs, youll get maybe 24 letters free to use (assuming that a tab is 8 chars using a non proportional font). by subtracting the carname from the "free to use" letters, you get the spaces you want to tabulate. divide those spaces by the tabsize to get the amount of tabs to use...
-create a variable like
Код:
new MaxLetters=24;
new TabSize=8;
new Tabs[][]={"","\t","\t\t","\t\t\t"};
-subtract the carnames' stringlenght from the max-stringlenght
Код:
// instead of "Sultan", use yor VehicleName[] array, h/e its called)
new MissingChars=MaxLetters-strlen("Sultan");
new MissingTabs=MissingChars/TabSize;
for the "Sultan" (lenght 6) you get 18 remaining letters. divide those 18 by 8 (tabsize), youll get 2.
this 2 points to the array MissingTabs[2] (its a "\t\t")..
finally, format the string:
Код:
//you know what to do..
format(string,sizeof(string),"%s%s",VehicleName[VehicleID-400],Tabs[MissingTabs]);
iam using the trick with this settings, the tabsize=8 wont fit each time, since that font is proportional. a space " " or dot "." is smaller than a "X" etc..
Reply


Messages In This Thread
Tabsize strings. - by KaleOtter - 10.01.2011, 17:06
Re: Tabsize strings. - by woot - 10.01.2011, 17:10
Re: Tabsize strings. - by Babul - 10.01.2011, 17:34
Re: Tabsize strings. - by KaleOtter - 10.01.2011, 18:50
Re: Tabsize strings. - by KaleOtter - 10.01.2011, 19:07
Re: Tabsize strings. - by Babul - 10.01.2011, 22:28
Re: Tabsize strings. - by ғαιιοцт - 10.01.2011, 23:26
Re: Tabsize strings. - by Babul - 11.01.2011, 00:47
Re: Tabsize strings. - by Jefff - 11.01.2011, 01:01
Re: Tabsize strings. - by KaleOtter - 11.01.2011, 12:42

Forum Jump:


Users browsing this thread: 2 Guest(s)