Witam chodzi o przerobienie tego pluginu, mianowicie plugin gdy piszemy na say pokazuje prefix rangi którą mamy wygląda to tak:
NowyKAt Break.tm: siemka mordki
A chciałbym by to wyglądało tak:
[->NowyKat<-] Break.TM: siemka mordki
/* ----------------------------------------- Credits: Only for Raulitop, for the hook say :3 Version With Saved NFVAULT ------------------------------- */ #include <amxmisc> #include <fakemeta> #include <nfvault> new const PLUGIN[] = "Ranges CS:GO" #define VERSION "1.0" new const AUTHOR[] = "kikizon" /* ============================================= |= [START MODIFIED SECTION] =| ==============================================*/ /* ==================================== *[CONST]* =====================================*/ new const Prefix[] = "!g[RANK]!y" // Prefix in say new const Sonido[] = "rango/up.wav" // Sound Range UP /* ==================================== *[CONST NAMES OF RANGES]* =====================================*/ enum _:DATA { NAMES[30], FRAGS } new const Ranges[][DATA] = { { "Nowy kat", 10 }, { "Silver I", 20 }, { "Silver II", 30 }, { "Silver III", 50 }, { "Silver IV", 70 }, { "Silver Elite", 80 }, { "Silver Elite Master", 90 }, { "Gold NovaI", 100 }, { "Gold Nova II", 120 }, { "Gold Nova III", 130 }, { "Gold Nova Master", 140 }, { "Master Guardian I",150 }, { "Master Guardian II", 170 }, { "Master Guardian Elite", 180 }, { "Distinguished Master Guardian", 190 }, { "Legendary Eagle", 200 }, { "Legendary Eagle Master", 210 }, { "Supreme Master First Class", 220 }, { "The Global Elite", 250 } } /* ============================================= |= [END MODIFIED SECTION] =| ==============================================*/ /* ==================================== *[VARIABLES]* =====================================*/ new g_range[33], g_frags[33] new SyncHUD, g_maxplayers, g_msgTeamInfo, g_msgSayText, g_playername[33][32]; #define TASK_HUD 2100 #define ID_HUD (taskid - TASK_HUD) #define XD is_user_connected(id) || !is_user_bot(id) || !is_user_hltv(id) new VaultRanges[128], szRanges[180], szKey[30] /* ==================================== *[Cvars]* =====================================*/ new cvar_Hud, cvar_knifex2, cvar_hsx2 /* ==================================== *[INIT]* =====================================*/ public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("DeathMsg", "Event_DeathMsg", "a") register_logevent("logevent_round_end", 2, "1=Round_End") register_clcmd("say", "message_saytext") register_clcmd("say_team", "message_sayteam") /* ============================================= |= [START MODIFIED SECTION] =| ==============================================*/ cvar_Hud = register_cvar("ranges_hud", "1") // 1 - Show HUD | 0 - No Show cvar_knifex2 = register_cvar("ranges_knifex2", "0") // 1 - x2 frags with knife | 0 - NO :v cvar_hsx2 = register_cvar("ranges_hsx2", "1") // 1 - x2 HeadShot Frags | 0 - NO :v /* ============================================= |= [END MODIFIED SECTION] =| ==============================================*/ SyncHUD = CreateHudSyncObj() g_maxplayers = get_maxplayers() g_msgTeamInfo = get_user_msgid("TeamInfo") g_msgSayText = get_user_msgid("SayText") nfv_file("Ranges", VaultRanges, charsmax(VaultRanges)) } /* ==================================== *[PRECACHE]* =====================================*/ public plugin_precache() precache_sound(Sonido) /* =================================== *[HUD]* =====================================*/ public HUD(taskid) { new id = ID_HUD if (!is_user_alive(id)) { id = pev(id, pev_iuser2) if (!is_user_alive(id)) return; } if(id != ID_HUD) { set_hudmessage(0, 150, 255, 0.01, 0.15, 0, 0.1, 3.0, 0.01, 2.0, 3) ShowSyncHudMsg(ID_HUD, SyncHUD, "Zabojstwa: %d || Ranga: %s", g_frags[id], Ranges[g_range[id]][NAMES]) } else { set_hudmessage(0, 150, 255, 0.01, 0.15, 0, 0.1, 3.0, 0.01, 2.0, 3) ShowSyncHudMsg(ID_HUD, SyncHUD, "=======================^nForum serwera:www.Katujemy.eu^nSklep 24/7: /sklepsms^n=======================^nZabojstwa: %d^nTwoja ranga: %s^n=======================^nNastepna ranga: %s^nPotrzebnych fragow: %d^n=======================^n%s", g_frags[id], Ranges[g_range[id]][NAMES], Ranges[g_range[id]+1][NAMES], Ranges[g_range[id]][FRAGS] - g_frags[id]) } } /* ================================== [PUTINSERVER] ===================================*/ public client_putinserver(id) { get_user_name( id, g_playername[ id ], charsmax( g_playername[ ] ) ); g_range[id] = 0 g_frags[id] = 0 load(id) if(get_pcvar_num(cvar_Hud)) set_task(1.0, "HUD", id+TASK_HUD, _, _, "b") } /* ================================== [DISCONNECT] ===================================*/ public client_disconnect(id) { if(XD) Save(id); remove_task(id+TASK_HUD) } /* ================================== [ROUND END] ===================================*/ public logevent_round_end() { for(new id = 1; id <= g_maxplayers; id++) { if(XD) Save(id); } } /* ================================== [DEATHMSG] ===================================*/ public Event_DeathMsg() { new attacker = read_data(1) new victim = read_data(2) new hs = read_data(3) new weaponid = get_user_weapon(attacker) if(victim == attacker) return; if(is_user_alive(attacker)) { g_frags[attacker]++ if(get_pcvar_num(cvar_knifex2)) { if(weaponid == CSW_KNIFE) g_frags[attacker]++ } if(get_pcvar_num(cvar_hsx2)) { if(hs) g_frags[attacker]++ } IncreaseRanges(attacker) } } /* ================================ [UPDATE RANK] =================================*/ IncreaseRanges(id) { new Increase = false while(g_frags[id] >= Ranges[g_range[id]][FRAGS]) { Increase = true g_range[id]++ } if(Increase) { chatcolor(id, "%s Gratulacje Graczu, awansowales na nowa range: !g[ %s ]", Prefix, Ranges[g_range[id]][NAMES]) client_cmd(id, "spk %s", Sonido) Increase = false } } /*===================================== *[SAY]* =====================================*/ public message_saytext(id) { static said[192] read_args(said, charsmax(said)) remove_quotes(said) if (said[0] == '@' || said[0] == '%' || said[0] == '/' || said[0] == '.' || said[0] == '!' || equal (said, "")) return PLUGIN_HANDLED if (!ValidMessage(said, 1)) return PLUGIN_CONTINUE; static color[11], name[32], alive[11] get_user_team(id,color,charsmax(color)) get_user_name(id,name,charsmax(name)) if (is_user_alive (id)) { alive = "" } else { alive = "[Dead]" } if (is_user_admin(id)) { if (get_user_flags(id) & ADMIN_KICK) format(said, charsmax(said), "^x01%s^x04%s ^x03%s ^x04: %s", alive, Ranges[g_range[id]][NAMES], name, said) } else { format(said, charsmax(said), "^x01%s^04%s ^x03%s ^x01: %s", alive, Ranges[g_range[id]][NAMES], name, said) } static i, team[11] for (i = 1; i <= g_maxplayers; i++) { if (!is_user_connected(i)) continue get_user_name(id,name,charsmax(name)) if (is_user_admin(i) || is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) { get_user_team(i, team, charsmax(team)) changeTeamInfo(i, color) writeMessage(i, said) changeTeamInfo(i, team) } } return PLUGIN_HANDLED_MAIN; } public message_sayteam(id) { static said[192] read_args(said, charsmax(said)) remove_quotes(said) if (said[0] == '@' || said[0] == '%' || said[0] == '/' || said[0] == '.' || said[0] == '!' || equal (said, "")) return PLUGIN_HANDLED if (!ValidMessage(said, 1)) return PLUGIN_CONTINUE; static playerTeam, playerTeamName[19] playerTeam = get_user_team(id) switch (playerTeam) { case 1: copy (playerTeamName, 6, "TE") case 2: copy (playerTeamName, 8, "CT") default: copy (playerTeamName, 11, "SPEC") } static color[11], name[32], alive[11] get_user_team(id,color,charsmax(color)) get_user_name(id,name,charsmax(name)) if (is_user_alive (id)) { alive = "" } else { alive = "[Dead]" } if (is_user_admin(id)) { if (get_user_flags(id) & ADMIN_RCON) format(said, charsmax(said), "^x01%s [ %s ] ^x04%s ^x03%s ^x04: %s", alive, playerTeam, Ranges[g_range[id]], name, said) } else { format(said, charsmax(said), "^x01%s [ %s ] ^04%s ^x03%s ^x01: %s", alive, playerTeam, Ranges[g_range[id]],name, said) } static i, team[11] for (i = 1; i <= g_maxplayers; i++) { if (!is_user_connected(i)) continue; get_user_name(id,name,charsmax(name)) if (get_user_team(i) == playerTeam || is_user_admin(i)) { if (is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) { get_user_team(i, team, charsmax(team)) changeTeamInfo(i, color) writeMessage(i, said) changeTeamInfo(i, team) } } } return PLUGIN_HANDLED_MAIN; } public changeTeamInfo(player, team[]) { message_begin(MSG_ONE, g_msgTeamInfo, _, player) write_byte(player) write_string(team) message_end() } public writeMessage(player, message[]) { message_begin(MSG_ONE, g_msgSayText, {0, 0, 0}, player) write_byte(player) write_string(message) message_end() } /* =================================== *[SAVE]* =====================================*/ Save(id) { formatex(szKey, charsmax(szKey), "data_ranges") formatex(szRanges, charsmax(szRanges), "%d %d", g_frags[id], g_range[id]) nfv_set_data(VaultRanges, szKey, g_playername[id], szRanges) } load(id) { new g_load_c1[25], g_load_c2[25] formatex(szKey, charsmax(szKey), "data_ranges") if(!nfv_get_data(VaultRanges, szKey, g_playername[id], szRanges, sizeof(szRanges) - 1)) return; parse(szRanges, g_load_c1, charsmax(g_load_c1), g_load_c2, charsmax(g_load_c2)) g_frags[id] = str_to_num(g_load_c1) g_range[id] = str_to_num(g_load_c2) } /* =================================== *[STOCKS]* =====================================*/ // stock of chatcolor stock chatcolor(id, const input[], any:...) { new count = 1, players[32]; static msg[191]; vformat(msg, 190, input, 3); replace_all(msg, 190, "!g", "^4"); // Green replace_all(msg, 190, "!y", "^1"); // Default replace_all(msg, 190, "!t", "^3"); // Color of team if (id) players[0] = id; else get_players(players, count, "ch"); { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } } } // Stock to Know If the message is valid stock ValidMessage(text[], maxcount) { static len, i, count len = strlen(text) count = 0 if (!len) return false; for (i = 0; i < len; i++) { if (text[i] != ' ') { count++ if (count >= maxcount) return true; } } return false; } /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par } */
Ok z tym sobie poradziłem.
A czy da radę by cześć była kolor niebieski i cześć biała ?
=======================
Forum serwera: forum serwera.pl
Sklep 24/7: /sklepsms
=======================
Zabojstwa: 20
Twoja ranga: Nowy KaT
=======================
Nastepna ranga: silver I
Potrzebnych fragów: 10
=======================
Czarno na biało ? Da radę tak zrobić ?
Użytkownik shazoru edytował ten post 15.11.2019 13:16