Making a trickshot only lobby, everything works perfect barring the lag everyone receives when spawning in.
I think it's calling some functions wrong/ in the wrong way. Any help would be appreciated!
Menu calls for self addOpt("Trickshot",::SetupTrickshot);
SetupTrickshot does this
SetupTrickshot()
{
SetDvar("ui_gametype","Trickshot");
map_restart(false);
}
onPlayerSpawned has this
if(GetDvar("ui_gametype") == "Trickshot")
{
self thread PlayerInitTShot();
}
Which then calls this
PlayerInitTShot ()
{
self thread messageplayers();
if(level.gametype == "dm")
{
SetDvar("scr_"+level.gametype+"_scorelimit",1500);
self.kills = 29;
self.pers["kills"] = 29;
self.score = 1450;
self.pers["score"] = 1450;
}
if(level.gametype == "war")
{
SetDvar("scr_"+level.gametype+"_scorelimit",7500);
game["teamScores"][self.pers["team"]] = 7400;
maps\mp\gametypes\_gamescore::updateTeamScore(self.pers["team"]);
level thread maps\mp\gametypes\_gamelogic::pauseTimer();
}
for(;;)
{
self waittill("spawned_player");
wait 0.02;
self thread SETWeapon();
if(self AdsButtonPressed())
{
self allowADS(0);
self iPrintln("^1ERROR: ^7No aiming in.");
}
wait .3;
}
if(isDefined(self.PlayerInitTShot))
return;
self.PlayerInitTShot = true;
level.GameModeSelected = true;
self endon("disconnect");
level endon("EndTrickshot");
}
SETWeapon function is this
SETWeapon()
{
self takeallweapons();
self giveWeapon( "cheytac_fmj_mp", 8, false );
self giveWeapon("usp_silencer_tactical_mp");
self maps\mp\perks\_perks::givePerk("flare_mp");
self setWeaponAmmoClip("usp_silencer_tactical_mp", 2 );
self setWeaponAmmoStock("usp_silencer_tactical_mp", 2 );
if (self getCurrentWeapon() == "none")
{
self switchToWeapon("cheytac_fmj_mp");
}
}
Works perfect but lags so bad when new people connect, if i restart the game it sorts it out but not all the time
|