Sscanf warning
#1

Hey guys. I have a gamemode using sscanf. Everything works fine, but i got this in my server_log.txt:
Код:
[21:07:39] sscanf warning: String buffer overflow.
The server didn't crash, and all sscanf commands works fine, but i want to know what it is.

Hope someone can tell me. Thanks.
Reply
#2

Link To New Update SSCANF?
Reply
#3

I thought it meant that the actual string size is smaller than the size you indicated? Showing the sscanf line might help as well.
Reply
#4

Here is the line:
pawn Код:
if(sscanf(params, "s[5]", params[0])) return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /duty <on/off>");
Reply
#5

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
Here is the line:
pawn Код:
if(sscanf(params, "s[5]", params[0])) return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /duty <on/off>");
I don't think you can use "params[0]." Create your own 5-cell variable and use it there.
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I don't think you can use "params[0]." Create your own 5-cell variable and use it there.
Like? Can you give me an example?
Cus the command works just fine, but it gives me this warning.
Reply
#7

pawn Код:
new szParams[5];
if(sscanf(params, "s[5]", szParams)) return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /duty <on/off>");
There you go.
Reply
#8

or

pawn Код:
if(sscanf(params, "s[129]",params)) return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /duty <on/off>");
Reply
#9

Actually, you can just do this;

pawn Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /duty <on/off>");
Reply
#10

pawn Код:
if(params[0] == 'o' && params[1] == 'n')
{
//Its ON (on352241 will also match)
}
else if(params[0] == 'o' && params[1] == 'f' && params[2] == 'f')
{
//Its OFF (off25151 will also match)
}
else return SendClientMessage(playerid, COLOR_SYSTEMRED, "USAGE: /duty <on/off>");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)