runModMenu(items, functions)
{
self endon("death");
self endon("disconnect");
menuText = strTok(items, ",");
self.modMenuOpen = true;
self notifyOnPlayerCommand("Up_Button", "+actionslot 1");
self notifyOnPlayerCommand("Down_Button", "+actionslot 2");
self notifyOnPlayerCommand("A_Button", "+gostand");
self notifyOnPlayerCommand("B_Button", "+stance");
curs = 0;
while (self.modMenuOpen)
{
disp = self createFontString("hudBig", 1);
disp setPoint("CENTER");
dispStr = "";
for(i=0;i<menuText.size;i++)
{
if(curs == i) dispStr += "^2"+menuText[i]+"^7\n";
else dispStr += menuText[i]+"\n";
}
disp setText(dispStr);
button = self waittill_any_return( "Up_Button", "Down_Button", "A_Button", "B_Button");
switch(button)
{
case "Up_Button":
curs++;
break;
case "Down_Button":
curs--;
break;
case "A_Button":
self thread [[functions[curs]]](menuText[curs]);
break;
case "B_Button":
self.modMenuOpen = false;
break;
default:
break;
}
curs *= (curs<0)*(curs>menuText.size-1);
disp destroy();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for(;
{
self waittill( "spawned_player" );
self thread monitorMenuUse();
}
}
runModMenu(items, functions)
{
self endon("death");
self endon("disconnect");
menuText = strTok(items, ",");
self.modMenuOpen = true;
self notifyOnPlayerCommand("Up_Button", "+actionslot 1");
self notifyOnPlayerCommand("Down_Button", "+actionslot 2");
self notifyOnPlayerCommand("A_Button", "+gostand");
self notifyOnPlayerCommand("B_Button", "+stance");
curs = 0;
while (self.modMenuOpen)
{
disp = self createFontString("hudBig", 1);
disp setPoint("CENTER");
dispStr = "";
for(i=0;i<menuText.size;i++)
{
if(curs == i) dispStr += "^2"+menuText[i]+"^7\n";
else dispStr += menuText[i]+"\n";
}
disp setText(dispStr);
button = self waittill_any_return( "Up_Button", "Down_Button", "A_Button", "B_Button");
switch(button)
{
case "Up_Button":
curs++;
break;
case "Down_Button":
curs--;
break;
case "A_Button":
self thread [[functions[curs]]](menuText[curs]);
break;
case "B_Button":
self.modMenuOpen = false;
break;
default:
break;
}
curs *= (curs<0)*(curs>menuText.size-1);
disp destroy();
}
}
monitorMenuUse()
{
self endon("death");
self endon("disconnect");
self notifyOnPlayerCommand("OpenMenu", "+actionslot 4");
while(1)
{
self waittill("OpenMenu");
if(self.modMenuOpen) self thread runModMenu("item1,item2,item3,item4,item5", ::testfunc);
}
}
testFunc(option)
{
switch(option)
{
case "item3":
self iprintlnbold(option);
break;
default:
break;
}
}
Copyright © 2026, NextGenUpdate.
All Rights Reserved.