sscanf + params
#1

well,
i got this prob.
when i ever use /addban it return me usage message
pawn Код:
if(sscanf(params, "uiss", NAME,IP, TIME, REASON)) return SP COLOR_RED,"USAGE: /addban [name] [ip adress] [Time] [Reason]");
Reply
#2

Show us the entire command
Reply
#3

pawn Код:
new IP[64], TIME[64], REASON[128];
if(sscanf(params, "us[64]s[64]s[128]", NAME,IP, TIME, REASON)) return SP COLOR_RED,"USAGE: /addban [name] [ip adress] [Time] [Reason]");
I dont think IP is an integer
Reply
#4

your 2 string on the sscanf has no size.

it should be like this (i think so? i have been not scripting for 1 week)

pawn Код:
if(sscanf(params, "us[sizeofip]is[sizeofreason]", NAME,IP, TIME, REASON)) return SP COLOR_RED,"USAGE: /addban [name] [ip adress] [Time] [Reason]");
IP must be string not integer. and time must be integer not string.
Reply
#5

Quote:
Originally Posted by V_LOPE
Посмотреть сообщение
well,
i got this prob.
when i ever use /addban it return me usage message
Hmm try this:

pawn Код:
new NAME, IP[16], TIME, REASON[50];
if(sscanf(params, "us[16]ds[50]", NAME,IP, TIME, REASON)) return SendClientMessage( playerid, COLOR_RED,"USAGE: /addban [name] [ip adress] [Time] [Reason]");
Edit: iPad fails in helping xd too slow
Reply
#6

pawn Код:
new NAME,IP[20],TIME[10],REASON[64];//Make lenght accorfing to yours
if(sscanf(params, "us[20]s[10]s[64]", NAME,IP, TIME, REASON)) return SP COLOR_RED,"USAGE: /addban [name] [ip adress] [Time] [Reason]");
Reply
#7

@Roxor: thanks worked.
solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)