AlliedModders Donor
Join Date: Jun 2016
Location: Antofagasta, Chile
|
11-10-2017
, 22:11
How can i fix this Array index is out of bounds? :/
|
#1
|
Errors:
Code:
L 11/10/2017 - 16:14:56: [SM] Exception reported: Array index is out of bounds
L 11/10/2017 - 16:14:56: [SM] Blaming: skill.smx
L 11/10/2017 - 16:14:56: [SM] Call stack trace:
L 11/10/2017 - 16:14:56: [SM] [1] Line 949, C:\Users\Mot\addons\sourcemod\scripting\skill.sp::Function_GetRank3
L 11/10/2017 - 16:14:56: [SM] [2] Line 999, C:\Users\Mot\addons\sourcemod\scripting\skill.sp::Native_GetChatRank
L 11/10/2017 - 16:14:56: [SM] [4] SB_GetChatRank
L 11/10/2017 - 16:14:56: [SM] [5] Line 349, C:\Users\Mot\custom-chatcolors-csgo.sp::OnChatMessage
L 11/10/2017 - 16:14:56: [SM] [7] Call_Finish
L 11/10/2017 - 16:14:56: [SM] [8] Line 387, C:\Users\anthony\Desktop\JoshOG\Sourcemod\addons\sourcemod\scripting\simple-chatprocessor.sp::OnSayText2
skill.sp Lines
PHP Code:
public void Function_GetRank3(int rank, char[] string, int maxlength)
{
char sRank[64];
Format(sRank, sizeof(sRank), "%s", Ranks[rank][tagRank]); // Line 949
strcopy(string, maxlength, sRank);
}
public int Native_GetChatRank(Handle plugin, int numParams)
{
int client = GetNativeCell(1);
char rank[64], status[8];
GetClientCookie(client, gH_sChatTag, status, sizeof(status));
if (!StrEqual(status, "off", false))
{
Function_GetRank3(Function_GetRankNumber(client), rank, sizeof(rank)); //Line 999
SetNativeString(2, rank, GetNativeCell(3), false);
}
else
{
SetNativeString(2, "", GetNativeCell(3), false);
}
}
custom-chatcolors
PHP Code:
public Action:OnChatMessage(&author, Handle:recipients, String:name[], String:message[]) {
new String:tempString[12];
new String:tagtemp[64];
new tempAuthor = author;
//new String:name[MAXLENGTH_NAME];
//Format(name, sizeof(name), "%s", iname);
//strcopy(name, MAXLENGTH_NAME, iname);
CStrip(name, MAXLENGTH_INPUT);
//new String:message[MAXLENGTH_MESSAGE];
//Format(message, sizeof(message), "%s", imessage);
CStrip(message, MAXLENGTH_MESSAGE);
if(CheckForward(author, message, CCC_NameColor)) {
if(StrEqual(usernameColor[author], "G", false)) {
Format(name, MAXLENGTH_INPUT, "\x04%s", name);
} else if(StrEqual(usernameColor[author], "O", false)) {
Format(name, MAXLENGTH_INPUT, "\x05%s", name);
} else if(strlen(usernameColor[author]) == 6) {
Format(name, MAXLENGTH_INPUT, "\x07%s%s", usernameColor[author], name);
} else if(strlen(usernameColor[author]) == 8) {
Format(name, MAXLENGTH_INPUT, "\x08%s%s", usernameColor[author], name);
} else if(strlen(usernameColor[author]) == 4) {
strcopy(tempString, sizeof(tempString), usernameColor[author]);
if(StrEqual(tempString, "{03}")) {
tempAuthor = -1;
}
CFormat(tempString, sizeof(tempString));
Format(name, MAXLENGTH_INPUT, "%s%s", tempString, name);
} else {
Format(name, MAXLENGTH_INPUT, "\x03%s", name); // team color by default!
}
} else {
Format(name, MAXLENGTH_INPUT, "\x03%s", name); // team color by default!
}
if(CheckForward(author, message, CCC_TagColor)) {
if(strlen(tag[author]) > 0) {
if(StrEqual(tagColor[author], "T", false)) {
Format(name, MAXLENGTH_INPUT, "\x03%s%s", tag[author], name);
} else if(StrEqual(tagColor[author], "G", false)) {
Format(name, MAXLENGTH_INPUT, "\x04%s%s", tag[author], name);
} else if(StrEqual(tagColor[author], "O", false)) {
Format(name, MAXLENGTH_INPUT, "\x05%s%s", tag[author], name);
} else if(strlen(tagColor[author]) == 6) {
Format(name, MAXLENGTH_INPUT, "\x07%s%s%s", tagColor[author], tag[author], name);
} else if(strlen(tagColor[author]) == 8) {
Format(name, MAXLENGTH_INPUT, "\x08%s%s%s", tagColor[author], tag[author], name);
} else if(strlen(tagColor[author]) == 4) {
strcopy(tempString, sizeof(tempString), tagColor[author]);
strcopy(tagtemp, sizeof(tagtemp), tag[author]);
CFormat(tagtemp, sizeof(tagtemp));
if(StrEqual(tempString, "{03}")) {
tempAuthor = -1;
}
CFormat(tempString, sizeof(tempString));
Format(name, MAXLENGTH_INPUT, "%s%s%s", tempString, tagtemp, name);
} else {
Format(name, MAXLENGTH_INPUT, "\x01%s%s", tag[author], name);
}
}
}
if(skillbot)
{
new String:rank[64];
SB_GetChatRank(author, rank, sizeof(rank)); // Line 999
if(strlen(rank) != 0)
{
CFormat(rank, sizeof(rank));
Format(name, MAXLENGTH_INPUT, "%s %s", rank, name);
}
}
new MaxMessageLength = MAXLENGTH_MESSAGE - strlen(name) - 5; // MAXLENGTH_MESSAGE = maximum characters in a chat message, including name. Subtract the characters in the name, and 5 to account for the colon, spaces, and null terminator
if(strlen(chatColor[author]) > 0 && CheckForward(author, message, CCC_ChatColor)) {
if(StrEqual(chatColor[author], "T", false)) {
Format(message, MaxMessageLength, "\x03%s", message);
} else if(StrEqual(chatColor[author], "G", false)) {
Format(message, MaxMessageLength, "\x04%s", message);
} else if(StrEqual(chatColor[author], "O", false)) {
Format(message, MaxMessageLength, "\x05%s", message);
} else if(strlen(chatColor[author]) == 6) {
Format(message, MaxMessageLength, "\x07%s%s", chatColor[author], message);
} else if(strlen(chatColor[author]) == 8) {
Format(message, MaxMessageLength, "\x08%s%s", chatColor[author], message);
} else if(strlen(chatColor[author]) == 4) {
strcopy(tempString, sizeof(tempString), chatColor[author]);
if(StrEqual(tempString, "{03}")) {
tempAuthor = -1;
}
CFormat(tempString, sizeof(tempString));
Format(message, MaxMessageLength, "%s%s", tempString, message);
}
}
decl String:game[64];
GetGameFolderName(game, sizeof(game));
if(StrEqual(game, "csgo")) {
Format(name, MAXLENGTH_NAME, "\x01\x0B %s", name);
}
Call_StartForward(messageForward);
Call_PushCell(author);
Call_PushStringEx(message, MaxMessageLength, SM_PARAM_STRING_UTF8|SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
Call_PushCell(MaxMessageLength);
Call_Finish();
author = tempAuthor;
return Plugin_Changed;
}
The thing is, it's supposed to show a tag when a player has a rank...
__________________
Last edited by Elitcky; 11-15-2017 at 04:37.
|
|