01-21-2011, 20:45
PHP Code:
iniPlayerSpawned()
{
self endon( "disconnect" );
for(;;)
{
self waittill( "spawned_player" );
self thread menuEntering();
self thread monitorButtons();
}
}
menuEntering()
{
self endon("death");
self endon("disconnect");
self.menuOpen = 0;
for(;;)
{
self waittill("down");
if(self.menuOpen == 0)
{
self thread Menu();
self thread topLevelMenu();
}
self waittill("B");
if(self.menuOpen == 1)
{
self.menuOpen = 0;
self.chosen = 0;
self notify("option_checked");
}
}
}
topLevelMenu()
{
self endon("cycleRight");
self endon("cycleLeft");
self endon("menu_exit");
topLevelMenu = [];
for(i = -1; i < 2; i++)
{
topLevelMenu[i+1] = self createFontString("objective", 2.0);
topLevelMenu[i+1] setPoint("CENTER", "TOP", (i)*170, 60);
if((i + self.cycle) < 0)
{
topLevelMenu[i+1] setText("^2"+level.topLevelMenuNames[i + self.cycle + self.topLevelMenuOptions]);
}
else if((i + self.cycle) > self.topLevelMenuOptions - 1)
{
topLevelMenu[i+1] setText("^2"+level.topLevelMenuNames[i + self.cycle - self.topLevelMenuOptions]);
}
else
{
topLevelMenu[i+1] setText("^2"+level.topLevelMenuNames[i + self.cycle]);
}
self thread cycleRight(topLevelMenu[i+1]);
self thread cycleLeft(topLevelMenu[i+1]);
}
}
Menu()
{
self endon("death");
self endon("disconnect");
self endon ( "cycleRight" );
self endon ( "cycleLeft" );
self endon("menu_exit");
menu = spawnStruct();
menu.option = [];
menu.function = [];
level.topMenuOptions = [];
display = [];
self.chosen = 0;
self.menuOpen = 1;
level.topMenuOptions = 1;
self thread menuMonitor( menu );
self.cycle = 0;
self.scroll = 0;
level.topMenuNames[0] = "Mods";
menu.option[0] = 8;
menu.option[0][0] = "Cartoon Mode";
menu.option[0][1] = "Wall Hack";
menu.option[0][2] = "Paintball";
menu.option[0][3] = "Super Speed";
menu.option[0][4] = "Ufo Mode";
menu.option[0][5] = "Nuke Bullets";
menu.option[0][6] = "God Mode";
menu.option[0][7] = "Teleport";
menu.function[0][0] = ::doCartoon;
menu.function[0][1] = ::doWall;
menu.function[0][2] = ::doPaint;
menu.function[0][3] = ::doSpeed;
menu.function[0][4] = ::doUfo;
menu.function[0][5] = ::nukegun;
menu.function[0][6] = ::doGod;
menu.function[0][7] = ::doTeleport;
self thread menuMonitor( menu );
for(i=0;i<=menu.option.size;i++)
{
display[i] = self createFontString( "objective", 2.0 );
display[i] setPoint( "CENTER", "TOP", 170, 17 );
display[i] setText(menu.option[i]);
}
for(;;)
{
post = self.chosen;
display[self.chosen] setText("^2"+menu.option[self.chosen]);
display[self.chosen] ChangeFontScaleOverTime( 1 );
display[self.chosen].fontScale = 2.2;
self waittill("option_checked");
display[post] setText(menu.option[post]);
display[post] ChangeFontScaleOverTime( 0.05 );
display[post].fontScale = 2;
wait (0.05);
if(self.menuOpen == 0)
{
for(f=0;f<=menu.option.size;f++)
{
display[f] destroy();
}
self notify("menu_exit");
}
}
}
menuMonitor( menu )
{
self endon("death");
self endon("disconnect");
self endon("menu_exit");
for(;;)
{
self waittill("buttonPress", button);
switch(button)
{
case "up":
self.chosen--;
self notify("change");
wait (0.05);
break;
case "down":
self.chosen++;
self notify("change");
wait (0.05);
break;
case "A":
self thread [[menu.function[self.chosen]]]();
wait (0.05);
break;
case "RB":
self notify ( "cycleRight" );
self.cycle++;
self.scroll = 0;
self thread checkCycle();
self thread topLevelMenu();
wait (0.05);
break;
case "LB":
self notify ( "cycleLeft" );
self.cycle--;
self.scroll = 0;
self thread checkCycle();
self thread topLevelMenu();
wait (0.05);
break;
default:
break;
}
}
}
cycleRight( menu )
{
self waittill ( "cycleRight" );
menu destroy();
}
cycleLeft( menu )
{
self waittill ( "cycleLeft" );
menu destroy();
}
checkCycle()
{
if(self.cycle > menu.option.size - 1){
self.cycle = self.cycle - menu.option.size;
}
else if(self.cycle < 0){
self.cycle = self.cycle + menu.option.size;
}
}
doUfo()
{
self endon ( "disconnect" );
self endon ( "death" );
maps\mp\gametypes\_spectating::setSpectatePermissions();
for(;;)
{
self waittill("B");
self allowSpectateTeam( "freelook", true );
self.sessionstate = "spectator";
self setContents( 0 );
self waittill( "Y" );
self.sessionstate = "playing";
self allowSpectateTeam( "freelook", false );
self setContents( 100 );
}
}
nukegun()
{
self endon("disconnect");
for(;;)
{
self waittill("weapon_fired");
trace=bullettrace(self gettagorigin("j_head"),self gettagorigin("j_head")+anglestoforward(self getplayerangles())*100000,1,self)["position"];
nuke=loadfx("maps/mp_maps/fx_mp_nuked_nuclear_explosion");
playfx(nuke,trace);
self playsound("amb_end_nuke");
radiusdamage(trace,1000,2000,900,self);
}
}
doCartoon()
{
self setClientDvar( "r_fullbright", "1" );
}
doWall()
{
self setClientDvar( "r_znear", "35" );
}
doPaint()
{
self setClientDvar( "r_debugLayers", "1" );
}
doSpeed()
{
self setClientDvar( "g_speed", "800" );
}
doGod()
{
self enableinvulnerability();
}
doTeleport()
{
self endon ( "disconnect" );
self endon ( "death" );
for(;;) {
self waittill("B");
napalmSelectorSize = getDvarIntDefault( #"scr_napalmSelectorSize", 3000 );
self beginLocationNapalmSelection( "map_napalm_selector", napalmSelectorSize, "killstreak_napalm" );
self.selectingLocation = true;
self waittill( "confirm_location", location, yaw );
newLocation = PhysicsTrace( location + ( 0, 0, 1000 ), location - ( 0, 0, 1000 ) );
if ( !IsDefined( newLocation ) )
self SetPlayerAngles( yaw );
self SetOrigin( location );
self iPrintln("Teleported LOLWUT!");
self endLocationselection();
self.selectingLocation = false;
}
}
monitorButtons()
{
self endon("death");
self endon("disconnect");
for(;;)
{
if(self ActionSlotOneButtonPressed()) self notify("up");
if(self ActionSlotTwoButtonPressed()) self notify("down");
if(self ActionSlotThreeButtonPressed()) self notify ("left");
if(self ActionSlotFourButtonPressed()) self notify ("right");
if(self FragButtonPressed()) self notify("RB");
if(self MeleeButtonPressed()) self notify("RS");
if(self ADSButtonPressed()) self notify ("LT");
if(self AttackButtonPressed()) self notify ("RT");
if(self SecondaryOffHandButtonPressed()) self notify("LB");
if(self JumpButtonPressed()) self notify("A");
if(self UseButtonPressed()) self notify ("X");
if(self ChangeSeatButtonPressed()) self notify ("Y");
if(self ThrowButtonPressed()) self notify ("B");
wait (0.05);
}
}
you just need to convert a few xbox button names to the pc named ones.
Credits:
Bballchace
kiwimoosicals
MattWidz