Invalid Command Lenght
#1

Well, I am working on my friends RP script.
There has suddently appeared an problem. Once you type any command, (over 50 characters) they get the error: "Invalid command length (exceeded 50 characters)", but that is nowhere in the script, how to fix this?
(It uses strcmp)
Reply
#2

Bumping
Reply
#3

Try ur command with ZCMD:

pawn Код:
CMD:yourcmd (playerid, params[])
// your command!
Reply
#4

but zcmd disables strcmp, so I would have to redo all the commands.
I simply do not have nerves to do that, any other solutions to this?
Reply
#5

You have a 50 character command? so an example would be:

PHP код:
CMD:qwertyuiopasdfghjkklzxmasdfghqwertuyizxncmvs1239j(playeridparams[])
{
   return 
1;

Post the code O_O...
Reply
#6

No, I do not have any command that long.
I mean, when I try to type anything (for example: /me (and the params go over 50 characters) I get the error "Invalid command length (exceeded 50 characters)", but I already searched the script, there is nowhere in the whole script anything that would trigger this, I do not have even that message in my script, so could this be caused by SA:MP itself? (server is hosted on server FFS)
Reply
#7

Invalid parameter count. Show the code.
Reply
#8

There is ~3 command that keep doing it (Dont know about other commands)
pawn Код:
if(strcmp(cmd, "/me", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            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, "USAGE: /me [action]");
                return 1;
            }
            if(PlayerInfo[playerid][pMask] == 1)
            {
                format(string, sizeof(string), "* Stranger %s", result);
            }
            else
            {
                format(string, sizeof(string), "* %s %s", sendername, result);
            }
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            if((noooc) && PlayerInfo[playerid][pAdmin] < 3)
            {
                SendClientMessage(playerid, COLOR_GREY, "   The OOC channel has been disabled by an Admin !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[160];
            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, "USAGE: (/o)oc [ooc chat]");
                return 1;
            }
            new atext[60];
            if(PlayerInfo[playerid][pAdmin] == 0){ atext = ""; }
            if(PlayerInfo[playerid][pAdmin] == 1){ atext = ""; }
            if(PlayerInfo[playerid][pAdmin] == 2){ atext = "Junior Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 3){ atext = "General Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 4){ atext = "Senior Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 1337){ atext = "Head Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 99998){ atext = "Server Scripter"; }
            if(PlayerInfo[playerid][pAdmin] == 99999){ atext = "Server Manager"; }
            if(PlayerInfo[playerid][pAdmin] == 100000){ atext = "Community Owner"; }
            format(string, sizeof(string), "(( %s %s: %s ))", atext, sendername, result);
            OOCOff(COLOR_OOC,string);
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            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, "USAGE: /b [local ooc chat]");
                return 1;
            }
            if(PlayerInfo[playerid][pMask] == 1)
            {
                format(string, sizeof(string), "Stranger: (( %s ))", result);
            }
            else
            {
                format(string, sizeof(string), "%s: (( %s ))", sendername, result);
            }
            ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        }
        return 1;
    }
Reply
#9

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
No, I do not have any command that long.
I mean, when I try to type anything (for example: /me (and the params go over 50 characters) I get the error "Invalid command length (exceeded 50 characters)", but I already searched the script, there is nowhere in the whole script anything that would trigger this, I do not have even that message in my script, so could this be caused by SA:MP itself? (server is hosted on server FFS)
That.

Anyways, let's just wait for a reply from his side and not derail the topic too much.
Reply
#10

Quote:
Originally Posted by Max_Coldheart
Посмотреть сообщение
There is ~3 command that keep doing it (Dont know about other commands)
pawn Код:
if(strcmp(cmd, "/me", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            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, "USAGE: /me [action]");
                return 1;
            }
            if(PlayerInfo[playerid][pMask] == 1)
            {
                format(string, sizeof(string), "* Stranger %s", result);
            }
            else
            {
                format(string, sizeof(string), "* %s %s", sendername, result);
            }
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            if((noooc) && PlayerInfo[playerid][pAdmin] < 3)
            {
                SendClientMessage(playerid, COLOR_GREY, "   The OOC channel has been disabled by an Admin !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[160];
            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, "USAGE: (/o)oc [ooc chat]");
                return 1;
            }
            new atext[60];
            if(PlayerInfo[playerid][pAdmin] == 0){ atext = ""; }
            if(PlayerInfo[playerid][pAdmin] == 1){ atext = ""; }
            if(PlayerInfo[playerid][pAdmin] == 2){ atext = "Junior Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 3){ atext = "General Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 4){ atext = "Senior Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 1337){ atext = "Head Admin"; }
            if(PlayerInfo[playerid][pAdmin] == 99998){ atext = "Server Scripter"; }
            if(PlayerInfo[playerid][pAdmin] == 99999){ atext = "Server Manager"; }
            if(PlayerInfo[playerid][pAdmin] == 100000){ atext = "Community Owner"; }
            format(string, sizeof(string), "(( %s %s: %s ))", atext, sendername, result);
            OOCOff(COLOR_OOC,string);
        }
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/b", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            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, "USAGE: /b [local ooc chat]");
                return 1;
            }
            if(PlayerInfo[playerid][pMask] == 1)
            {
                format(string, sizeof(string), "Stranger: (( %s ))", result);
            }
            else
            {
                format(string, sizeof(string), "%s: (( %s ))", sendername, result);
            }
            ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        }
        return 1;
    }
Sorry, but I only see format(sizeof str) blah, blah! Where the hell is the:

pawn Код:
new string [128]
I told u?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)