Strings cutting off.
#1

This is really annoying me now.
The string length is fine, it's just constantly cutting off.
Say if I said "Hello there my name is dasdhdashasd", it would say "Hello there my name i"

pawn Код:
command(vip, playerid, params[])
{
    new message[500], string[500];
    if(sscanf(params, "s", message))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /(v)ip [message]");
    }
    else
    {
        if(Player[playerid][VipRank] >= 1)
        {
            if(strlen(message) < 1)
            {
                SendClientMessage(playerid, WHITE, "SYNTAX: /(v)ip [message]");
            }
            else
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnectedEx(i) && Player[i][VipRank] >= 1 && Player[i][ToggedVIP] == 0)
                    {
                        switch(Player[playerid][VipRank]) {
                            case 1: {
                            format(string, sizeof(string), "[V] Bronze VIP %s: %s", GetName(playerid), message);
                            SendClientMessage(i, VIP_BRONZE, string);
                            }
                            case 2: {
                            format(string, sizeof(string), "[V] Silver VIP %s: %s", GetName(playerid), message);
                            SendClientMessage(i, VIP_SILVER, string);
                            }
                            case 3: {
                            format(string, sizeof(string), "[V] Gold VIP %s: %s", GetName(playerid), message);
                            SendClientMessage(i, VIP_GOLD, string);
                            }
                            case 4: {
                            format(string, sizeof(string), "[V] Admin %s: %s", GetName(playerid), message);
                            SendClientMessage(i, VIP_ADMIN, string);
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
Reply
#2

You can't send messages that big, that's why. https://sampwiki.blast.hk/wiki/Limits
Reply
#3

Try 's[500]' instead of 's' in the sscanf part.
Reply
#4

Input is limited to 128 characters, so why on earth is your string 500 cells big?!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)