Eekhoorn allowed me to use the ready up snippet from cmmod in the sd.gsc file.
When i get in game the ready up period keeps on looping and stays on screen. Im guessing the problem is from this.
Got any idea what I did wrong?
When i get in game the ready up period keeps on looping and stays on screen. Im guessing the problem is from this.
Code:
self thread readyUp();
self thread askReadyUp();
self thread readyUpMonitorLoop();
self thread playerReadyUpLoop();
self thread matchStartTimer();
Code:
/*Ready Up*/
//Made by Eekhoorn - www.ItsMods.com
readyUp() {
level.timerStopped = true;
wait .5;
readyUpMonitorLoop();
level.timerStopped = false;
wait .5;
matchStartTimer();
game["ready_up"] = false;
map_restart(true);
}
askReadyUp() {
if(!isDefined(game["ready_up"]))
game["ready_up"] = true;
self takeAllWeapons();
if(game["ready_up"])
return true;
return false;
}
readyUpMonitorLoop() {
level.ready_up_complete = false;
level.status = createServerFontString("default", 1.4);
level.status setPoint("TOPRIGHT", "TOPRIGHT", -7, 30);
level.status.color = (1, 1, 1);
level.status setText("Status:");
level.waiting = createServerFontString("default", 1.4);
level.waiting setPoint("TOPRIGHT", "TOPRIGHT", -7, 80);
level.waiting.color = (1, 1, 1);
level.waiting setText("Waiting for");
level.number = createServerFontString("default", 1.4);
level.number setPoint("TOPRIGHT", "TOPRIGHT", -7, 100);
level.number.color = (1, 1, 1);
level.players = createServerFontString("default", 1.4);
level.players setPoint("TOPRIGHT", "TOPRIGHT", -7, 120);
level.players.color = (1, 1, 1);
level.players setText("players");
precacheStatusIcon("compassping_friendlyfiring_mp");
precacheStatusIcon("compassping_enemy");
self takeAllWeapons();
while(!level.ready_up_complete) {
wait .25;
if(!isDefined(self))
return;
level.inGracePeriod = true;
players = getEntArray("player", "classname");
ready_counter = 0;
for(i = 0; i < players.size; i++) {
if(isDefined(players[i].ready))
ready_counter += players[i].ready;
else
players[i] thread playerReadyUpLoop();
}
level.number setValue(players.size - ready_counter);
if(players.size > 0 && ready_counter == players.size)
level.ready_up_complete = true;
}
level.waiting destroy();
level.number destroy();
level.players destroy();
level.status destroy();
}
playerReadyUpLoop() {
self endon("disconnect");
if(isDefined(self.in_loop))
return;
self.in_loop = true;
self.ready = false;
self.maxhealth = 9999;
self.health = self.maxhealth;
self.state = self createFontString("default", 1.4);
self.state setPoint("TOPRIGHT", "TOPRIGHT", -7, 50);
self.state.color = (1, 1, 1);
self.state setText("[LOADING]");
self.info = self createFontString("default", 1.4);
self.info setPoint("TOPRIGHT", "TOPRIGHT", -7, 140);
self.info.color = (1, 1, 1);
self.info setText("[{+actionslot 2}] to Open/Close Create-a-class");
self.info1 = self createFontString("default", 1);
self.info1 setPoint("TOPRIGHT", "TOPRIGHT", -7, 170);
self.info1.color = (1, 1, 1);
self.info1 setText("Press ^3[{+activate}]^7 to Ready up.");
self.info1 = self createFontString("default", 1);
self.info1 setPoint("TOPRIGHT", "TOPRIGHT", -7, 200);
self.info1.color = (1, 1, 1);
self.info1 setText("Press ^3[{+actionslot 1}]^7 to drop the Bomb.");
while(!level.ready_up_complete) {
wait .25;
if(self.health<self.maxhealth)
{
self.health = self.maxhealth;
}
self EnableInvulnerability();
setDvar("player_sustainammo", 1);
setDvar("g_speed", 0);
self freeze_player_controls(false);
if(!isDefined(self))
return;
if(self useButtonPressed() && self.inmenu == 0)
self.ready = !self.ready;
if(self.ready) {
self.state.color = (.25, 1, .25);
self.state setText("[READY]");
self.statusicon = "compassping_friendlyfiring_mp";
} else {
self.state.color = (1, .25, .25);
self.state setText("[NOT READY]");
self.statusicon = "compassping_enemy";
}
while(self useButtonPressed())
wait .25;
}
self.state destroy();
self.info destroy();
self.pers["kills"] = 0;
self.pers["score"] = 0;
self.pers["deaths"] = 0;
self.maxhealth = 100;
self.health = self.maxhealth;
}
matchStartTimer() {
timer = 5;
level.player_ready = createServerFontString( "objective", 1.5 );
level.player_ready setPoint( "CENTER", "CENTER", 0, -40 );
level.player_ready.sort = 1001;
level.player_ready setText("All Players are Ready");
level.player_ready.foreground = false;
level.player_ready.hidewheninmenu = false;
level.player_ready.glowColor = (0.3, 0.6, 0.3);
level.player_ready.glowAlpha = 1;
level.player_ready setPulseFX( 100, 2000, 2000 );
level.player_ready maps\mp\gametypes\_hud::fontPulseInit();
level.starting = createServerFontString( "extrabig", 1.5 );
level.starting setPoint( "CENTER", "CENTER", 0, -20 );
level.starting.sort = 1001;
level.starting setText( game["strings"]["match_starting_in"] );
level.starting.foreground = false;
level.starting.hidewheninmenu = false;
level.timer = createServerTimer( "extrabig", 2.2 );
level.timer setPoint( "CENTER", "CENTER", 0, 0 );
level.timer setTimer(timer);
level.timer.sort = 1001;
level.timer.foreground = false;
level.timer.hideWhenInMenu = false;
wait timer;
level.player_ready destroy();
level.starting destroy();
level.timer destroy();
}
Got any idea what I did wrong?