Strlen not getting called(?) - 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: Strlen not getting called(?) (
/showthread.php?tid=411567)
Strlen not getting called(?) -
Riddick94 - 29.01.2013
pawn Код:
new giveplayerid, reason[50];
if(sscanf(params, "ds[50]", giveplayerid, reason))return SendClientMessage(playerid, -1, "Usage:[...]");
{
if(strlen(reason) > 49)
{
For some reason second if statement won't get called. Don't know, maybe it's sscanf2 fault? User of that command should receive a message from strlen and then return to the top.
Re: Strlen not getting called(?) -
Jochemd - 29.01.2013
Tried debugging? Perhaps strlen returns not that what you think it does
Re: Strlen not getting called(?) -
Riddick94 - 29.01.2013
You mean debug inside statement? No, because it should send player a message.
But i've done it now:
Код:
[16:39:28] Before IF: 4
[16:39:28] After IF: 4
[16:39:58] Before IF: 30
[16:39:58] After IF: 30
[16:40:07] Before IF: 45
[16:40:07] After IF: 45
[16:40:18] sscanf warning: String buffer overflow.
[16:40:18] Before IF: 49
[16:40:18] After IF: 49
[16:40:27] sscanf warning: String buffer overflow.
[16:40:27] Before IF: 49
[16:40:27] After IF: 49
Strlen won't go further after 49.
Re: Strlen not getting called(?) -
Riddick94 - 29.01.2013
Quote:
Originally Posted by ******
Of course it won't! How can a string over 49 characters be stored in an array 50 characters big?
|
Fixed, lol.