Posts: 8
Threads: 2
Joined: Jun 2010
Reputation:
0
07-10-2010, 11:19 AM
(This post was last modified: 07-10-2010, 11:23 AM by turk89.)
Hej forums.srcds.com!
Jeg sidder med et problem, og skal ændre i en .sp fil. Det plugin jeg har installeret er en menu man kan få frem ved at skrive !helpmenu in-game, og har følgende 5 underpunkter:
Server Rules
Clan Info
Chat Comands
Map Rotations
List Online Admins
Jeg kunne godt tænke mig at slette det sidste punkt, "List Online Admins". Hvad skal slettes fra .sp filen, for at at filen kører uden problemer?
Der er tale om følgende plugin: http://forums.alliedmods.net/showthread.php?t=72576 (hent filen her)
(Tak til klausenbusk med sine hurtigere svar tidligere på dagen omkring et andet spørgsmål)
Tak på forhånd!
Posts: 7,778
Threads: 176
Joined: May 2008
Reputation:
83
07-10-2010, 12:13 PM
(This post was last modified: 07-10-2010, 12:15 PM by realchamp.)
Find funktionen:
Code:
Help_ShowMainMenu(client) {
new Handle:menu = CreateMenu(Help_MainMenuHandler);
SetMenuExitBackButton(menu, false);
SetMenuTitle(menu, "Help Menu\n ");
new msize = GetArraySize(g_helpMenus);
new hmenu[HelpMenu];
new String:menuid[10];
for (new i = 0; i < msize; ++i) {
Format(menuid, sizeof(menuid), "helpmenu_%d", i);
GetArrayArray(g_helpMenus, i, hmenu[0]);
AddMenuItem(menu, menuid, hmenu[name]);
}
AddMenuItem(menu, "maplist", "Map Rotation");
if (GetConVarBool(g_cvarAdmins))
AddMenuItem(menu, "admins", "List Online Admins");
DisplayMenu(menu, client, 30);
}
Fjern
Code:
if (GetConVarBool(g_cvarAdmins))
AddMenuItem(menu, "admins", "List Online Admins");
Find
Code:
public Help_MainMenuHandler(Handle:menu, MenuAction:action, param1, param2) {
if (action == MenuAction_End) {
CloseHandle(menu);
} else if (action == MenuAction_Select) {
new String:buf[64];
new msize = GetArraySize(g_helpMenus);
if (param2 == msize) { // Maps
new Handle:mapMenu = CreateMenu(Help_MenuHandler);
SetMenuExitBackButton(mapMenu, true);
ReadMapList(g_mapArray, g_mapSerial, "default");
Format(buf, sizeof(buf), "Current Rotation (%d maps)\n ", GetArraySize(g_mapArray));
SetMenuTitle(mapMenu, buf);
if (g_mapArray != INVALID_HANDLE) {
new mapct = GetArraySize(g_mapArray);
new String:mapname[64];
for (new i = 0; i < mapct; ++i) {
GetArrayString(g_mapArray, i, mapname, sizeof(mapname));
AddMenuItem(mapMenu, mapname, mapname, ITEMDRAW_DISABLED);
}
}
DisplayMenu(mapMenu, param1, 30);
} else if (param2 == msize+1) { // Admins
new Handle:adminMenu = CreateMenu(Help_MenuHandler);
SetMenuExitBackButton(adminMenu, true);
SetMenuTitle(adminMenu, "Online Admins\n ");
new maxc = GetMaxClients();
new String:aname[64];
for (new i = 1; i < maxc; ++i) {
if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && (GetUserFlagBits(i) & ADMFLAG_GENERIC) == ADMFLAG_GENERIC) {
GetClientName(i, aname, sizeof(aname));
AddMenuItem(adminMenu, aname, aname, ITEMDRAW_DISABLED);
}
}
DisplayMenu(adminMenu, param1, 30);
} else { // Menu from config file
if (param2 <= msize) {
new hmenu[HelpMenu];
GetArrayArray(g_helpMenus, param2, hmenu[0]);
new String:mtitle[512];
Format(mtitle, sizeof(mtitle), "%s\n ", hmenu[title]);
if (hmenu[type] == HelpMenuType_Text) {
new Handle:cpanel = CreatePanel();
SetPanelTitle(cpanel, mtitle);
new String:text[128];
new String:junk[128];
for (new i = 0; i < hmenu[itemct]; ++i) {
ReadPackString(hmenu[items], junk, sizeof(junk));
ReadPackString(hmenu[items], text, sizeof(text));
DrawPanelText(cpanel, text);
}
for (new j = 0; j < 7; ++j)
DrawPanelItem(cpanel, " ", ITEMDRAW_NOTEXT);
DrawPanelText(cpanel, " ");
DrawPanelItem(cpanel, "Back", ITEMDRAW_CONTROL);
DrawPanelItem(cpanel, " ", ITEMDRAW_NOTEXT);
DrawPanelText(cpanel, " ");
DrawPanelItem(cpanel, "Exit", ITEMDRAW_CONTROL);
ResetPack(hmenu[items]);
SendPanelToClient(cpanel, param1, Help_MenuHandler, 30);
CloseHandle(cpanel);
} else {
new Handle:cmenu = CreateMenu(Help_CustomMenuHandler);
SetMenuExitBackButton(cmenu, true);
SetMenuTitle(cmenu, mtitle);
new String:cmd[128];
new String:desc[128];
for (new i = 0; i < hmenu[itemct]; ++i) {
ReadPackString(hmenu[items], cmd, sizeof(cmd));
ReadPackString(hmenu[items], desc, sizeof(desc));
new drawstyle = ITEMDRAW_DEFAULT;
if (strlen(cmd) == 0)
drawstyle = ITEMDRAW_DISABLED;
AddMenuItem(cmenu, cmd, desc, drawstyle);
}
ResetPack(hmenu[items]);
DisplayMenu(cmenu, param1, 30);
}
}
}
}
}
Fjern
Code:
else if (param2 == msize+1) { // Admins
new Handle:adminMenu = CreateMenu(Help_MenuHandler);
SetMenuExitBackButton(adminMenu, true);
SetMenuTitle(adminMenu, "Online Admins\n ");
new maxc = GetMaxClients();
new String:aname[64];
for (new i = 1; i < maxc; ++i) {
if (IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && (GetUserFlagBits(i) & ADMFLAG_GENERIC) == ADMFLAG_GENERIC) {
GetClientName(i, aname, sizeof(aname));
AddMenuItem(adminMenu, aname, aname, ITEMDRAW_DISABLED);
}
}
DisplayMenu(adminMenu, param1, 30);
}
Gem og compile
Posts: 8
Threads: 2
Joined: Jun 2010
Reputation:
0
Du er en skat realchamp!
Men den kommer med en lille fejl (tror jeg) - compile.exe siger:
"helpmenu.sp<58> : warning 204: symbol is assigned a value that is never used: "g_cvarAdmins".
Posts: 720
Threads: 13
Joined: Dec 2009
Reputation:
6
07-10-2010, 06:16 PM
(This post was last modified: 07-10-2010, 06:27 PM by klausenbusk.)
det er kun en advarsel, fjern g_cvaradmins(kig på linje 58), den bliver ikke brugt nu når du har fjernet "List Online Admins" fra pluginet.
Og kan du så ikke lade være med at slette dine tråde, når du har fået svar, det er pisse irriterende.
Posts: 8
Threads: 2
Joined: Jun 2010
Reputation:
0
07-12-2010, 10:57 AM
(This post was last modified: 07-13-2010, 01:57 AM by turk89.)
Tak til jer begge. Det kører fint!
|