sscanf question
#2

Quote:
Originally Posted by GospodinX
Посмотреть сообщение
Is there possible to do that player can enter more value but it's not necessarily.

For example if i enter
/veh 411 he will spawn Car ID 411 for me,with 0,0 colors.But if I enter /veh 411 1 1 ,he will give me Car ID 411 ,with 1,1 colors..


When I do this:

Код:
if(sscanf(params, "iii", veh, col1,col2))
He MUST enter 3 variables,but i don't know how to make that he can enter only one variable and it will work.

Thanks
Yes is it possible. You have to use i majuscule 'I(DEFAULT VALUE)'.
PHP код:
sscanf(params"iI(0)I(0)"vehcol1,col2
Taken from original post:
Quote:

For quick reference, here is a list of ALL the specifiers and their use:

Код:
Format					Use
L(true/false)				Optional logical truthity
l					Logical truthity
K<callback>(any format number)	        Optional custom operator
k<callback>				Custom operator
B(binary)				Optional binary number
b					Binary number
N(any format number)			Optional number
n					Number
C(character)				Optional character
c					Character
I(integer)				Optional integer
i					Integer
D(integer)				Optional integer
d					Integer
H(hex value)				Optional hex number
h					Hex number
O(octal value)				Optional octal value
o					Octal value
F(float)				Optional floating point number
f					Floating point number
G(float/INFINITY/-INFINITY/NAN/NAN_E)	Optional float with IEEE definitions
g					Float with IEEE definitions
{					Open quiet section
}					Close quiet section
P<delimiters>				Multiple delimiters change
p<delimiter>				Delimiter change
Z(string)[length]			Invalid optional string
z(string)[length]			Deprecated optional string
S(string)[length]			Optional string
s[length]				String
U(any format number)			Optional user (bot/player)
u					User (bot/player)
Q(any format number)			Optional bot (bot)
q					Bot (bot)
R(any format number)			Optional player (player)
r					Player (player)
A<type>(default)[length]		Optional array of given type
a<type>[length]				Array of given type
E<specification>(default)		Optional enumeration of given layout
e<specification>			Enumeration of given layout
'string'				Search string
%					Deprecated optional specifier prefix
?					Local options specifier
Reply


Messages In This Thread
sscanf question - by GospodinX - 10.05.2018, 08:37
Re: sscanf question - by Dayrion - 10.05.2018, 09:03
Re: sscanf question - by GospodinX - 10.05.2018, 09:35

Forum Jump:


Users browsing this thread: 1 Guest(s)