Witam. Gdy jestem w TT/CT i ktoś mnie zabije to hud znika, zamiast pokazywać Nick, Rangę, Postęp, czy ma VIP'a itp.
Mógłby ktoś spojrzeć na kod i podesłać mi działający hud?
rangi_amxx.sma
#include <amxmodx> #include <csx> #include <fakemeta> #define ForArray(%1,%2) for(new %1 = 0; %1 < sizeof %2; %1++) #define TASK_DISPLAYHUD 1337 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 const hudToggleCommands[][] = { "/hud" }; new hudObject, bool:hudEnabled[33]; public plugin_init() { register_plugin("Info Hud I Rangi CsGo", "1.0", "ProToTyp"); registerCommands(hudToggleCommands, sizeof(hudToggleCommands), "toggleHud"); hudObject = CreateHudSyncObj(); } public client_putinserver(index) { hudEnabled[index] = true; setHudTask(index); } public client_disconnect(index) { if(!task_exists(index + TASK_DISPLAYHUD)) { return; } remove_task(index + TASK_DISPLAYHUD); } public displayHud(taskIndex) { new index = taskIndex - TASK_DISPLAYHUD; if(!is_user_connected(index) || !hudEnabled[index]) { return; } new target; if(!is_user_alive(index)) { target = pev(index, pev_iuser2); if(!is_user_alive(target)) { return; } } else { target = index; } static userName[33], requiredKills, userPosition, userRankIndex, userStats[8], blank[8]; get_user_name(target, userName, charsmax(userName)); userRankIndex = getRankIndex(target); userPosition = get_user_stats(target, userStats, blank); requiredKills = (userRankIndex + 1 == sizeof(rankKills) ? rankKills[userRankIndex][1] : rankKills[userRankIndex + 1][0]); set_hudmessage(0, 255, 0, 0.01, 0.17, 0, 6.0, 1.2, 0.1, 0.1); ShowSyncHudMsg(target, hudObject, "Nick: %s^nRanga: %s^nPostep: %i/%i^nFragi: %i^nRanking: %i/%i^nVip: %s", userName, rankName[userRankIndex], userStats[0], requiredKills, get_user_frags(target), userPosition, get_statsnum(), get_user_flags(target) & ADMIN_LEVEL_H ? "Tak" : "Nie"); } getRankIndex(index) { static userStats[8], blank[8]; get_user_stats(index, userStats, blank); if(userStats[0] >= rankKills[sizeof(rankKills) - 1][0]) { return sizeof(rankKills) - 1; } ForArray(i, rankKills) { if(userStats[0] >= rankKills[i][0]) { continue; } return i - 1; } return -1; } public toggleHud(index) { hudEnabled[index] = !hudEnabled[index] if(hudEnabled[index]) { setHudTask(index); return; } if(!task_exists(index + TASK_DISPLAYHUD)) { return; } remove_task(index + TASK_DISPLAYHUD); } setHudTask(index) { set_task(1.0, "displayHud", index + TASK_DISPLAYHUD, .flags = "b"); } stock registerCommands(const array[][], arraySize, function[]) { #if !defined ForRange #define ForRange(%1,%2,%3) for(new %1 = %2; %1 <= %3; %1++) #endif #if AMXX_VERSION_NUM > 183 ForRange(i, 0, arraySize - 1) { ForRange(j, 0, 1) { register_clcmd(fmt("%s %s", !j ? "say" : "say_team", array[i]), function); } } #else new newCommand[33]; ForRange(i, 0, arraySize - 1) { ForRange(j, 0, 1) { formatex(newCommand, charsmax(newCommand), "%s %s", !j ? "say" : "say_team", array[i]); register_clcmd(newCommand, function); } } #endif }