SA-MP Forums Archive
What's the difference between decimal and integer (%d and %i)? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's the difference between decimal and integer (%d and %i)? (/showthread.php?tid=448558)



What's the difference between decimal and integer (%d and %i)? - Grooty - 04.07.2013

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


Re: What's the difference between decimal and integer (%d and %i)? - IstuntmanI - 04.07.2013

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


Re: What's the difference between decimal and integer (%d and %i)? - Grooty - 04.07.2013

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?


Re: What's the difference between decimal and integer (%d and %i)? - thimo - 04.07.2013

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


Re: What's the difference between decimal and integer (%d and %i)? - Grooty - 04.07.2013

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


Re: What's the difference between decimal and integer (%d and %i)? - thimo - 04.07.2013

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)


Re: What's the difference between decimal and integer (%d and %i)? - MP2 - 04.07.2013

%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..