Raised This Month: $51 Target: $400
 12% 

How to add "i" to "Format"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 01-26-2010 , 04:30   How to add "i" to "Format"
Reply With Quote #1

Hi, like topic says, I don't know how to add "i" (numbers) to "message" in Format, decl and DrawPanelText.

If someone can help me, I will be grateful ;-)

PHP Code:
PanelMessageDisplay(client
{
    new 
Handle:WelcomePanel CreatePanel(INVALID_HANDLE);
    
    
decl String:message[255];
    
Format(messagesizeof(message), "%T""PanelTitle"LANG_SERVER);
    
SetPanelTitle(WelcomePanelmessage);
    
    new 
i=0
    
new lines GetConVarInt(g_Cvar_MessageLines)
    new 
lines_string IntToString(lines)
    while (++
<= lines) {
        
decl message[255];
        
Format(messagesizeof(message), "%T""PanelLine%i"lines_stringLANG_SERVER);
        
DrawPanelText(WelcomePanelmessage);
    }
    
decl String:closepanel[255];
    
Format(closepanelsizeof(closepanel), "%T""PanelClose"LANG_SERVER);
    
DrawPanelText(WelcomePanelclosepanel);
    
SendPanelToClient(WelcomePanelclientNullMenuHandler60);
    
CloseHandle(WelcomePanel);

__________________
Zuko is offline
Send a message via ICQ to Zuko
Antithasys
Moderator
Join Date: Apr 2008
Old 01-26-2010 , 04:38   Re: How to add "i" to "Format"
Reply With Quote #2

By the looks of it your using translation files and therefore need to create a separate file and load it as a translation.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 01-26-2010 , 04:53   Re: How to add "i" to "Format"
Reply With Quote #3

yes, I have file with phrases.

full code:
http://zuko.ampaste.net/d357fc374

'old' code:
http://forums.alliedmods.net/showthread.php?t=98326
__________________
Zuko is offline
Send a message via ICQ to Zuko
Antithasys
Moderator
Join Date: Apr 2008
Old 01-26-2010 , 04:56   Re: How to add "i" to "Format"
Reply With Quote #4

What are the contents of your translation file?
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 01-26-2010 , 04:57   Re: How to add "i" to "Format"
Reply With Quote #5

translation file:
http://forums.alliedmods.net/attachm...6&d=1250534682
__________________
Zuko is offline
Send a message via ICQ to Zuko
Antithasys
Moderator
Join Date: Apr 2008
Old 01-26-2010 , 05:02   Re: How to add "i" to "Format"
Reply With Quote #6

OK, I see what you're doing.

You can't do it that way. You need to format the string BEFORE you send to to the translation file. Then send the formated string to the translation file.

PHP Code:
new String:sPhrase[32];
Format(sPhrasesizeof(sPhrase), "PanelLine%d"lines_string);
Format(messagesizeof(message), "%T"sPhraseLANG_SERVER); 
EDIT:

I have never done this or tested it, but I do not see why it wouldn't work.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Zuko
SourceMod Donor
Join Date: Sep 2006
Location: Poland
Old 01-26-2010 , 05:06   Re: How to add "i" to "Format"
Reply With Quote #7

ok, thank you
__________________
Zuko is offline
Send a message via ICQ to Zuko
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-26-2010 , 19:31   Re: How to add "i" to "Format"
Reply With Quote #8

Code:
new lines_string = IntToString(lines)
That's not going to compile.


I'm a bit confused by your code, I'm not sure if it's doing what you want it to do.

'lines_string' will be set to how many bytes were written when converting the int to a string.

http://docs.sourcemod.net/api/index....d=show&id=625&
__________________
Greyscale is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode