So for the past couple days i've been on here asking quite a lot of questions and people must be really pissed off and im sorry. But i have just one more request.
before i think the mod i was working on is finally ready.
I cant seem to find the syntax error in my code(Probally alot in there) and i was just wondering if u guys could just check over it?
before i think the mod i was working on is finally ready.
I cant seem to find the syntax error in my code(Probally alot in there) and i was just wondering if u guys could just check over it?
Code:
onPlayerConnect()
{
for(;;)
{
level waittill( "connected", player );
level thread DisconnectFix(self);
player.pers["rankxp"] = player getRankXpStat();
player.pers["codpoints"] = player getCodPointsStat();
player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" );
rankId = player getRankForXp( player getRankXP() );
player.pers["rank"] = rankId;
player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" );
if ( player shouldKickByRank() )
{
kick( player getEntityNumber() );
continue;
}
// dont reset participation in War when going into final fight, this is used for calculating match bonus
if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) )
player.pers["participation"] = 0;
player.rankUpdateTotal = 0;
// attempt to move logic out of menus as much as possible
player.cur_rankNum = rankId;
assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" );
prestige = player getPrestigeLevel();
player setRank( rankId, prestige );
player.pers["prestige"] = prestige;
if ( !isDefined( player.pers["summary"] ) )
{
player.pers["summary"] = [];
player.pers["summary"]["xp"] = 0;
player.pers["summary"]["score"] = 0;
player.pers["summary"]["challenge"] = 0;
player.pers["summary"]["match"] = 0;
player.pers["summary"]["misc"] = 0;
player.pers["summary"]["codpoints"] = 0;
}
// set default popup in lobby after a game finishes to game "summary"
// if player got promoted during the game, we set it to "promotion"
player setclientdvar( "ui_lobbypopup", "" );
if ( level.rankedMatch )
{
player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false );
player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false );
player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false );
}
player.explosiveKills[0] = 0;
player.xpGains = [];
Player thread ModInfo();
player thread onPlayerSpawned();
player thread onJoinedTeam();
player thread onJoinedSpectators();
}
}
DisconnectFix(player)
{
if(player.pers["team"] == game["attackers"])
{
while(isDefined(player))
{
wait 0.05;
}
new = level.players[RandomInt(level.players.size)];
while(new.pers["team"] == game["attackers"])
{
new = level.players[RandomInt(level.players.size)];
}
new maps\mp\gametypes\_teams::changeTeam(game["attackers"]);
}
}
onJoinedTeam()
{
self endon("disconnect");
for(;;)
{
self waittill("joined_team");
self thread removeRankHUD();
if(self.pers["team"] == game["attackers"])
{
if(attack >= 4)
{
self maps\mp\gametypes\_teams::changeTeam(game["defenders"]);
}
else
{
attack++;
}
}
}
onJoinedSpectators()
{
self endon("disconnect");
for(;;)
{
self waittill("joined_spectators");
self thread removeRankHUD();
}
}
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = NewScoreHudElem(self);
self.hud_rankscroreupdate.horzAlign = "center";
self.hud_rankscroreupdate.vertAlign = "middle";
self.hud_rankscroreupdate.alignX = "center";
self.hud_rankscroreupdate.alignY = "middle";
self.hud_rankscroreupdate.x = 0;
if( self IsSplitscreen() )
self.hud_rankscroreupdate.y = -15;
else
self.hud_rankscroreupdate.y = -60;
self.hud_rankscroreupdate.font = "default";
self.hud_rankscroreupdate.fontscale = 2.0;
self.hud_rankscroreupdate.archived = false;
self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
self.hud_rankscroreupdate.alpha = 0;
self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
self.hud_rankscroreupdate.overrridewhenindemo = true;
}
}
}
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self thread Loadout();
wait 5.0;
self thread after();
if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = NewScoreHudElem(self);
self.hud_rankscroreupdate.horzAlign = "center";
self.hud_rankscroreupdate.vertAlign = "middle";
self.hud_rankscroreupdate.alignX = "center";
self.hud_rankscroreupdate.alignY = "middle";
self.hud_rankscroreupdate.x = 0;
if( self IsSplitscreen() )
self.hud_rankscroreupdate.y = -15;
else
self.hud_rankscroreupdate.y = -60;
self.hud_rankscroreupdate.font = "default";
self.hud_rankscroreupdate.fontscale = 2.0;
self.hud_rankscroreupdate.archived = false;
self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
self.hud_rankscroreupdate.alpha = 0;
self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
self.hud_rankscroreupdate.overrridewhenindemo = true;
}
}
}
Loadout()
{
if(self.team == "axis")
{
self thread Hunters();
}
if(self.team == "allies")
{
self thread Hunted();
}
}
Hunters()
{
self thread maps\mp\gametypes\_hud_message::hintMessage("^1Hunt THEM!");
self takeAllWeapons();
self giveWeapon( "M14_mp", 0, false );
self giveWeapon( "Willy_Pete_mp" );
setPerk("specialty_unlimitedsprint");
setPerk("specialty_movefaster");
setPerk("specialty_gpsjammer");
self Hide();
self.maxhealth = 200;
self.health = 200;
self.jump = 15
self thread death();
}
Hunted()
{
self takeAllWeapons();
self giveWeapon( "Ak74u_dualclip_mp", 5 false); self GiveMaxAmmo(Ak74u_dualclip_mp");
self giveWeapon(" acoustic_sensor_mp")
self giveWeapon( "Spas12_mp", 5, false); self GiveMaxAmmo("Spas12_mp");
self giveWeapon( "Decoy_mp",2);
setPerk ("specialty_bulletpenetration");
setPerk ("specialty_longersprint");
setPerk ("specialty_loudenemies");
self thread maps\mp\gametypes\_hud_message::hintMessage("^1Hunt or be Hunted!");
self thread death();
}
after()
{
if(level.aliveCount["axis"] == 0)
{
self thread maps\mp\gametypes\_hud_message::hintMessage("^2Humans Survived the Hunt");
wait 7.5;
Map_Restart( true );
}
if(level.aliveCount["allies"] == 0)
{
self thread maps\mp\gametypes\_hud_message::hintMessage("^1All Humans have been hunted!");
wait 7.5;
Map_Restart( true );
}
wait 1.0;
self thread after();
}
death()
{
self waittill("death");
if ( self is_bot() )
{
self thread maps\mp\gametypes\_hud_message::hintMessage("^3Bots Don't Change Squad!");
}
else
{
if(self.team == "axis")
{
self thread maps\mp\gametypes\_hud_message::hintMessage("^2The Hunter");
self notify("menuresponse", game["menu_team"], "allies");
}
if(self.team == "allies")
{
self thread maps\mp\gametypes\_hud_message::hintMessage("^2The Hunted");
self notify("menuresponse", game["menu_team"], "axis");
}
}
}