Sscanf
#1

So there is a strange bug in my server and i think its because of sscanf.

Here is the bug admin commands dont work ids bigger then 7.I want to learn if my parameters are correct.

pawn Код:
else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, RED, "Usage: /warn [id/name][reason]");
Please this is causing major problems in server.
Reply
#2

s parameter should contain the string size, for example:

pawn Код:
new reason[32];
else if(sscanf(params, "us[32]", id, reason)) SendClientMessage(playerid, RED, "Usage: /warn [id/name] [reason]");
Reply
#3

You sure it will fix it?
Reply
#4

Quote:
Originally Posted by lordturhan
Посмотреть сообщение
You sure it will fix it?
I don't see any other flaw at that line you gave me.
The problem might be in another line.
I just generally said that the 's' parameter should contain the string size.
Reply
#5

32 may be a little short, this is from the warn-command I am using at the moment:

pawn Код:
new Target,  Reason[ 64 ], sz_msg[ 128 ];
    if( sscanf( params, "rs[64]", Target, Reason ) ) return SendClientMessage( playerid, COLOR_LIGHTBLUE, "USAGE: /warn [playerid] [reason]" );

Hope I could help!
Reply
#6

iam sure you are not using th latst update (7). grab the download, and recompile ALL scripts running with the new include.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)