Master 4 1 Napisano 22 Maja 2019 (edytowane) Witam! Opis Napisałem taki prosty plugin, bo denerwował mnie fakt, że muszę ciągle kompilować plugin, aby sprawdzić pozycję i kolor huda. Wtyczka umożliwia zmianę koordynatów i kolorów hud'a na żywo, poprzez menu serwera. Plugin nie jest zoptymalizowany, więc zalecam usunięcie po sprawdzeniu. Komenda sm_hud - otwiera menu konfiguracyjne hud'a, wymagana flaga 'z' Plugin Spoiler #pragma semicolon 1 #pragma newdecls required float g_fCord[2] = {-1.0, -1.0}; int g_iColor[4] = {255, 255, 255, 0}; char g_sCord[2][2] = {"X", "Y"}; char g_sColor[4][2] = {"R", "G", "B", "A"}; int g_iPicked; #define NAME "Master Hud Manage" #define AUTHOR "Master" #define VERSION "1.0" #define URL "https://cswild.pl/" public Plugin myinfo = { name = NAME, author = AUTHOR, version = VERSION, url = URL }; public void OnPluginStart() { RegConsoleCmd("sm_hud", CMD_Hud); } public void OnMapStart() { CreateTimer(0.5, Timer_Hud, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); } public Action Timer_Hud(Handle hTimer) { for(int iClient = 1; iClient <= MaxClients; iClient++) { if(IsClientInGame(iClient) && !IsFakeClient(iClient) && GetUserFlagBits(iClient) & ADMFLAG_ROOT) { SetHudTextParams(g_fCord[0], g_fCord[1], 0.5, g_iColor[0], g_iColor[1], g_iColor[2], g_iColor[3], 0, 0.0, 0.0, 0.0); ShowHudText(iClient, 4, "Testowa wiadomość\nLOREM: 21312"); } } return Plugin_Continue; } public Action CMD_Hud(int iClient, int args) { if(!(GetUserFlagBits(iClient) & ADMFLAG_ROOT)) { return Plugin_Handled; } PrintMenu(iClient); return Plugin_Handled; } void PrintMenu(int iClient) { Menu menu = new Menu(Menu_Handler); menu.SetTitle("Konfiguracja Huda"); char sBuffer[128]; Format(sBuffer, sizeof(sBuffer), "X: %f", g_fCord[0]); menu.AddItem(NULL_STRING, sBuffer); Format(sBuffer, sizeof(sBuffer), "Y: %f", g_fCord[1]); menu.AddItem(NULL_STRING, sBuffer); Format(sBuffer, sizeof(sBuffer), "R: %d", g_iColor[0]); menu.AddItem(NULL_STRING, sBuffer); Format(sBuffer, sizeof(sBuffer), "G: %d", g_iColor[1]); menu.AddItem(NULL_STRING, sBuffer); Format(sBuffer, sizeof(sBuffer), "B: %d", g_iColor[2]); menu.AddItem(NULL_STRING, sBuffer); Format(sBuffer, sizeof(sBuffer), "A: %d", g_iColor[3]); menu.AddItem(NULL_STRING, sBuffer); menu.Display(iClient, 0); } public int Menu_Handler(Menu menu, MenuAction action, int iClient, int param2) { switch(action) { case MenuAction_End: delete menu; case MenuAction_Select: { g_iPicked = param2; SecondMenu(iClient); } } } void SecondMenu(int iClient) { Menu menu = new Menu(SecondMenu_Handler); menu.SetTitle("Zmiana kordynatów\n \n"); char sBuffer[128]; if(g_iPicked < 2) { Format(sBuffer, sizeof(sBuffer), "%s: %f", g_sCord[g_iPicked], g_fCord[g_iPicked]); menu.AddItem(NULL_STRING, sBuffer, ITEMDRAW_DISABLED); menu.AddItem(NULL_STRING, "+0.1", g_fCord[g_iPicked] >= 1.0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); menu.AddItem(NULL_STRING, "+0.01", g_fCord[g_iPicked] >= 1.0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); menu.AddItem(NULL_STRING, "-0.01", g_fCord[g_iPicked] <= -1.0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); menu.AddItem(NULL_STRING, "-0.1", g_fCord[g_iPicked] <= -1.0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); } else { Format(sBuffer, sizeof(sBuffer), "%s: %d", g_sColor[g_iPicked - 2], g_iColor[g_iPicked - 2]); menu.AddItem(NULL_STRING, sBuffer, ITEMDRAW_DISABLED); menu.AddItem(NULL_STRING, "+10", g_iColor[g_iPicked - 2] >= 255 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); menu.AddItem(NULL_STRING, "+1", g_iColor[g_iPicked - 2] >= 255 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); menu.AddItem(NULL_STRING, "-1", g_iColor[g_iPicked - 2] <= 0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); menu.AddItem(NULL_STRING, "-10", g_iColor[g_iPicked - 2] <= 0 ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT); } menu.ExitBackButton = true; menu.Display(iClient, 0); } public int SecondMenu_Handler(Menu menu, MenuAction action, int iClient, int param2) { switch(action) { case MenuAction_End: delete menu; case MenuAction_Cancel: { if(param2 == MenuCancel_ExitBack) { PrintMenu(iClient); } } case MenuAction_Select: { if(g_iPicked < 2) { switch(param2) { case 1: g_fCord[g_iPicked] += 0.1; case 2: g_fCord[g_iPicked] += 0.01; case 3: g_fCord[g_iPicked] -= 0.01; case 4: g_fCord[g_iPicked] -= 0.1; } } else { switch(param2) { case 1: g_iColor[g_iPicked - 2] += 10; case 2: g_iColor[g_iPicked - 2] += 1; case 3: g_iColor[g_iPicked - 2] -= 1; case 4: g_iColor[g_iPicked - 2] -= 10; } } SecondMenu(iClient); } } } Zdjęcia Master_Hud_Manage.spHej! Skorzystałeś z linku lub pobrałeś załącznik? Uhonoruj naszą pracę poprzez rejestrację na forum i rośnij razem z nami! Edytowane 22 Maja 2019 przez Master Cytuj Udostępnij tę odpowiedź Odnośnik do odpowiedzi Udostępnij na innych stronach