10.01.2011, 17:34
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
-subtract the carnames' stringlenght from the max-stringlenght
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:
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..
-create a variable like
Код:
new MaxLetters=24; new TabSize=8; new Tabs[][]={"","\t","\t\t","\t\t\t"};
Код:
// instead of "Sultan", use yor VehicleName[] array, h/e its called) new MissingChars=MaxLetters-strlen("Sultan"); new MissingTabs=MissingChars/TabSize;
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]);