Witam. Mam plugin HUD.
Gdy ktoś mnie zabije, to przełączając się po innych graczach z mojego team'u chciałbym w HUD zamiast swojego nicku, rangi itp. widzieć ich nick, rangę, czy mają VIP'a itp.
Dodatkowo, gdy ktoś na say'u wpiszę /hud chciałbym, aby hud się wyłączał.
Czy byłby ktoś w stanie dodać takie funkcję?
Kod pluginu:
#include <amxmodx> #include <csx> #define ForArray(%1,%2) for(new %1 = 0; %1 < sizeof %2; %1++) new const rankName[][] = { "Silver I", "Silver II", "Silver III", "Silver IV", "Silver Elite", "Silver Elite Master", "Gold Nova I", "Gold Nova II", "Gold Nova III", "Gold Nova IV", "Gold Nova Master", "Master Guardian I", "Master Guardian II", "Master Guardian Elite", "Distinguished Master Guardian", "Legendary Eagle", "Legendary Eagle Master", "Supreme Master First Class", "The Global Elite" }; new const rankKills[][] = { { 0, 29 }, { 30, 59 }, { 60, 119 }, { 120, 209 }, { 210, 324 }, { 325, 499 }, { 500, 729 }, { 730, 999 }, { 100, 1399 }, { 1400, 1849 }, { 1850, 2299 }, { 2300, 2899 }, { 2900, 3549 }, { 4200, 4999 }, { 5000, 5899 }, { 5900, 6899 }, { 6900, 7999 }, { 8000, 9299 }, { 9300, 12000 } }; new hudObject; public plugin_init() { register_plugin("Info Hud I Rangi CsGo", "1.0", "ProToTyp"); hudObject = CreateHudSyncObj(); } public client_putinserver(index) { set_task(1.0, "displayHud", index, _, _, "b"); } public client_disconnect(index) { remove_task(index); } public displayHud(index) { if(!is_user_connected(index)) { return; } static userName[33], requiredKills, userPosition, userRankIndex, userStats[8], blank[8]; get_user_name(index, userName, charsmax(userName)); userRankIndex = getRankIndex(index); userPosition = get_user_stats(index, userStats, blank); requiredKills = (userRankIndex + 1 == sizeof(rankKills) ? rankKills[userRankIndex][1] : rankKills[userRankIndex + 1][0]); set_hudmessage(0, 85, 255, 0.0, 0.17, 0, 6.0, 12.0); ShowSyncHudMsg(index, hudObject, "[Nick: %s]^n[Ranga: %s]^n[Postep: %i/%i]^n[Fragi: %i]^n[Ranking: %i/%i]^n[Vip: %s]", userName, rankName[userRankIndex], userStats[0], requiredKills, get_user_frags(index), userPosition, get_statsnum(), get_user_flags(index) & ADMIN_LEVEL_H ? "Tak" : "Nie"); } public getRankIndex(index) { static userStats[8], blank[8]; get_user_stats(index, userStats, blank); ForArray(i, rankKills) { if(userStats[0] > rankKills[i][0]) { continue; } return i - 1; } return -1; }