sscanf2 lenght problem
#1

I have a probelm with sscanf2, if I type "/me oooooooooooooooooooooooooooooooooooooooooooooooooo " then I get only "* Nick_Derlos oooooooooooooooooooooooooooooo"(Maybe counting get messd up but something like that).
My code:
pawn Код:
COMMAND:me(playerid, params[500])
{
    if(SisseLogitud[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Palun logi kхigepealt sisse");
    new paramid[380];
    if(!sscanf(params, "s", paramid))
    {
        if(Mask[playerid] == 0)
        {
            new jutt[128], nimi[MAX_PLAYER_NAME];
            GetPlayerName(playerid, nimi, sizeof(nimi));
            format(jutt, sizeof(jutt), "* %s %s", nimi, paramid);
            ProxDetector(30.0, playerid,jutt,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else if(Mask[playerid] == 1)
        {
            new jutt[128];
            format(jutt, sizeof(jutt), "* Tundmatu %s", paramid);
            ProxDetector(30.0, playerid, jutt,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    else SendClientMessage(playerid,COLOR_GREY, "KASUTA: /me [tegevus]");
    return 1;
}
Whats wrong?

Sorry for my bad English and dont mind the language..
Reply
#2

You don't need paramid as 380, since the max output is 128. Anyways, do it like this:
pawn Код:
if(!sscanf(params, "s[thesizeoftheparam]", paramid)
which in your case means "s[380]".
Reply
#3

pawn Код:
COMMAND:me(playerid, params[500])
//to
COMMAND:me(playerid, params[])

if(!sscanf(params, "s", paramid))
//to
if(!sscanf(params, "s[380]", paramid))
Max client message is 128, you have to split that later
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)