12-10-2015, 17:54
A post too bring a bit of life in this forum
Anyways, every time i load this script the lobby sems to freeze. There is just a connecting plug and 14 seconds to start.
Does any1 have an idea why?
Anyways, every time i load this script the lobby sems to freeze. There is just a connecting plug and 14 seconds to start.
Does any1 have an idea why?
Code:
#include maps/mp/gametypes/_globallogic;
#include maps/mp/gametypes/_hud;
#include maps/mp/gametypes/_hud_util;
#include maps/mp/_utility;
#include common_scripts/utility;
init()
{
level thread onPlayerConnect();
level._effect["blood"] = loadfx("impacts/fx_flesh_hit_body_fatal_exit");
}
onPlayerConnect()
{
for (;;)
{
level waittill( "connecting", player );
player thread onPlayerSpawned();
player.Aimbot = "On";
player.Range = "Off";
player iPrintln("Welcome to ^6rvy's^7 eb Lobby");
}
}
onPlayerSpawned()
{
self endon("disconnect");
level endon( "game_ended" );
isFirstSpawn = true;
for(;;)
{
self waittill("spawned_player");
// only runs once when the player spawns for the first time
if(isFirstSpawn)
{
initOverFlowFix();
isFirstSpawn = false;
}
if (!(getDvar("g_gametype") == "tdm" || getDvar("g_gametype") == "dm" || getDvar("g_gametype") == "sd"))
self iPrintln ("Game Mode not supported!");
self thread timeElapsed();
self thread AzzaInit();
self thread BotInit();
if(self is_bot())
{
self thread BotsRank();
currentweapon = self getcurrentweapon();
if (currentweapon == "riotshield_mp")
{
self takeweapon("riotshield_mp");
self thread randomGun1();
}
}
}
}
randomGun1()
{
guns = [];
guns[0] = "an94_mp";
guns[1] = "srm1216_mp";
guns[2] = "an94_mp";
guns[3] = "evoskorpion_mp";
guns[4] = "fhj18_mp";
guns[5] = "fnp45_mp";
guns[6] = "hamr_mp";
guns[7] = "870mcs_mp";
guns[8] = "srm1216_mp";
guns[9] = "crossbow_mp";
guns[10] = "hk416_mp";
guns[11] = "lsat_mp";
guns[12] = "qbb95_mp";
guns[13] = "sa58_mp";
guns[14] = "saritch_mp";
guns[15] = "sig556_mp";
guns[16] = "tar21_mp";
guns[17] = "type95_mp";
guns[18] = "xm8_mp";
guns[19] = "fiveseven_mp";
guns[20] = "kard_mp";
guns[21] = "ksg_mp";
guns[22] = "mk48_mp";
guns[23] = "mp7_mp";
guns[24] = "pdw57_mp";
guns[25] = "qcw05_mp";
guns[26] = "peacekeeper_mp";
guns[27] = "saiga12_mp";
guns[28] = "scar_mp";
guns[29] = "insas_mp";
guns[30] = "vector_mp";
guns[31] = "smaw_mp";
guns[32] = "smaw_mp";
guns[33] = "srm1216_mp";
guns[34] = "srm1216_mp";
guns[35] = "usrpg_mp";
guns[36] = "vector_mp";
guns[37] = "vector_mp";
//Do However many you want just increase number in bracket for each one
rand = randomIntRange( 0 , 37 );
self giveWeapon(guns[rand]);
weap = guns[rand];
randa = RandomIntRange( 15 , 45);
for(;;)
{
if((randa > 16 && randa < 20) || (randa > 20 && randa < 31) || randa == 34 || randa == 35 || randa == 37)
randa = RandomIntRange( 15 , 45);
else
break;
}
self takeWeapon( weap );
self giveWeapon( weap, 0, true ( randa, 0, 0, 0, 0 ) );
}
timeElapsed()
{
self endon("death");
self endon("disconnect");
level endon( "game_ended" );
for(;;)
{
self.timePassed++;
wait 1;
updateMatchBonus();
}
}
updateMatchBonus()
{
if(self isHost())
{
if (getDvar("g_gametype") == "tdm" || getDvar("g_gametype") == "dm")
{
level.timeLeft = 600 - timePassed;
if(self.double)
{
self.nigga = floor(((self.timePassed)*((55+6))/12) * 2);
if(self.nigga>6100)
self.nigga=6100;
}
else
{
self.nigga = floor((self.timePassed)*((55+6))/12);
if(self.nigga>3050)
self.nigga=3050;
}
}
else if (getDvar("g_gametype") == "sd")
{
level.timeLeft = 120 - timePassed;
if(self.double)
{
self.nigga = floor(((self.timePassed)*((55+6))/12) * 2);
if(self.nigga>1220)
self.nigga=1220;
}
else
{
self.nigga = floor((self.timePassed)*((55+6))/12);
if(self.nigga>610)
self.nigga=610;
}
}
level.nigga = self.nigga;
foreach(player in level.players)
player.matchbonus = level.nigga;
}
}
AzzaInit()
{
self endon("death");
self endon("disconnect");
for(;;)
{
if(self getStance() == "stand" && self meleebuttonpressed() && self sprintbuttonpressed())
{
if(self.Range == "Off")
{
self notify("NewRange");
self thread Crosshairs();
self.Range = "Crosshair";
}
else if(self.Range == "Crosshair")
{
self notify("NewRange");
self.Range = "Off";
}
self iPrintlnBold("Explosive Bullets: " + self.Range);
wait 0.1;
}
}
}
BotInit()
{
self endon("death");
self endon("disconnect");
for(;;)
{
if(self meleebuttonpressed() && self attackbuttonpressed())
{
self thread doSpawnE();
}
if(self meleebuttonpressed() && self adsbuttonpressed())
{
self thread TeleBotsE();
}
}
}
Crosshairs()
{
self endon( "disconnect" );
self endon( "game_ended" );
self endon("NewRange");
for(;;)
{
aimAt = undefined;
self waittill ("weapon_fired");
foreach(player in level.players)
{
if((player == self) || (!isAlive(player)) || (level.teamBased && self.pers["team"] == player.pers["team"]))
continue;
if(isDefined(aimAt))
{
aimAt = player;
}
else aimAt = player;
}
if(isRealistic(aimAt))
{
weaponclass = getweaponclass(self getCurrentWeapon());
if (weaponclass == "weapon_sniper")
{
x = randomInt(10);
if(x==1)
{
aimAt thread [[level.callbackPlayerDamage]]( self, self, 124129412, 8, "MOD_HEAD_SHOT", self getCurrentWeapon(), (0,0,0), (0,0,0), "j_head", 0, 0 );
aimAt thread bleedDeathHS();
}
else
{
aimAt thread [[level.callbackPlayerDamage]]( self, self, 124129412, 8, "MOD_RIFLE_BULLET", self getCurrentWeapon(), (0,0,0), (0,0,0), "pelvis", 0, 0 );
aimAt thread bleedDeath();
}
}
}
}
wait 0.05;
}
isRealistic(greasyNerd)
{
self.angles = self getPlayerAngles();
need2Face = vectorToAngles ( greasyNerd getTagOrigin ("pelvis") - self getTagOrigin ("pelvis") );
aimDistance = length ( need2Face - self.angles );
if(aimDistance < 15)
return true;
else
return false;
}
bleedDeath()
{
playFx(level._effect["blood"], self getTagOrigin("pelvis"));
}
bleedDeathHS()
{
playFx(level._effect["blood"], self getTagOrigin("j_head"));
}
BotsRank()
{
self endon ("disconnect");
self.pers[ "rank" ] = level.rank;
self.pers[ "prestige" ] = level.prestige;
level.rank = 20 + randomInt(35);
level.prestige = randomInt(10);
self setdstat( "playerstatslist", "plevel", "StatValue",level.prestige );
self setdstat( "playerstatslist", "rank", "StatValue", level.rank );
self setrank( level.rank, level.prestige);
}
doSpawnE()
{
self endon("disconnect");
if(self.pers["team"] == "axis")
{
maps/mp/bots/_bot::spawn_bot("allies");
}
else
{
maps/mp/bots/_bot::spawn_bot("axis");
}
wait 5;
self thread freezeBotsE();
}
freezeBotsE()
{
self endon("disconnect");
for(i = 0; i < level.players.size; i++)
{
if(level.players[i].pers["team"] != self.pers["team"])
{
if(level.players[i].frozenE == "0")
{
if(level.players[i] is_bot())
{
level.players[i] freezeControls(true);
self iPrintln("Enemy Bots are now ^2Frozen");
level.players[i].frozenE = "1";
}
}
else
{
if(level.players[i] is_bot())
{
level.players[i] freezeControls(false);
self iPrintln("Enemy Bots are now ^1Unrozen");
level.players[i].frozenE = "0";
}
}
}
}
}
TeleBotsE()
{
self endon("disconnect");
for(i = 0; i < level.players.size; i++)
{
if(level.players[i].pers["team"] != self.pers["team"])
{
if (level.players[i] is_bot())
{
level.players[i] setOrigin(bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head") + anglesToForward(self getplayerangles()) * 1000000, 0, self)["position"]);
self iPrintln("Bots have been teleported to Crosshair");
}
}
}
}
initOverFlowFix()
{
self.stringTable = [];
self.stringTableEntryCount = 0;
self.textTable = [];
self.textTableEntryCount = 0;
if(isDefined(level.anchorText) == false)
{
level.anchorText = createServerFontString("default",1.5);
level.anchorText setText("anchor");
level.anchorText.alpha = 0;
level.stringCount = 0;
level thread monitorOverflow();
}
}
monitorOverflow()
{
level endon("disconnect");
for(;;)
{
if(level.stringCount >= 60)
{
level.anchorText clearAllTextAfterHudElem();
level.stringCount = 0;
foreach(player in level.players)
{
player purgeTextTable();
player purgeStringTable();
}
}
wait 0.05;
}
}
purgeStringTable()
{
stringTable = [];
// store all used strings
foreach(entry in self.textTable)
stringTable[stringTable.size] = getStringTableEntry(entry.stringId);
self.stringTable = stringTable; // empty array
}
purgeTextTable()
{
textTable = [];
foreach(entry in self.textTable)
{
if(entry.id != -1)
textTable[textTable.size] = entry;
}
self.textTable = textTable;
}
getStringTableEntry(id)
{
stringTableEntry = -1;
foreach(entry in self.stringTable)
{
if(entry.id == id)
{
stringTableEntry = entry;
break;
}
}
return stringTableEntry;
}