Strlen not getting called(?)
#1

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.
Reply
#2

Tried debugging? Perhaps strlen returns not that what you think it does
Reply
#3

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.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)