SA-MP Forums Archive
String placeholder - 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: String placeholder (/showthread.php?tid=655678)



String placeholder - DarkMythHunter - 27.06.2018

What string place holder do I use to save gun id and ammo? %s, %f or what?


Re: String placeholder - Exhibit - 27.06.2018

Gun "id". Integer and not a string.


Re: String placeholder - DarkMythHunter - 27.06.2018

Quote:
Originally Posted by Exhibit
Посмотреть сообщение
Gun "id". Integer and not a string.
then for the ammo?


Re: String placeholder - div - 27.06.2018

%f for float(in decimal)

%s for string(mainly text, but can include numbers too "WITH" text)

%i for integer(negative or positive)


Re: String placeholder - div - 27.06.2018

Quote:
Originally Posted by DarkMythHunter
Посмотреть сообщение
then for the ammo?
Are you going to give yourself ammo in FLOAT or STRING??


Of course it's going to be an INTEGER, but i guess, both should work. However, I'm using integer.


Re: String placeholder - GTLS - 27.06.2018

They arent called String holders, they are called format specifiers. Integers are numbers (ranging from -2^31 to +2^31 in PAWN). So if you want to deal with integers, you use %i or integer format specifier. String and float would work to but ultimately, you'll have to covert them to int in order to use. You can display an integer as string using format function.


Re: String placeholder - Exhibit - 27.06.2018

In short use %i or %d


Re: String placeholder - Dayrion - 27.06.2018

You should read that: https://sampwiki.blast.hk/wiki/Format