+#include "../_all.qh"
+
+#include "mutator.qh"
+
#define _SSMAGIX "SUPERSPEC_OPTIONSFILE_V1"
#define _ISLOCAL ((edict_num(1) == self) ? true : false)
.string superspec_itemfilter; //"classname1 classname2 ..."
float _spectate(entity _player)
-{
+{SELFPARAM();
if(Spectate(_player) == 1)
self.classname = "spectator";
}
void superspec_save_client_conf()
-{
+{SELFPARAM();
string fn = "superspec-local.options";
float fh;
fh = fopen(fn, FILE_WRITE);
if(fh < 0)
{
- dprint("^1ERROR: ^7 superspec can not open ", fn, " for writing.\n");
+ LOG_TRACE("^1ERROR: ^7 superspec can not open ", fn, " for writing.\n");
}
else
{
}
MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
-{
- entity _oldself = self;
+{SELFPARAM();
entity _item = self;
- FOR_EACH_SPEC(self)
+ entity e;
+ FOR_EACH_SPEC(e)
{
+ setself(e);
if(self.superspec_flags & SSF_ITEMMSG)
if(superspec_filteritem(self, _item))
{
{
_spectate(other);
- self = _oldself;
+ setself(this);
return MUT_ITEMTOUCH_CONTINUE;
}
}
if((self.autospec_flags & ASF_SHIELD && _item.invincible_finished) ||
- (self.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
- (self.autospec_flags & ASF_MEGA_AR && _item.classname == "item_armor_large") ||
- (self.autospec_flags & ASF_MEGA_HP && _item.classname == "item_health_mega") ||
- (self.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
+ (self.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
+ (self.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorMega) ||
+ (self.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) ||
+ (self.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
{
if((self.enemy != other) || IS_OBSERVER(self))
}
}
- self = _oldself;
+ setself(this);
return MUT_ITEMTOUCH_CONTINUE;
}
MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
-{
+{SELFPARAM();
#define OPTIONINFO(flag,var,test,text,long,short) \
var = strcat(var, ((flag & test) ? "^2[ON] ^7" : "^1[OFF] ^7")); \
var = strcat(var, text," ^7(^3 ", long, "^7 | ^3", short, " ^7)\n")
return true;
entity _player;
- float _team = 0;
- float found = false;
+ int _team = 0;
+ bool found = false;
if(cmd_argc == 2)
{
- if(argv(1) == "red")
- _team = NUM_TEAM_1;
- else
- _team = NUM_TEAM_2;
+ switch(argv(1))
+ {
+ case "red": _team = NUM_TEAM_1; break;
+ case "blue": _team = NUM_TEAM_2; break;
+ case "yellow": if(ctf_teams >= 3) _team = NUM_TEAM_3; break;
+ case "pink": if(ctf_teams >= 4) _team = NUM_TEAM_4; break;
+ }
}
FOR_EACH_PLAYER(_player)
}
void superspec_hello()
-{
+{SELFPARAM();
if(self.enemy.crypto_idfp == "")
Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID);
}
MUTATOR_HOOKFUNCTION(superspec_ClientConnect)
-{
+{SELFPARAM();
if(!IS_REAL_CLIENT(self))
return false;
fh = fopen(fn, FILE_READ);
if(fh < 0)
{
- dprint("^1ERROR: ^7 superspec can not open ", fn, " for reading.\n");
+ LOG_TRACE("^1ERROR: ^7 superspec can not open ", fn, " for reading.\n");
}
else
{
string _magic = fgets(fh);
if(_magic != _SSMAGIX)
{
- dprint("^1ERROR^7 While reading superspec options file: unknown magic\n");
+ LOG_TRACE("^1ERROR^7 While reading superspec options file: unknown magic\n");
}
else
{
}
MUTATOR_HOOKFUNCTION(superspec_PlayerDies)
-{
- entity _old_self = self;
-
- FOR_EACH_SPEC(self)
+{SELFPARAM();
+ entity e;
+ FOR_EACH_SPEC(e)
{
- if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == _old_self)
+ setself(e);
+ if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == this)
{
if(self.autospec_flags & ASF_SHOWWHAT)
superspec_msg("", "", self, sprintf("^7Following %s^7 due to followkiller\n", frag_attacker.netname), 2);
}
}
- self = _old_self;
+ setself(this);
return false;
}