SA-MP Forums Archive
Error - 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: Error (/showthread.php?tid=331043)



Error - 963852741 - 03.04.2012

Код:
C:\Users\Bar\Desktop\Updated mode\gamemodes\RP.pwn(370) : error 047: array sizes do not match, or destination array is too small
CMD:
pawn Код:
if(strcmp(cmd, "/low", true) == 0)
        {
        if(IsPlayerConnected(playerid))
        {
            new tmp[128];
            tmp = strtok(cmdtext, idx);
            if(strlen(tmp) == 0)
            {
                SendClientMessage(playerid,COLOR_WHITE,"(USAGE) /low [sentence]");
            }
            GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
            format(str,sizeof(str),"%s [low]: %s",giveplayer, str);
            ProxDetector(5.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
        }
        return 1;
        }
Line error:
pawn Код:
tmp = strtok(cmdtext, idx);



Re: Error - sjvt - 03.04.2012

pawn Код:
if(strcmp(cmd, "/low", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
        if(strlen(tmp) == 0)
        {
            SendClientMessage(playerid,COLOR_WHITE,"(USAGE) /low [sentence]");
        }
        else
        {
            GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
            format(str,sizeof(str),"%s [low]: %s",giveplayer, str);
            ProxDetector(5.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
        }
    }
    return 1;
}
If it doesn't work delete then
pawn Код:
else
{



Re: Error - 963852741 - 03.04.2012

still... at both situations...


Re: Error - sjvt - 03.04.2012

edit


Re: Error - Rob_Maate - 03.04.2012

Get rid of that shit.

Go get ZCMD.

For now, however:

pawn Код:
new tmp[128];

//Change the above to:

new tmp[256];



Re: Error - sjvt - 03.04.2012

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
Get rid of that shit.

Go get ZCMD.

For now, however:

pawn Код:
new tmp[128];

//Change the above to:

new tmp[256];
Dont use 256


Re: Error - blank. - 03.04.2012

Quote:
Originally Posted by Rob_Maate
Посмотреть сообщение
Get rid of that shit.

Go get ZCMD.

For now, however:

pawn Код:
new tmp[128];

//Change the above to:

new tmp[256];
Why would you need to set it to 256 when the maximum string that can be sent is 128?


Re: Error - sjvt - 03.04.2012

pawn Код:
if(strcmp(cmd, "/low", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid,COLOR_WHITE,"(USAGE) /low [sentence]");
            return 1;
        }
        GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
        format(str,sizeof(str),"%s [low]: %s",giveplayer, str);
        ProxDetector(5.0, playerid, str, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
    }
    return 1;
}
This should work i think, i don't use strcmp


Re: Error - 963852741 - 03.04.2012

nothing is working.
and when I'm trying to tmp[256], it says Unknown Command.


Re: Error - Rob_Maate - 04.04.2012

Q_Q honestly.

Yes, the maximum string-size for a SA-MP sever is 128.

That doesn't mean in any capacity that the version of strtok that this person is is using will attempt to parse a variable with a size greater than 128. It's a common error, usually due to miscoding in includes that contain strtok.

The error you are recieving (Unknown Command) means the script is halting during the command. This often represents an infinite loop.

Can you please post your strtok code?