When I want music to be played when the map starts everyhting freezes and then the music plays... the same with the endroom music. Whenever I chose a room my music for my room gets played for like a second and then the music to my map gets played....
Here is my code for the ambient:
music()
{
while(1)
{
ambientPlay("songa");
}
}
I have tried adding the: wait; but it still freezes. And when I chose a room the music doesn't play...
Here is my .GSC:
main()
{
maps\mp\_load::main();
game["allies"] = "marines";
game["axis"] = "opfor";
game["attackers"] = "axis";
game["defenders"] = "allies";
game["allies_soldiertype"] = "desert";
game["axis_soldiertype"] = "desert";
setdvar("compassmaxrange","1800");
addTriggerToList( "trap1_trig" );
addTriggerToList( "trap2_trig" );
addTriggerToList( "trap3_trig" );
addTriggerToList( "trap4_trig" );
addTriggerToList( "trap5_trig" );
addTriggerToList( "trap6_trig" );
addTriggerToList( "trap7_trig" );
addTriggerToList( "trap_trig" );
addTriggerToList( "bounce_trig" );
thread door();
thread music();
thread trap1();
thread trap2();
thread trap3();
thread trap4();
thread mover();
thread trap5();
thread trap6();
thread trap7();
thread special();
thread teleport();
thread trap();
thread sniper();
thread knife();
thread addTestClients();
thread linked();
thread weapon();
thread sniper_s();
thread knife_s();
thread weapon_s();
thread old();
thread secret();
thread send();
thread done();
thread spinner();
thread ill();
thread giver_ill();
thread send1();
thread send2();
thread bounce();
thread ill_s();
}
addTriggerToList( name )
{
if( !isDefined( level.trapTriggers ) )
level.trapTriggers = [];
level.trapTriggers[level.trapTriggers.size] = getEnt( name, "targetname" );
}
door()
{
brush = getent("door","targetname");
wait 10;
brush moveZ(352,5,1,1);
wait 10;
brush delete();
}
music()
{
while(1)
{
ambientPlay("songa");
}
}
trap1()
{
platform = getent("trap1","targetname");
trig = getent("trap1_trig","targetname");
trig waittill("trigger", player);
trig delete();
while(1)
{
platform rotateYaw(400,1);
wait 2;
platform rotateRoll(360,1);
wait 2;
}
}
trap2()
{
platform = getent("trap2a","targetname");
platform1 = getent("trap2b","targetname");
platform2 = getent("trap2c","targetname");
trig = getent("trap2_trig","targetname");
trig waittill("trigger");
trig delete();
while(1)
{
platform moveZ(-162,1);
wait 2;
platform moveZ(162,1);
platform1 moveZ(162,1);
wait 2;
platform1 moveZ(-162,1);
platform2 rotatePitch(360,1);
wait 2;
platform2 rotatePitch(-360,1);
}
}
trap3()
{
platform = getent("trap3","targetname");
platform1 = getent("trap3a","targetname");
platform2 = getent("trap3b","targetname");
killer = getent("killer_trig","targetname");
killer1 = getent("killer_trig1","targetname");
killer2 = getent("killer_trig2","targetname");
trig = getent("trap3_trig","targetname");
trig waittill("trigger");
trig delete();
while(1)
{
killer enablelinkto();
killer linkto(platform);
platform rotatePitch(1440,2,1,1);
wait 2.5;
platform rotatePitch(-1440,2,1,1);
wait 2.5;
killer1 enablelinkto();
killer1 linkto(platform1);
platform1 rotatePitch(1440,2,1,1);
wait 2.5;
platform1 rotatePitch(-1440,2,1,1);
wait 2.5;
killer2 enablelinkto();
killer2 linkto(platform2);
platform2 rotatePitch(1440,2,1,1);
wait 2.5;
platform2 rotatePitch(-1440,2,1,1);
wait 2.5;
}
}
trap4()
{
platform = getent("trap4","targetname");
killtrigger0 = getent("killtrig","targetname");
while(1)
{
killtrigger0 enablelinkto();
killtrigger0 linkto(platform);
platform moveZ(-304,2,1,1);
wait 2;
platform moveZ(304,2,1,1);
wait 2;
}
}
mover()
{
platform = getent("mover","targetname");
trig = getent("mover_trig","targetname");
trig waittill("trigger", player);
trig delete();
while(1)
{
platform moveY(808,4,1,1);
wait 6;
platform moveY(-808,4,1,1);
wait 6;
}
}
trap5()
{
platform = getent("trap5","targetname");
trig = getent("trap5_trig","targetname");
trig waittill("trigger", player);
trig delete();
while(1)
{
platform moveZ(-88,1);
wait 2;
platform moveZ(88,1);
wait 2;
platform rotateYaw(360,1);
wait 2;
}
}
trap6()
{
platform = getent("trap6","targetname");
trig = getent("trap6_trig","targetname");
killtrig1 = getEnt("kill","targetname");
trig waittill("trigger", player);
trig delete();
while(1)
{
killtrig1 enablelinkto();
killtrig1 linkto(platform);
platform moveZ(-296,1);
wait 5;
platform moveZ(296,1);
wait 5;
}
}
trap7()
{
platform = getent("trap7","targetname");
trig = getent("trap7_trig","targetname");
trig waittill("trigger");
trig delete();
while(1)
{
platform rotateRoll(-360,6);
wait 6;
}
}
special()
{
trig = getEnt( "special_trig", "targetname" );
for(;;)
{
trig waittill( "trigger", player );
player giveWeapon( "deserteagle_mp" );
player giveMaxAmmo( "deserteagle_mp" );
player switchToWeapon( "deserteagle_mp" );
}
}
teleport()
{
trig = getent("tele_trig","targetname");
origin1 = getent("tele_origin","targetname");
for(;;)
{
trig waittill("trigger", player);
player setOrigin(origin1.origin);
}
}
trap()
{
platform = getEnt("trap","targetname");
platform1 = getEnt("trap_a","targetname");
trig = getent("trap_trig","targetname");
trig waittill("trigger");
trig delete();
platform delete();
while(1)
{
platform1 moveY(92,1);
wait 1;
platform1 moveY(-92,1);
wait 1;
}
}
sniper()
{
level.sniper_trig = getEnt( "sniper_trig", "targetname"); //trigger
jump = getEnt( "sniper1", "targetname" ); //jumper origin
acti = getEnt( "sniper2", "targetname" ); //acti origin
while(1)
{
level.sniper_trig waittill( "trigger", player );
if( !isDefined( level.sniper_trig ) )
return;
level.knife_trig delete();
level.old_trig delete();
level.weapon_trig delete();
level.ill_trig delete();
player SetPlayerAngles( jump.angles );
player setOrigin( jump.origin );
player TakeAllWeapons();
player GiveWeapon( "m40a3_mp" ); //Gives player weapon
player giveMaxAmmo( "m40a3_mp" ); //Gives player ammo
player GiveWeapon( "remington700_mp" );
player giveMaxAmmo( "remington700_mp" );
player switchToWeapon( "m40a3_mp" ); //Makes player switch to weapon.
player.maxhealth = 100; //Sets players health to normal.
if( isDefined( level.activ ) && isAlive( level.activ ) )
{
level.activ setPlayerangles( acti.angles );
level.activ setOrigin( acti.origin );
level.activ TakeAllWeapons();
level.activ GiveWeapon( "m40a3_mp" );
level.activ giveMaxAmmo( "m40a3_mp" );
level.activ GiveWeapon( "remington700_mp" );
level.activ giveMaxAmmo( "remington700_mp" );
level.activ SwitchToWeapon( "m40a3_mp" );
level.activ.maxhealth = 100;
}
wait 0.05;
iPrintLnBold( " ^4" + player.name + " ^7has chosen ^4Sniper ^7Room!" );
player freezecontrols(true); //Freeze the players when someone enters the room for three seconds.
level.activ freezecontrols(true);
wait 1;
player iPrintlnBold( "^13" );
level.activ iPrintlnBold( "^13" );
wait 1;
player iPrintlnBold( "^32" );
level.activ iPrintlnBold( "^32" );
wait 1;
player iPrintlnBold( "^51" );
level.activ iPrintlnBold( "^51" );
wait 1;
player iPrintlnBold( "^6Fight^7!" );
level.activ iPrintlnBold( "^6Fight^6!" );
player freezecontrols(false); //Disables the freeze.
level.activ freezecontrols(false);
while( isAlive( player ) && isDefined( player ) )
wait 1;
}
}
knife()
{
level.knife_trig = getEnt( "knife_trig", "targetname"); //trigger
jump = getEnt( "knife1", "targetname" ); //jumper origin
acti = getEnt( "knife2", "targetname" ); //acti origin
while(1)
{
level.knife_trig waittill( "trigger", player );
if( !isDefined( level.knife_trig ) )
return;
level.old_trig delete();
level.sniper_trig delete();
level.weapon_trig delete();
level.ill_trig delete();
player SetPlayerAngles( jump.angles );
player setOrigin( jump.origin );
player TakeAllWeapons();
player GiveWeapon( "knife_mp" ); //Gives player weapon
player giveMaxAmmo( "knife_mp" ); //Gives player ammo
player switchToWeapon( "knife_mp" ); //Makes player switch to weapon.
player.maxhealth = 100; //Sets players health to normal.
if( isDefined( level.activ ) && isAlive( level.activ ) )
{
level.activ setPlayerangles( acti.angles );
level.activ setOrigin( acti.origin );
level.activ TakeAllWeapons();
level.activ GiveWeapon( "knife_mp" );
level.activ giveMaxAmmo( "knife_mp" );
level.activ SwitchToWeapon( "knife_mp" );
level.activ.maxhealth = 100;
}
wait 0.05;
iPrintLnBold( " ^4" + player.name + " ^7has chosen ^4Knife ^7Room!" );
player freezecontrols(true); //Freeze the players when someone enters the room for three seconds.
level.activ freezecontrols(true);
wait 1;
player iPrintlnBold( "^13" );
level.activ iPrintlnBold( "^13" );
wait 1;
player iPrintlnBold( "^32" );
level.activ iPrintlnBold( "^32" );
wait 1;
player iPrintlnBold( "^51" );
level.activ iPrintlnBold( "^51" );
wait 1;
player iPrintlnBold( "^6Fight^7!" );
level.activ iPrintlnBold( "^6Fight^6!" );
player freezecontrols(false); //Disables the freeze.
level.activ freezecontrols(false);
while( isAlive( player ) && isDefined( player ) )
wait 1;
}
}
addTestClients()
{
setDvar("scr_testclients", "");
wait 1;
for(;;)
{
if(getdvarInt("scr_testclients") > 0)
break;
wait 1;
}
testclients = getdvarInt("scr_testclients");
setDvar( "scr_testclients", 0 );
for(i=0;i<testclients;i++)
{
ent[i] = addtestclient();
if (!isdefined(ent[i]))
{
println("Could not add test client");
wait 1;
continue;
}
ent[i].pers["isBot"] = true;
ent[i].pers["registered"] = 0;
ent[i] thread TestClient("autoassign");
}
thread addTestClients();
}
TestClient(team)
{
self endon( "disconnect" );
while(!isdefined(self.pers["team"]))
wait .05;
self notify("menuresponse", game["menu_team"], team);
wait 0.5;
}
linked()
{
trig = getent ("link_trig","targetname");
start = getent ("start_origin","targetname");
stop = getent ("stop_origin","targetname");
while(true)
{
trig waittill ("trigger", player);
link = spawn ("script_model",player.origin);
player linkTo (link);
link moveTo (start.origin, 1);
wait 1;
link moveTo (stop.origin, 10);
wait 10;
player unlink();
}
/* Created by [PF]JeffSkye Give Credits If Used In Any Map Or Mod */
}
weapon()
{
level.weapon_trig = getEnt( "weapon_trig", "targetname"); //trigger
jump = getEnt( "weapon1", "targetname" ); //jumper origin
acti = getEnt( "weapon2", "targetname" ); //acti origin
while(1)
{
level.weapon_trig waittill( "trigger", player );
if( !isDefined( level.weapon_trig ) )
return;
level.knife_trig delete();
level.sniper_trig delete();
level.old_trig delete();
level.ill_trig delete();
player SetPlayerAngles( jump.angles );
player setOrigin( jump.origin );
player TakeAllWeapons();
player GiveWeapon( "deserteagle_mp" ); //Gives player weapon
player giveMaxAmmo( "deserteagle_mp" ); //Gives player ammo
player switchToWeapon( "deserteagle_mp" ); //Makes player switch to weapon.
player.maxhealth = 100; //Sets players health to normal.
if( isDefined( level.activ ) && isAlive( level.activ ) )
{
level.activ setPlayerangles( acti.angles );
level.activ setOrigin( acti.origin );
level.activ TakeAllWeapons();
level.activ GiveWeapon( "deserteagle_mp" );
level.activ giveMaxAmmo( "deserteagle_mp" );
level.activ SwitchToWeapon( "deserteagle_mp" );
level.activ.maxhealth = 100;
}
wait 0.05;
iPrintLnBold( " ^4" + player.name + " ^7has chosen ^4Weapon ^7Room!" );
player freezecontrols(true); //Freeze the players when someone enters the room for three seconds.
level.activ freezecontrols(true);
wait 1;
player iPrintlnBold( "^13" );
level.activ iPrintlnBold( "^13" );
wait 1;
player iPrintlnBold( "^32" );
level.activ iPrintlnBold( "^32" );
wait 1;
player iPrintlnBold( "^51" );
level.activ iPrintlnBold( "^51" );
wait 1;
player iPrintlnBold( "^6Fight^7!" );
level.activ iPrintlnBold( "^6Fight^6!" );
player freezecontrols(false); //Disables the freeze.
level.activ freezecontrols(false);
while( isAlive( player ) && isDefined( player ) )
wait 1;
}
}
sniper_s()
{
trigger = getent("sniper_trig","targetname");
trigger waittill("trigger", player);
while(1)
{
ambientPlay("sniper_song");
}
}
knife_s()
{
trigger = getent("knife_trig","targetname");
trigger waittill("trigger", player);
while(1)
{
ambientPlay("knife_song");
}
}
weapon_s()
{
trigger = getent("weapon_trig","targetname");
trigger waittill("trigger", player);
while(1)
{
ambientPlay("weapon_song");
}
}
old()
{
level.old_trig = getEnt( "old_trig", "targetname"); //trigger
jump = getEnt( "old1", "targetname" ); //jumper origin
acti = getEnt( "old2", "targetname" ); //acti origin
while(1)
{
level.old_trig waittill( "trigger", player );
if( !isDefined( level.old_trig ) )
return;
level.knife_trig delete();
level.sniper_trig delete();
level.weapon_trig delete();
level.ill_trig delete();
player SetPlayerAngles( jump.angles );
player setOrigin( jump.origin );
player TakeAllWeapons();
player GiveWeapon( "deserteagle_mp" ); //Gives player weapon
player giveMaxAmmo( "deserteagle_mp" ); //Gives player ammo
player switchToWeapon( "deserteagle_mp" ); //Makes player switch to weapon.
player.maxhealth = 100; //Sets players health to normal.
if( isDefined( level.activ ) && isAlive( level.activ ) )
{
level.activ setPlayerangles( acti.angles );
level.activ setOrigin( acti.origin );
level.activ TakeAllWeapons();
level.activ GiveWeapon( "knife_mp" );
level.activ giveMaxAmmo( "knife_mp" );
level.activ SwitchToWeapon( "knife_mp" );
level.activ.maxhealth = 100;
}
wait 0.05;
iPrintLnBold( " ^4" + player.name + " ^7has chosen ^4Old ^7Room!" );
player freezecontrols(true); //Freeze the players when someone enters the room for three seconds.
level.activ freezecontrols(true);
wait 1;
player iPrintlnBold( "^13" );
level.activ iPrintlnBold( "^13" );
wait 1;
player iPrintlnBold( "^32" );
level.activ iPrintlnBold( "^32" );
wait 1;
player iPrintlnBold( "^51" );
level.activ iPrintlnBold( "^51" );
wait 1;
player iPrintlnBold( "^6Fight^7!" );
level.activ iPrintlnBold( "^6Fight^6!" );
player freezecontrols(false); //Disables the freeze.
level.activ freezecontrols(false);
while( isAlive( player ) && isDefined( player ) )
wait 1;
}
}
secret()
{
trig = getent("secret_trig","targetname");
origin1 = getent("secret_origin","targetname");
for(;;)
{
trig waittill("trigger", player);
player iPrintLnBold("You entered secret!");
player setOrigin(origin1.origin);
}
}
send()
{
trig = getent("send_trig","targetname");
origin1 = getent("send_origin","targetname");
for(;;)
{
trig waittill("trigger", player);
player playsound("lose");
player setOrigin(origin1.origin);
}
}
done()
{
trig = getent("done_trig","targetname");
origin1 = getent("done_origin","targetname");
for(;;)
{
trig waittill("trigger", player);
iPrintLnBold( " ^4" + player.name + " ^7has finished ^1Secret! " );
player setOrigin(origin1.origin);
player GiveWeapon( "deserteagle_mp" );
wait 1;
player giveMaxAmmo( "deserteagle_mp" );
}
}
spinner()
{
platform = getent("spinner","targetname");
while(1)
{
platform rotateYaw(360,4);
wait 4;
platform rotateYaw(360,4);
wait 4;
}
}
ill()
{
level.ill_trig = getEnt( "ill_trig", "targetname"); //trigger
jump = getEnt( "ill1", "targetname" ); //jumper origin
acti = getEnt( "ill2", "targetname" ); //acti origin
while(1)
{
level.ill_trig waittill( "trigger", player );
if( !isDefined( level.ill_trig ) )
return;
level.knife_trig delete();
level.old_trig delete();
level.weapon_trig delete();
level.sniper_trig delete();
player SetPlayerAngles( jump.angles );
player setOrigin( jump.origin );
player TakeAllWeapons();
player.maxhealth = 100; //Sets players health to normal.
if( isDefined( level.activ ) && isAlive( level.activ ) )
{
level.activ setPlayerangles( acti.angles );
level.activ setOrigin( acti.origin );
level.activ TakeAllWeapons();
level.activ SwitchToWeapon( "deserteagle_mp" );
level.activ.maxhealth = 100;
}
wait 0.05;
iPrintLnBold( " ^4" + player.name + " ^7has chosen ^4BrainFuck ^7Room!" );
player freezecontrols(true); //Freeze the players when someone enters the room for three seconds.
level.activ freezecontrols(true);
wait 1;
player iPrintlnBold( "^13" );
level.activ iPrintlnBold( "^13" );
wait 1;
player iPrintlnBold( "^32" );
level.activ iPrintlnBold( "^32" );
wait 1;
player iPrintlnBold( "^51" );
level.activ iPrintlnBold( "^51" );
wait 1;
player iPrintlnBold( "^6Fight^7!" );
level.activ iPrintlnBold( "^6Fight^6!" );
player freezecontrols(false); //Disables the freeze.
level.activ freezecontrols(false);
while( isAlive( player ) && isDefined( player ) )
wait 1;
}
}
giver_ill()
{
trig = getEnt( "give_trig", "targetname" );
for(;;)
{
trig waittill( "trigger", player);
player giveWeapon( "colt44_mp" );
player giveMaxAmmo( "colt44_mp" );
player switchToWeapon( "colt44_mp" );
}
}
send1()
{
trig = getent("sender1_trig","targetname");
origin1 = getent("send1_origin","targetname");
for(;;)
{
trig waittill("trigger", player);
player setOrigin(origin1.origin);
}
}
send2()
{
trig = getent("sender2_trig","targetname");
origin1 = getent("send2_origin","targetname");
for(;;)
{
trig waittill("trigger", player);
player setOrigin(origin1.origin);
}
}
bounce()
{
trig = getent("bounce_trig","targetname");
platform = getent("bounce","targetname");
trig waittill("trigger");
trig delete();
while(1)
{
platform rotateYaw(360,2);
wait 3;
platform rotateYaw(360,2);
wait 3;
}
}
ill_s()
{
trigger = getent("ill_trig","targetname");
trigger waittill("trigger", player);
ambientPlay("ill_song");
}