MUTATOR_HOOKFUNCTION(ca, ClientConnect)
{
- SELFPARAM();
- TRANSMUTE(Observer, this);
+ entity player = M_ARGV(0, entity);
+
+ TRANSMUTE(Observer, player);
return true;
}
M_ARGV(0, float) = ca_teams;
}
-entity ca_LastPlayerForTeam()
+entity ca_LastPlayerForTeam(entity this)
{
- SELFPARAM();
entity last_pl = NULL;
FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
if (!IS_DEAD(it))
return last_pl;
}
-void ca_LastPlayerForTeam_Notify()
+void ca_LastPlayerForTeam_Notify(entity this)
{
if (round_handler_IsActive())
if (round_handler_IsRoundStarted())
{
- entity pl = ca_LastPlayerForTeam();
+ entity pl = ca_LastPlayerForTeam(this);
if (pl)
Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_ALONE);
}
{
entity frag_target = M_ARGV(2, entity);
- ca_LastPlayerForTeam_Notify();
+ ca_LastPlayerForTeam_Notify(frag_target);
if (!allowed_to_spawn)
frag_target.respawn_flags = RESPAWN_SILENT;
if (!warmup_stage)
entity player = M_ARGV(0, entity);
if (player.caplayer == 1)
- ca_LastPlayerForTeam_Notify();
+ ca_LastPlayerForTeam_Notify(player);
return true;
}
entity player = M_ARGV(0, entity);
if (!IS_DEAD(player))
- ca_LastPlayerForTeam_Notify();
+ ca_LastPlayerForTeam_Notify(player);
if (player.killindicator_teamchange == -2)
player.caplayer = 0;
if (player.caplayer)
MUTATOR_HOOKFUNCTION(ca, SpectateSet)
{
- SELFPARAM();
- if (!autocvar_g_ca_spectate_enemies && this.caplayer)
- if (DIFF_TEAM(spec_player, this))
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
+ if (!autocvar_g_ca_spectate_enemies && client.caplayer)
+ if (DIFF_TEAM(targ, client))
return true;
+
return false;
}
MUTATOR_HOOKFUNCTION(ca, SpectateNext)
{
- SELFPARAM();
- if (!autocvar_g_ca_spectate_enemies && this.caplayer)
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
+ if (!autocvar_g_ca_spectate_enemies && client.caplayer)
{
- spec_player = CA_SpectateNext(this, spec_player);
+ targ = CA_SpectateNext(client, targ);
return true;
}
return false;
MUTATOR_HOOKFUNCTION(ca, SpectatePrev)
{
- SELFPARAM();
- if (!autocvar_g_ca_spectate_enemies && this.caplayer)
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+ entity first = M_ARGV(2, entity);
+
+ if (!autocvar_g_ca_spectate_enemies && client.caplayer)
{
- do { spec_player = spec_player.chain; }
- while(spec_player && DIFF_TEAM(spec_player, this));
+ do { targ = targ.chain; }
+ while(targ && DIFF_TEAM(targ, client));
- if (!spec_player)
+ if (!targ)
{
- for (spec_player = spec_first; spec_player && DIFF_TEAM(spec_player, this); spec_player = spec_player.chain);
+ for (targ = first; targ && DIFF_TEAM(targ, client); targ = targ.chain);
- if (spec_player == this.enemy)
+ if (targ == client.enemy)
return MUT_SPECPREV_RETURN;
}
}
{
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
if (IS_PLAYER(it) || it.caplayer == 1)
- ++bot_activerealplayers;
- ++bot_realplayers;
+ ++M_ARGV(0, int);
+ ++M_ARGV(1, int);
});
return true;
}
MUTATOR_HOOKFUNCTION(ca, ClientCommand_Spectate)
{
- SELFPARAM();
- if (this.caplayer)
+ entity player = M_ARGV(0, entity);
+
+ if (player.caplayer)
{
// they're going to spec, we can do other checks
- if (autocvar_sv_spectate && (IS_SPEC(this) || IS_OBSERVER(this)))
- Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CA_LEAVE);
+ if (autocvar_sv_spectate && (IS_SPEC(player) || IS_OBSERVER(player)))
+ Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_CA_LEAVE);
return MUT_SPECCMD_FORCE;
}
MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus)
{
- return set_player.caplayer == 1;
+ entity player = M_ARGV(0, entity);
+
+ return player.caplayer == 1;
}
MUTATOR_HOOKFUNCTION(ca, SetWeaponArena)
{
// most weapons arena
- if (ret_string == "0" || ret_string == "") ret_string = "most";
+ if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most";
}
#endif