SA-MP Forums Archive
Array sizes. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Array sizes. (/showthread.php?tid=307782)



Array sizes. - Scarred - 01.01.2012

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;
}



Re: Array sizes. - [HiC]TheKiller - 01.01.2012

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.


Re: Array sizes. - Scarred - 01.01.2012

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.