Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSRequest Plugin/Stock Function


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
for a few days I've been facing a problem, centering the text in hud or text format (it doesn't really matter)

let's say we have this function (taken from ranksystem by oxicrom ( I think it is an edited version but it is a good example ) )
PHP Code:

public eShowHud(id
{
    
set_hudmessage(02552551.00.401.41.40.010.01, -1);
    
    if( 
g_iPlayerLevel[id] > MAXLEVEL 1)
    {
        
ShowSyncHudMsg(idSyncHudRankSystem,"[ Name: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]",
        
szPlayerName[id],
        
g_mPlayerDatag_iPlayerLevelid ] ][ m_szRankName ],
        
g_iPlayerXPid ],
        
g_mPlayerDataMAXLEVEL ][ m_iRankXP ],
        
g_iPlayerLevel[id], MAXLEVEL );
    }
    else 
    {
        
ShowSyncHudMsg(idSyncHudRankSystem,"[ Name: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]",
        
szPlayerName[id],
        
g_mPlayerDatag_iPlayerLevelid ] ][ m_szRankName ],
        
g_iPlayerXPid ],
        
g_mPlayerDatag_iPlayerLevelid ] + ][ m_iRankXP ],
        
g_iPlayerLevel[id], MAXLEVEL );
    }


how could I make a function to calculate the length of the string and then inside `[ ]' to be able to center and align the text? (i.e. add left and right spaces for centering and the brackets should be one under the other)

I have a similar plugin that prints hud messages in about the same way, that's why I gave this example ( it's more beautifully arranged in this example and expresses exactly what I want )

I want a plugin or a stock function.
if there is a rank plugin that centers the text and brackets in the hud, it would be even nicer (I haven't found such a plugin so far)
( mine is similar but contains more information and is not a simple rank system )

I was thinking of a stock function because it is easier for me to manage the centering (it is possible to do the same for other functions as well)

p.s. I didn't know where to post for problems like this, so sorry if I didn't post in the right place

Thanks for your time

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...