#1

Код:
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);
Reply
#2

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
{
Reply
#3

still... at both situations...
Reply
#4

edit
Reply
#5

Get rid of that shit.

Go get ZCMD.

For now, however:

pawn Код:
new tmp[128];

//Change the above to:

new tmp[256];
Reply
#6

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

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?
Reply
#8

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
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)