PDA

View Full Version : Array sizes.


Scarred
01/01/2012, 04:55 AM
What's wrong with this? It goes under OnPlayerText, and is an alternative to commands.

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:

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

[HiC]TheKiller
01/01/2012, 05:00 AM
stock SendMessageToAdministration(color, MinimumLevel, Message[128])


Should be


stock SendMessageToAdministration(color, MinimumLevel, Message[])


Also make sure that 'color' is in hex format, rather than a string.

Scarred
01/01/2012, 05:04 AM
TheKiller;1602513']
stock SendMessageToAdministration(color, MinimumLevel, Message[128])


Should be


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.