What's the difference between decimal and integer (%d and %i)?
#1

And how would I get a players name to appear in one of them?
Reply
#2

There's no difference between %d and %i, and you can't put a player name in them, but you can in a %s.
Reply
#3

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
There's no difference between %d and %i, and you can't put a player name in them, but you can in a %s.
How can I format %s to use a players name?
Reply
#4

new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s", name);
SendClientMessage(playerid, 0xFFFFFFFFF, string);

Hope this is what you need
Reply
#5

Quote:
Originally Posted by thimo
Посмотреть сообщение
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s", name);
SendClientMessage(playerid, 0xFFFFFFFFF, string);

Hope this is what you need
Thanks alot man!
+repped
Reply
#6

edit i forgot to use new string[128];
(In this case you could use string[MAX_PLAYER_NAME] Because its only outputting your name. In case of any other values or strings use [128] or any string size that you need)
Reply
#7

%i and %d are exactly the same - which one you use is down to personal preference. I personally prefer %i as i stands for 'integer' (which is what it displays). I don't like %d at all - decimals make me think of floats, and %d doesn't show a float..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)