[ROZWIĄZANE] hud z kolorem białym na specu
MrZohan
26.02.2021
Witam z racji tego, że nie wiem jak zrobić hud levela na specu w kolorze białym, postanowiłem napisać temat o pomoc.
367-382 - dodany hud w kolorze zielonym dla ludzi i w kolorze czaerownym dla zombi, chciałbym żeby będąc na specu, hud danego gracza był biały
za pomoc daje cebule, czyli +1
Załączone pliki
KoRrNiK
26.02.2021
public ShowHUD(taskid) { static id, color[3]; id = ID_SHOWHUD; if (!zp_get_user_zombie(id)){ color[0] = 0; color[1] = 255; color[2] = 0; } else if(zp_get_user_zombie(id)){ color[0] = 255; color[1] = 0; color[2] = 0; } else if(get_user_team(id) == 3){ color[0] = 255; color[1] = 255; color[2] = 255; } set_hudmessage(color[0], color[1], color[2], 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1) show_hudmessage(ID_SHOWHUD,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id]) }
MrZohan
26.02.2021
public ShowHUD(taskid) { static id, color[3]; id = ID_SHOWHUD; if (!zp_get_user_zombie(id)){ color[0] = 0; color[1] = 255; color[2] = 0; } else if(zp_get_user_zombie(id)){ color[0] = 255; color[1] = 0; color[2] = 0; } else if(get_user_team(id) == 3){ color[0] = 255; color[1] = 255; color[2] = 255; } set_hudmessage(color[0], color[1], color[2], 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1) show_hudmessage(ID_SHOWHUD,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id]) }
/ Niestety hud pozostaje zielony lub czerwony w zależności, kim jesteśmy w danej rundzie - Ludzie, czy też Zombi. Ponadto nie pokazuje informacji levela oraz expa gracza, tylko Nasz własny.
Możesz spróbować dalej to zrobić po swojemu, bo ja przez czas odkąd udostępniłem, to próbowałem sam zrobić i jakimś cudem udało mi się zrobić po swojemu tak:
public ShowHUD(taskid)
{static idid = ID_SHOWHUD;// Player died?if (!is_user_alive(id)){// Get spectating targetid = pev(id, PEV_SPEC_TARGET)// Target not aliveif (!is_user_alive(id)) return;}if (!zp_get_user_zombie(id)){set_hudmessage(0, 255, 0, 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1)show_hudmessage(ID_SHOWHUD,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id])}if (id != ID_SHOWHUD){set_hudmessage(255, 255, 255, 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1)show_hudmessage(ID_SHOWHUD,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id])}elseif(zp_get_user_zombie(id)){set_hudmessage(255, 0, 0, 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1)show_hudmessage(ID_SHOWHUD,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id])}if (id != ID_SHOWHUD){set_hudmessage(255, 255, 255, 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1)show_hudmessage(ID_SHOWHUD,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id])}}
I o dziwo działa tak jak chce, jednakże jeśli masz chęci, to możesz spróbować zrobić inaczej, chętnie dodam Twoje rozwiązanie i postawię łapkę za dobrze wykonaną robotę
KoRrNiK
26.02.2021
Sprawdź teraz.
public ShowHUD(id){ id -= TASK_SHOWHUD; if (!is_user_connected(id) || is_user_hltv(id) || is_user_bot(id)) { remove_task(id + TASK_SHOWHUD); return; } static target, color[3]; target = id; if(!is_user_alive(id)){ target = pev(id, pev_iuser2); color[0] = 255; color[1] = 255; color[2] = 255; } else if (!zp_get_user_zombie(target)){ color[0] = 0; color[1] = 255; color[2] = 0; } else if(zp_get_user_zombie(target)){ color[0] = 255; color[1] = 0; color[2] = 0; } if (!target) return; set_hudmessage(color[0], color[1], color[2], 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1) show_hudmessage(id,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id]) }
Oraz usuń sobie #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
MrZohan
26.02.2021
Sprawdź teraz.
public ShowHUD(id){ id -= TASK_SHOWHUD; if (!is_user_connected(id) || is_user_hltv(id) || is_user_bot(id)) { remove_task(id + TASK_SHOWHUD); return; } static target, color[3]; target = id; if(!is_user_alive(id)){ target = pev(id, pev_iuser2); color[0] = 255; color[1] = 255; color[2] = 255; } else if (!zp_get_user_zombie(target)){ color[0] = 0; color[1] = 255; color[2] = 0; } else if(zp_get_user_zombie(target)){ color[0] = 255; color[1] = 0; color[2] = 0; } if (!target) return; set_hudmessage(color[0], color[1], color[2], 0.44, 0.09, 0, 1.0, 1.1, 0.0, 0.0, -1) show_hudmessage(id,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id]) }Oraz usuń sobie #define ID_SHOWHUD (taskid - TASK_SHOWHUD)
// Po usunięciu #define ID_SHOWHUD (taskid - TASK_SHOWHUD) na spec dalej to samo, czyli kolor pozostaje z drużyny jakiej trafiliśmy, zaś z zostawieniem #define kolor zmienia się na biały, czyli taki jaki chciałem finalnie uzyskać, jednakże dalej level oraz exp widzę własny zamiast obserwowanego gracza. Myśle, że wszystko zrozumiale opisałem. Ogolnie prawie Ci wyszło, czekam na efekty końcowe
KoRrNiK
26.02.2021
Zmień sobie bo zapomniałem podmienić z id na target
show_hudmessage(id,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id])
na
show_hudmessage(id,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[target], level_exp[target], g_level_exp[target])
MrZohan
26.02.2021
Zmień sobie bo zapomniałem podmienić z id na target
show_hudmessage(id,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[id], level_exp[id], g_level_exp[id])na
show_hudmessage(id,"^n^n[ Level: %d | EXP: %d / %d ]^n^n^n",g_level[target], level_exp[target], g_level_exp[target])
// Bardziej estetycznie to zrobiłeś, dobra robota!
Dziękuje!
Jakbyś miał chęć później, to mam jeszcze do ogarnięcia jedną rzecz - chodzi o przeniesienie nagrody Ammo Paków za zniszczenie LaserMiny z pluginu 3.2a ( 77-99 ), który podałem w załączniku - do 3.3a nad którym pracowałeś
Załączone pliki
Użytkownik MrZohan edytował ten post 26.02.2021 23:27
KoRrNiK
27.02.2021
Dodajesz na samej górze #include <engine>
Musisz do plugin_init() dodać:
RegisterHam(Ham_TakeDamage, "func_breakable", "fwHamTakeDamageBreakablePost", 1);
oraz gdzieś w pluginie:
public fwHamTakeDamageBreakablePost(iVictim, iInflictor, iAttacker, Float:fDamage) { if (!is_valid_ent(iVictim) || entity_get_float(iVictim, EV_FL_health) > 0.0 || !is_user_connected(iAttacker) || !zp_get_user_zombie(iAttacker)) return; static szTempString[32]; entity_get_string(iVictim, EV_SZ_classname, szTempString, charsmax(szTempString)) if (!equali(szTempString, "lasermine")) return; zp_set_user_ammo_packs(iAttacker, zp_get_user_ammo_packs(iAttacker) + 10) if( is_user_alive(iAttacker) && (level_exp[iAttacker] < (g_level_exp[iAttacker] - 1)) && zp_get_user_zombie(iAttacker)) { level_exp[iAttacker] = level_exp[iAttacker] + 1; Level_Save(iAttacker); } get_user_name(iAttacker, szTempString, charsmax(szTempString)) ChatColor(0, "!g[ZP]!y Gracz !g%s !ydostal !t10 !yAmmo Pakow oraz !t1 !yEXPa za zniszczenie LaserMiny.", szTempString) }
a jeśli nie chcesz dodawać <engine> i działać tylko ma <fakemeta> to masz takie rozwiązanie.
public fwHamTakeDamageBreakablePost(iVictim, iInflictor, iAttacker, Float:fDamage) { if (!pev_valid(iVictim) || pev(iVictim, pev_health) > 0.0 || !is_user_connected(iAttacker) || !zp_get_user_zombie(iAttacker)) return; static szTempString[32]; pev(iVictim, pev_classname, charsmax(szTempString)) if (!equali(szTempString, "lasermine")) return; zp_set_user_ammo_packs(iAttacker, zp_get_user_ammo_packs(iAttacker) + 10) if( is_user_alive(iAttacker) && (level_exp[iAttacker] < (g_level_exp[iAttacker] - 1)) && zp_get_user_zombie(iAttacker)) { level_exp[iAttacker] = level_exp[iAttacker] + 1; Level_Save(iAttacker); } get_user_name(iAttacker, szTempString, charsmax(szTempString)) ChatColor(0, "!g[ZP]!y Gracz !g%s !ydostal !t10 !yAmmo Pakow oraz !t1 !yEXPa za zniszczenie LaserMiny.", szTempString) }
I powinno działać.
Użytkownik KoRrNiK edytował ten post 27.02.2021 23:52
DarkGL
28.02.2021
Ten temat został zamknięty przez moderatora.
Powód: Pomoc udzielona
Jeśli się z tym nie zgadzasz,

Z pozdrowieniami,
Zespół AMXX.PL