SA-MP Forums Archive
sscanf + params - 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: sscanf + params (/showthread.php?tid=367761)



sscanf + params - V_LOPE - 11.08.2012

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]");



Re: sscanf + params - CaRa - 11.08.2012

Show us the entire command


Re: sscanf + params - IceMeteor - 11.08.2012

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


Re: sscanf + params - JaKe Elite - 11.08.2012

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.


Re: sscanf + params - FalconX - 11.08.2012

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


Re: sscanf + params - [MM]RoXoR[FS] - 11.08.2012

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]");



Re: sscanf + params - V_LOPE - 11.08.2012

@Roxor: thanks worked.
solved.