SA-MP Forums Archive
Sscanf warning - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Sscanf warning (/showthread.php?tid=276662)



Sscanf warning - sim_sima - 14.08.2011

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.


Re: Sscanf warning - 0_o - 14.08.2011

Link To New Update SSCANF?


Re: Sscanf warning - Hiddos - 14.08.2011

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


Re: Sscanf warning - sim_sima - 14.08.2011

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



Re: Sscanf warning - Scenario - 14.08.2011

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.


Re: Sscanf warning - sim_sima - 14.08.2011

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.


Re: Sscanf warning - Scenario - 14.08.2011

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


Re: Sscanf warning - =WoR=Varth - 15.08.2011

or

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



Re: Sscanf warning - Scenario - 15.08.2011

Actually, you can just do this;

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



Re: Sscanf warning - DRIFT_HUNTER - 15.08.2011

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