RSSy MYGO.pl Opublikowano Czerwiec 8, 2024 o 20:02 RSSy Udostępnij Opublikowano Czerwiec 8, 2024 o 20:02 Hello everyone. I made a stock which it can show colored messages to clients. Example of Using: Code: zp_colored_print(0, "!y This is red text") zp_colored_print(0, "!t This is blue text") zp_colored_print(0, "!d This is spectator color text") zp_colored_print(0, "!g And this is green text") But it gives error. "Index out of bounding" Can anyone help me please? Code: new const teams[][] = {"", "TERRORIST", "CT", "SPECTATOR"} // Stock: Colored Print stock colored_print(index, const text[], any:...) { new msg[128], main_team, team[32] vformat(msg, charsmax(msg), text, 3) if (containi(msg, "!t") != -1) team = "CT" else if (containi(msg, "!y") != -1) team = "TERRORIST" else if (containi(msg, "!d") != -1) team = "SPECTATOR" else team = "DEFAULT" replace_all(msg, charsmax(msg), "!g", "^x04") replace_all(msg, charsmax(msg), "!n", "^x01") replace_all(msg, charsmax(msg), "!t", "^x03") replace_all(msg, charsmax(msg), "!y", "^x03") replace_all(msg, charsmax(msg), "!d", "^x03") if (index == 0) { for (new id = -1; id <= get_maxplayers(); id++) { if (is_user_connected(id)) { main_team = get_user_team(id) color_selection(id, MSG_ONE, team) show_color_message(id, MSG_ONE, msg) team_info(id, MSG_ONE, teams[main_team]) } } } else { if (index < 0 || index > get_maxplayers()) return if (is_user_connected(index)) { main_team = get_user_team(index) color_selection(index, MSG_ONE, team) show_color_message(index, MSG_ONE, msg) team_info(index, MSG_ONE, teams[main_team]) } } } // Stock: Color Selection stock color_selection(index, msg_type, color_type[]) { if (containi(color_type, "CT") != -1) return team_info(index, msg_type, teams[2]) else if (containi(color_type, "TERRORIST") != -1) return team_info(index, msg_type, teams[1]) else if (containi(color_type, "SPECTATOR") != -1) return team_info(index, msg_type, teams[3]) return 0 } // Stock: Show Color Message stock show_color_message(id, type, message[]) { new bool:saytext_used, get_user_msgid_saytext if (!saytext_used) { get_user_msgid_saytext = get_user_msgid("SayText") saytext_used = true } message_begin(type, get_user_msgid_saytext, _, id) write_byte(id) write_string(message) message_end() } // Stock: Team Info stock team_info(id, type, team[]) { new bool:teaminfo_used, get_user_msgid_teaminfo if (!teaminfo_used) { get_user_msgid_teaminfo = get_user_msgid("TeamInfo") teaminfo_used = true } message_begin(type, get_user_msgid_teaminfo, _, id) write_byte(id) write_string(team) message_end() return 1 } Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi