[Help]Making a text with %d
#5

Do you even know what %d is for?
It's an placeholder which will insert an integer (whole) number.

Example (integer):
pawn Код:
new string[16], myVariable = 5;
format(string, sizeof(string), "myInteger: %d", myVariable);
SendClientMessage(playerid, 0xFFFFFFAA, string);
This will display "myInteger: 5".

Example (float):
pawn Код:
new string[16], Float:myVariable = 5.0;
format(string, sizeof(string), "myFloat: %f", myVariable);
SendClientMessage(playerid, 0xFFFFFFAA, string);
This will display "myFloat: 5.0".

Example (string):
pawn Код:
new string[24], myVariable[8];
format(myVariable, sizeof(myVariable), "myText");
format(string, sizeof(string), "myString: %s", myVariable);
SendClientMessage(playerid, 0xFFFFFFAA, string);
This will display "myString: MyText".

You can learn more here.
Reply


Messages In This Thread
[Help]Making a text with %d - by Danikov - 20.10.2009, 14:37
Re: [Help]Making a text with %d - by CAR - 20.10.2009, 14:39
Re: [Help]Making a text with %d - by Danikov - 20.10.2009, 14:40
Re: [Help]Making a text with %d - by Danikov - 20.10.2009, 14:44
Re: [Help]Making a text with %d - by Correlli - 20.10.2009, 14:49
Re: [Help]Making a text with %d - by Danikov - 20.10.2009, 14:53
Re: [Help]Making a text with %d - by dice7 - 20.10.2009, 14:55
Re: [Help]Making a text with %d - by Correlli - 20.10.2009, 14:56
Re: [Help]Making a text with %d - by Danikov - 20.10.2009, 15:01
Re: [Help]Making a text with %d - by Correlli - 20.10.2009, 15:08

Forum Jump:


Users browsing this thread: 1 Guest(s)