Bug with printing a string
#1

So here's the thing i made a few commands that format a message written by the player and sends that message around him or to every player on the server but there's a bug where it doesn't send the whole message or cuts it off. It just return unknown command and prints the message at about idk 20 chars but i set the string at 128 chars so i don't know how to fix this if you can help me i would appreciate it

Here's an example command:
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            new string[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "KORISTI: (/b) [ooc chat]");
                return 1;
            }
            format(string, sizeof(string), "[OOC]%s: (( %s ))", sendername, result);
            ProxDetector(7.0, playerid, string, COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN,COLOR_LIGHTGREEN);
        }
        return 1;
    }
And here's what happens:

http://www.zaslike.com/files/0ezfan40y4um0t0i6ih.png
Reply


Messages In This Thread
Bug with printing a string - by ChrisMorasco - 08.06.2013, 12:34
Re: Bug with printing a string - by Vince - 08.06.2013, 12:42
Re: Bug with printing a string - by ChrisMorasco - 08.06.2013, 12:53
Re: Bug with printing a string - by Vince - 08.06.2013, 13:15
Re: Bug with printing a string - by ChrisMorasco - 09.06.2013, 10:37
Re: Bug with printing a string - by Sinner - 09.06.2013, 10:46
delete - by Omirrow - 09.06.2013, 12:31
Re: Bug with printing a string - by ChrisMorasco - 09.06.2013, 13:20
Re: Bug with printing a string - by Sinner - 09.06.2013, 14:42
Re: Bug with printing a string - by ChrisMorasco - 09.06.2013, 15:13

Forum Jump:


Users browsing this thread: 2 Guest(s)