AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Newbie Question - Could use help though (https://forums.alliedmods.net/showthread.php?t=61076)

I3lade203 09-20-2007 01:36

Newbie Question - Could use help though
 
Hi, this is probably going to sound like an incredibly simple question, mainly because it is one... but i'm still trying to learn my way around everything, so i'd appreciate the help.

Basiclly, what I want to know is how do I print a variable within a string? For example, I want to do something like this:

Code:

show_hudmessage(0, "Class Wars - [Duel Mode] : Attacking" blueclass1 " VS Defending " redclass1 "!" , g_displayMsg)
Where blue and red inbetween the quotation marks are variables that I want printed, so it can show numbers that change but keep the rest of the text static. How would I do this? I know in java I would do "Text" +variable+ "Text" but i'm uncertain of how it works with pawn. Once again, I really appreciate the help. Thanks in advance!

Arkshine 09-20-2007 02:03

Re: Newbie Question - Could use help though
 
Something like. Basicaly, you have to use '%s'.

mystring1 = "blueclass1";
mystring2 = "redclass1";

show_hudmessage(0, "Class Wars - [Duel Mode] : Attacking %s VS Defending %s!" , mystring1, mystring2 );

I3lade203 09-20-2007 10:24

Re: Newbie Question - Could use help though
 
Thanks! Really helped a lot. +Karma.


All times are GMT -4. The time now is 16:14.

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