RSSy MYGO.pl Opublikowano Listopad 10, 2023 o 10:12 RSSy Udostępnij Opublikowano Listopad 10, 2023 o 10:12 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(0, 255, 255, 1.0, 0.4, 0, 1.4, 1.4, 0.01, 0.01, -1); if( g_iPlayerLevel[id] > MAXLEVEL - 1) { ShowSyncHudMsg(id, SyncHudRankSystem,"[ Name: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]", szPlayerName[id], g_mPlayerData[ g_iPlayerLevel[ id ] ][ m_szRankName ], g_iPlayerXP[ id ], g_mPlayerData[ MAXLEVEL ][ m_iRankXP ], g_iPlayerLevel[id], MAXLEVEL ); } else { ShowSyncHudMsg(id, SyncHudRankSystem,"[ Name: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]", szPlayerName[id], g_mPlayerData[ g_iPlayerLevel[ id ] ][ m_szRankName ], g_iPlayerXP[ id ], g_mPlayerData[ g_iPlayerLevel[ id ] + 1 ][ 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 Więcej opcji udostępniania...
Rekomendowane odpowiedzi