String placeholder
#1

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

Gun "id". Integer and not a string.
Reply
#3

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

%f for float(in decimal)

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

%i for integer(negative or positive)
Reply
#5

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.
Reply
#6

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.
Reply
#7

In short use %i or %d
Reply
#8

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


Forum Jump:


Users browsing this thread: 2 Guest(s)