Array sizes.
#1

What's wrong with this? It goes under OnPlayerText, and is an alternative to commands.

pawn Код:
else if(text[0] == '!')
    {
        if(IsAuthorized(playerid, 1))
        {
            new
                aname[24],
                s[158]
            ;
           
            GetPlayerNameEx(playerid, aname, 24);
           
            format(s, sizeof(s), "{DE9210}Admin %s: {FFFFFF}%s", aname, text[1]);
            SendMessageToAdministration(COLOR_WHITE, 1, s);
        }
    }
Error:
Array sizes do not match, or destination array is too small (SendMessageToAdministration(COLOR_WHITE, 1, s);)

SendMessageToAdministration:

pawn Код:
stock SendMessageToAdministration(color, MinimumLevel, Message[128])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(UserInfo[i][Authorization] >= MinimumLevel)
        {
           return SendClientMessage(i, color, Message);
        }
        else return 0;
    }
    return 1;
}
Reply
#2

pawn Код:
stock SendMessageToAdministration(color, MinimumLevel, Message[128])
Should be

pawn Код:
stock SendMessageToAdministration(color, MinimumLevel, Message[])
Also make sure that 'color' is in hex format, rather than a string.
Reply
#3

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
pawn Код:
stock SendMessageToAdministration(color, MinimumLevel, Message[128])
Should be

pawn Код:
stock SendMessageToAdministration(color, MinimumLevel, Message[])
Also make sure that 'color' is in hex format, rather than a string.
Oh wow, I didn't even notice that. Thanks a bunch!

+rep'd.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)