]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
ClientConnect: cleanup
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 24 Dec 2015 02:33:17 +0000 (13:33 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 24 Dec 2015 02:36:48 +0000 (13:36 +1100)
14 files changed:
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/bot/bot.qc
qcsrc/server/bot/bot.qh
qcsrc/server/cheats.qc
qcsrc/server/cheats.qh
qcsrc/server/cl_client.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_hook.qh
qcsrc/server/ipban.qc
qcsrc/server/playerdemo.qc
qcsrc/server/playerdemo.qh

index 9db086a8bbc0b5acffc2e1a4ebaa0eb6ea5fa3e8..0710a49d08f69fc635da4442f3a35a6b9c948bbf 100644 (file)
@@ -877,10 +877,6 @@ void WaypointSprite_Init()
     waypointsprite_deadlifetime = autocvar_sv_waypointsprite_deadlifetime;
 }
 
-void WaypointSprite_InitClient(entity e)
-{
-}
-
 void WaypointSprite_Kill(entity wp)
 {
     if (!wp) return;
index c9a553431940139b4fd58e8155b7ef7e32f09a84..4e3ceb0e5749d3e14e74d0e99b852a8dbb198e29 100644 (file)
@@ -155,7 +155,6 @@ void WaypointSprite_HelpMePing(entity e);
 void WaypointSprite_FadeOutIn(entity e, float t);
 
 void WaypointSprite_Init();
-void WaypointSprite_InitClient(entity e);
 
 void WaypointSprite_Kill(entity wp);
 
index 79442299e197343ccd6b4c32aa769c0f7bf5e173..877d41657ca9741e77bc7c09f03a0b3aa0cb1f42 100644 (file)
@@ -239,10 +239,10 @@ void anticheat_endframe()
        anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
 }
 
-void anticheat_init()
-{SELFPARAM();
-       self.anticheat_speedhack_offset = 0;
-       self.anticheat_jointime = servertime;
+void anticheat_init(entity this)
+{
+       this.anticheat_speedhack_offset = 0;
+       this.anticheat_jointime = servertime;
 }
 
 void anticheat_shutdown()
index 9d2aa94050b0af16e39de8cabbf64493117afe30..5e6599b7e01730b7ce82a2948d0fb951e790a7eb 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef ANTICHEAT_H
 #define ANTICHEAT_H
 
-void anticheat_init();
+void anticheat_init(entity this);
 void anticheat_report();
 void anticheat_shutdown();
 
index b125564716ae122e5a6cd4dd415e4e6d4a7e1189..671014b806d4790a6406fa4a2d7f69a771354eb2 100644 (file)
@@ -407,10 +407,9 @@ void bot_clientdisconnect()
                bot_waypoint_queue_owner = world;
 }
 
-void bot_clientconnect()
-{SELFPARAM();
-       if (!IS_BOT_CLIENT(self))
-               return;
+void bot_clientconnect(entity this)
+{
+       if (!IS_BOT_CLIENT(this)) return;
        self.bot_preferredcolors = self.clientcolors;
        self.bot_nextthink = time - random();
        self.lag_func = bot_lagfunc;
index 12cd763e1fa2741c0498d63fc055ab3a43bf01b9..7927942ea73fdd5d2a34843d512f781054500027 100644 (file)
@@ -99,7 +99,7 @@ void bot_custom_weapon_priority_setup();
 void bot_endgame();
 void bot_relinkplayerlist();
 void bot_clientdisconnect();
-void bot_clientconnect();
+void bot_clientconnect(entity this);
 void bot_removefromlargestteam();
 void bot_removenewest();
 void autoskill(float factor);
index cdad6d9fea184ca1a8aaa5d484b9cf476b38bedc..558fa26289b71756b3b6a102537864168ed5cea7 100644 (file)
@@ -34,7 +34,6 @@ float CheatCommand(float argc) { return 0; }
 float CheatFrame() { return 0; }
 void CheatInit() { cheatcount_total = world.cheatcount; }
 void CheatShutdown() { }
-void CheatInitClient() { }
 void CheatShutdownClient() { }
 void Drag_MoveDrag(entity from, entity to) { }
 
@@ -54,10 +53,6 @@ void CheatShutdown()
 {
 }
 
-void CheatInitClient()
-{
-}
-
 void CheatShutdownClient()
 {
 }
index 122d2f7e94becb6e32645b2b68a7e356762f9c53..16d17ca12e9c5293791c66607b10a150736ff342 100644 (file)
@@ -9,7 +9,6 @@ float cheatcount_total;
 .float cheatcount;
 void CheatInit();
 void CheatShutdown();
-void CheatInitClient();
 void CheatShutdownClient();
 float CheatImpulse(float i);
 float CheatCommand(float argc);
index 6c3e2ec0c5860c7759d95c156501781d65d16948..32ec6eb03c9ec32963287fa2075975639c9f307a 100644 (file)
@@ -58,56 +58,44 @@ void send_CSQC_teamnagger() {
 
 bool ClientData_Send(entity this, entity to, int sf)
 {
-       if(to != self.owner)
-       {
-               error("wtf");
-               return false;
-       }
-
-       entity e;
+       assert(to == this.owner, return false);
 
-       e = to;
-       if(IS_SPEC(to))
-               e = to.enemy;
+       entity e = to;
+       if (IS_SPEC(e)) e = e.enemy;
 
        sf = 0;
-
-       if(e.race_completed)
-               sf |= 1; // forced scoreboard
-       if(to.spectatee_status)
-               sf |= 2; // spectator ent number follows
-       if(e.zoomstate)
-               sf |= 4; // zoomed
-       if(e.porto_v_angle_held)
-               sf |= 8; // angles held
+       if (e.race_completed)       sf |= 1; // forced scoreboard
+       if (to.spectatee_status)    sf |= 2; // spectator ent number follows
+       if (e.zoomstate)            sf |= 4; // zoomed
+       if (e.porto_v_angle_held)   sf |= 8; // angles held
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA);
        WriteByte(MSG_ENTITY, sf);
 
-       if(sf & 2)
+       if (sf & 2)
+       {
                WriteByte(MSG_ENTITY, to.spectatee_status);
-
-       if(sf & 8)
+       }
+       if (sf & 8)
        {
                WriteAngle(MSG_ENTITY, e.v_angle.x);
                WriteAngle(MSG_ENTITY, e.v_angle.y);
        }
-
        return true;
 }
 
-void ClientData_Attach()
-{SELFPARAM();
+void ClientData_Attach(entity this)
+{
        Net_LinkEntity(this.clientdata = new(clientdata), false, 0, ClientData_Send);
        make_pure(this.clientdata);
        self.clientdata.drawonlytoclient = this;
        self.clientdata.owner = this;
 }
 
-void ClientData_Detach()
-{SELFPARAM();
-       remove(self.clientdata);
-       self.clientdata = world;
+void ClientData_Detach(entity this)
+{
+       remove(this.clientdata);
+       self.clientdata = NULL;
 }
 
 void ClientData_Touch(entity e)
@@ -728,15 +716,15 @@ void SetChangeParms ()
 DecodeLevelParms
 =============
 */
-void DecodeLevelParms ()
-{SELFPARAM();
+void DecodeLevelParms(entity this)
+{
        // load parms
-       self.parm_idlesince = parm1;
-       if(self.parm_idlesince == -(86400 * 366))
-               self.parm_idlesince = time;
+       this.parm_idlesince = parm1;
+       if (this.parm_idlesince == -(86400 * 366))
+               this.parm_idlesince = time;
 
        // whatever happens, allow 60 seconds of idling directly after connect for map loading
-       self.parm_idlesince = max(self.parm_idlesince, time - sv_maxidle + 60);
+       this.parm_idlesince = max(this.parm_idlesince, time - sv_maxidle + 60);
 
        MUTATOR_CALLHOOK(DecodeLevelParms);
 }
@@ -994,225 +982,188 @@ void ClientPreConnect ()
 }
 #endif
 
-/*
+/**
 =============
 ClientConnect
 
 Called when a client connects to the server
 =============
 */
-void DecodeLevelParms ();
-void ClientConnect ()
+void ClientConnect()
 {
        SELFPARAM();
-       ClientState_attach(this);
-       float t;
-
-       if(IS_CLIENT(self))
-       {
-               LOG_INFO("Warning: ClientConnect, but already connected!\n");
-               return;
-       }
-
-       if(Ban_MaybeEnforceBanOnce(self))
-               return;
-
-       DecodeLevelParms();
+       if (Ban_MaybeEnforceBanOnce(this)) return;
+       assert(!IS_CLIENT(this), return);
+       assert(player_count >= 0, player_count = 0);
+       this.classname = "player_joining";
+       this.flags = FL_CLIENT;
 
 #ifdef WATERMARK
-       Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_WATERMARK, WATERMARK);
+       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_WATERMARK, WATERMARK);
 #endif
-
-       self.classname = "player_joining";
-
-       self.flags = FL_CLIENT;
-       self.version_nagtime = time + 10 + random() * 10;
-
-       if(player_count<0)
-       {
-               LOG_TRACE("BUG player count is lower than zero, this cannot happen!\n");
-               player_count = 0;
-       }
+       this.version_nagtime = time + 10 + random() * 10;
 
        // TODO: xonstat elo.txt support, until then just 404s
-       if(false && IS_REAL_CLIENT(self)) { PlayerStats_PlayerBasic_CheckUpdate(self); }
+       if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
 
-       PlayerScore_Attach(self);
-       ClientData_Attach();
-       accuracy_init(self);
-       Inventory_new(self);
-
-       bot_clientconnect();
-
-       playerdemo_init();
-
-       anticheat_init();
+       ClientState_attach(this);
+       // TODO: fold all of these into ClientState
+       DecodeLevelParms(this);
+       PlayerScore_Attach(this);
+       ClientData_Attach(this);
+       accuracy_init(this);
+       Inventory_new(this);
+       playerdemo_init(this);
+       anticheat_init(this);
+       entcs_attach(this);
+       W_HitPlotOpen(this);
+
+       bot_clientconnect(this);
 
        // identify the right forced team
-       if(autocvar_g_campaign)
+       if (autocvar_g_campaign)
        {
-               if(IS_REAL_CLIENT(self)) // only players, not bots
+               if (IS_REAL_CLIENT(this)) // only players, not bots
                {
-                       switch(autocvar_g_campaign_forceteam)
+                       switch (autocvar_g_campaign_forceteam)
                        {
-                               case 1: self.team_forced = NUM_TEAM_1; break;
-                               case 2: self.team_forced = NUM_TEAM_2; break;
-                               case 3: self.team_forced = NUM_TEAM_3; break;
-                               case 4: self.team_forced = NUM_TEAM_4; break;
-                               default: self.team_forced = 0;
+                               case 1: this.team_forced = NUM_TEAM_1; break;
+                               case 2: this.team_forced = NUM_TEAM_2; break;
+                               case 3: this.team_forced = NUM_TEAM_3; break;
+                               case 4: this.team_forced = NUM_TEAM_4; break;
+                               default: this.team_forced = 0;
                        }
                }
        }
-       else if(PlayerInIDList(self, autocvar_g_forced_team_red))
-               self.team_forced = NUM_TEAM_1;
-       else if(PlayerInIDList(self, autocvar_g_forced_team_blue))
-               self.team_forced = NUM_TEAM_2;
-       else if(PlayerInIDList(self, autocvar_g_forced_team_yellow))
-               self.team_forced = NUM_TEAM_3;
-       else if(PlayerInIDList(self, autocvar_g_forced_team_pink))
-               self.team_forced = NUM_TEAM_4;
-       else if(autocvar_g_forced_team_otherwise == "red")
-               self.team_forced = NUM_TEAM_1;
-       else if(autocvar_g_forced_team_otherwise == "blue")
-               self.team_forced = NUM_TEAM_2;
-       else if(autocvar_g_forced_team_otherwise == "yellow")
-               self.team_forced = NUM_TEAM_3;
-       else if(autocvar_g_forced_team_otherwise == "pink")
-               self.team_forced = NUM_TEAM_4;
-       else if(autocvar_g_forced_team_otherwise == "spectate")
-               self.team_forced = -1;
-       else if(autocvar_g_forced_team_otherwise == "spectator")
-               self.team_forced = -1;
-       else
-               self.team_forced = 0;
-
-       if(!teamplay)
-               if(self.team_forced > 0)
-                       self.team_forced = 0;
+       else if (PlayerInIDList(this, autocvar_g_forced_team_red))    this.team_forced = NUM_TEAM_1;
+       else if (PlayerInIDList(this, autocvar_g_forced_team_blue))   this.team_forced = NUM_TEAM_2;
+       else if (PlayerInIDList(this, autocvar_g_forced_team_yellow)) this.team_forced = NUM_TEAM_3;
+       else if (PlayerInIDList(this, autocvar_g_forced_team_pink))   this.team_forced = NUM_TEAM_4;
+       else switch (autocvar_g_forced_team_otherwise)
+       {
+               default: this.team_forced = 0; break;
+               case "red": this.team_forced = NUM_TEAM_1; break;
+               case "blue": this.team_forced = NUM_TEAM_2; break;
+               case "yellow": this.team_forced = NUM_TEAM_3; break;
+               case "pink": this.team_forced = NUM_TEAM_4; break;
+               case "spectate":
+               case "spectator":
+                       this.team_forced = -1;
+                       break;
+       }
+       if (!teamplay && this.team_forced > 0) this.team_forced = 0;
 
-       JoinBestTeam(self, false, false); // if the team number is valid, keep it
+       JoinBestTeam(this, false, false); // if the team number is valid, keep it
 
-       if((autocvar_sv_spectate == 1) || autocvar_g_campaign || self.team_forced < 0) {
-               self.classname = STR_OBSERVER;
+       if (autocvar_sv_spectate || autocvar_g_campaign || this.team_forced < 0) {
+               this.classname = STR_OBSERVER;
        } else {
-               if(teamplay)
+               if (!teamplay || autocvar_g_balance_teams)
                {
-                       if(autocvar_g_balance_teams)
-                       {
-                               self.classname = STR_PLAYER;
-                               campaign_bots_may_start = 1;
-                       }
-                       else
-                       {
-                               self.classname = STR_OBSERVER; // do it anyway
-                       }
+                       this.classname = STR_PLAYER;
+                       campaign_bots_may_start = 1;
                }
                else
                {
-                       self.classname = STR_PLAYER;
-                       campaign_bots_may_start = 1;
+                       this.classname = STR_OBSERVER; // do it anyway
                }
        }
 
-       self.playerid = (playerid_last = playerid_last + 1);
-
-       PlayerStats_GameReport_AddEvent(sprintf("kills-%d", self.playerid));
+       this.playerid = ++playerid_last;
 
-    if(IS_BOT_CLIENT(self))
-        PlayerStats_GameReport_AddPlayer(self);
+       PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
 
-       if(autocvar_sv_eventlog)
-               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(etof(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
+       // always track bots, don't ask for cl_allow_uidtracking
+    if (IS_BOT_CLIENT(this)) PlayerStats_GameReport_AddPlayer(this);
 
-       LogTeamchange(self.playerid, self.team, 1);
+       if (autocvar_sv_eventlog)
+               GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", this.netname));
 
-       self.just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
+       LogTeamchange(this.playerid, this.team, 1);
 
-       self.netname_previous = strzone(self.netname);
+       this.just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
 
-       if(IS_PLAYER(self) && teamplay)
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(self, INFO_JOIN_CONNECT_TEAM_), self.netname);
-       else
-               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_CONNECT, self.netname);
+       this.netname_previous = strzone(this.netname);
 
-       stuffcmd(self, strcat(clientstuff, "\n"));
-       stuffcmd(self, "cl_particles_reloadeffects\n"); // TODO do we still need this?
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, (teamplay ? APP_TEAM_ENT_4(this, INFO_JOIN_CONNECT_TEAM_) : INFO_JOIN_CONNECT), this.netname);
 
-       FixClientCvars(self);
+       stuffcmd(this, clientstuff, "\n");
+       stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
 
-       // spawnfunc_waypoint sprites
-       WaypointSprite_InitClient(self);
+       FixClientCvars(this);
 
-       // Wazat's grappling hook
-       SetGrappleHookBindings();
+       // Grappling hook
+       stuffcmd(this, "alias +hook +button6\n");
+       stuffcmd(this, "alias -hook -button6\n");
 
        // Jetpack binds
-       stuffcmd(self, "alias +jetpack +button10\n");
-       stuffcmd(self, "alias -jetpack -button10\n");
+       stuffcmd(this, "alias +jetpack +button10\n");
+       stuffcmd(this, "alias -jetpack -button10\n");
 
        // get version info from player
-       stuffcmd(self, "cmd clientversion $gameversion\n");
+       stuffcmd(this, "cmd clientversion $gameversion\n");
 
        // get other cvars from player
        GetCvars(0);
 
        // notify about available teams
-       if(teamplay)
+       if (teamplay)
        {
-               CheckAllowedTeams(self);
-               t = 0; if(c1 >= 0) t |= 1; if(c2 >= 0) t |= 2; if(c3 >= 0) t |= 4; if(c4 >= 0) t |= 8;
-               stuffcmd(self, strcat("set _teams_available ", ftos(t), "\n"));
+               CheckAllowedTeams(this);
+               int t = 0;
+               if (c1 >= 0) t |= BIT(0);
+               if (c2 >= 0) t |= BIT(1);
+               if (c3 >= 0) t |= BIT(2);
+               if (c4 >= 0) t |= BIT(3);
+               stuffcmd(this, sprintf("set _teams_available %d\n", t));
        }
        else
-               stuffcmd(self, "set _teams_available 0\n");
-
-       entcs_attach(self);
+       {
+               stuffcmd(this, "set _teams_available 0\n");
+       }
 
        bot_relinkplayerlist();
 
-       self.spectatortime = time;
-       if(blockSpectators)
+       this.spectatortime = time;
+       if (blockSpectators)
        {
-               Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
        }
 
-       self.jointime = time;
-       self.allowed_timeouts = autocvar_sv_timeout_number;
+       this.jointime = time;
+       this.allowed_timeouts = autocvar_sv_timeout_number;
 
-       if(IS_REAL_CLIENT(self))
+       if (IS_REAL_CLIENT(this))
        {
-               if(!autocvar_g_campaign)
+               if (!autocvar_g_campaign)
                {
-                       self.motd_actived_time = -1;
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+                       this.motd_actived_time = -1;
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
                }
 
-               if(g_weaponarena_weapons == WEPSET(TUBA))
-                       stuffcmd(self, "cl_cmd settemp chase_active 1\n");
+               if (g_weaponarena_weapons == WEPSET(TUBA))
+                       stuffcmd(this, "cl_cmd settemp chase_active 1\n");
        }
 
-       if(!sv_foginterval && world.fog != "")
-               stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
-
-       W_HitPlotOpen(self);
+       if (!sv_foginterval && world.fog != "")
+               stuffcmd(this, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
 
-       if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca && !g_cts && !g_race) // teamnagger is currently bad for ca, race & cts
-               send_CSQC_teamnagger();
+       if (autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)))
+               if (!g_ca && !g_cts && !g_race) // teamnagger is currently bad for ca, race & cts
+                       send_CSQC_teamnagger();
 
-       CheatInitClient();
+       CSQCMODEL_AUTOINIT(this);
 
-       CSQCMODEL_AUTOINIT(self);
+       this.model_randomizer = random();
 
-       self.model_randomizer = random();
+       if (IS_REAL_CLIENT(this))
+               sv_notice_join(this);
 
-       if(IS_REAL_CLIENT(self))
-               sv_notice_join(self);
-
-       for (entity e = world; (e = findfloat(e, init_for_player_needed, 1)); ) {
-               WITH(entity, self, e, e.init_for_player(this));
-       }
+       FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
+               WITH(entity, self, it, it.init_for_player(it));
+       });
 
-       MUTATOR_CALLHOOK(ClientConnect, self);
+       MUTATOR_CALLHOOK(ClientConnect, this);
 }
 /*
 =============
@@ -1285,7 +1236,7 @@ void ClientDisconnect ()
 
        accuracy_free(self);
        Inventory_delete(self);
-       ClientData_Detach();
+       ClientData_Detach(this);
        PlayerScore_Detach(self);
 
        if(self.netname_previous)
index 06c49907b6d7360444174160142832423b8d4a73..5515c57aa7069ba6365e68a83d353ab6c1f3c180 100644 (file)
@@ -419,11 +419,3 @@ void GrappleHookInit()
                hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK.m_id), false, false, 4);
        }
 }
-
-void SetGrappleHookBindings()
-{SELFPARAM();
-       // this function has been modified for Xonotic
-       // don't remove these lines! old server or demos coud overwrite the new aliases
-       stuffcmd(self, "alias +hook +button6\n");
-       stuffcmd(self, "alias -hook -button6\n");
-}
index 2a2d566b35670b97a9ace13a126349e2f7e0d80a..95ba88205b90666a612cb4232b7c00774dba76b0 100644 (file)
@@ -4,7 +4,6 @@
 // Wazat's grappling hook
 .entity                hook;
 void RemoveGrapplingHook(entity pl);
-void SetGrappleHookBindings();
 // (note: you can change the hook impulse #'s to whatever you please)
 .float hook_time;
 
index 7463fefbeafe827a9515660477849fb7030087f1..12d12bf542dc80c344f714bef13a5ef458d4f10e 100644 (file)
@@ -446,12 +446,11 @@ float Ban_IsClientBanned(entity client, float idx)
        return false;
 }
 
-float Ban_MaybeEnforceBan(entity client)
+bool Ban_MaybeEnforceBan(entity client)
 {
-       if(Ban_IsClientBanned(client, -1))
+       if (Ban_IsClientBanned(client, -1))
        {
-               string s;
-               s = strcat("^1NOTE:^7 banned client ", client.netaddress, " just tried to enter\n");
+               string s = sprintf("^1NOTE:^7 banned client %s just tried to enter\n", client.netaddress);
                dropclient(client);
                bprint(s);
                return true;
@@ -459,11 +458,10 @@ float Ban_MaybeEnforceBan(entity client)
        return false;
 }
 
-.float ban_checked;
-float Ban_MaybeEnforceBanOnce(entity client)
+.bool ban_checked;
+bool Ban_MaybeEnforceBanOnce(entity client)
 {
-       if(client.ban_checked)
-               return false;
+       if (client.ban_checked) return false;
        client.ban_checked = true;
        return Ban_MaybeEnforceBan(client);
 }
index 5273a65a7f1062c32548c34874578fdb50fa059d..6f263ae448c9b4e96e0bb664bcf43fa1f2d5b83b 100644 (file)
@@ -12,9 +12,9 @@
 const float PLAYERDEMO_MODE_OFF = 0;
 const float PLAYERDEMO_MODE_READING = 1;
 const float PLAYERDEMO_MODE_WRITING = 2;
-void playerdemo_init()
-{SELFPARAM();
-       self.playerdemo_mode = PLAYERDEMO_MODE_OFF;
+void playerdemo_init(entity this)
+{
+       this.playerdemo_mode = PLAYERDEMO_MODE_OFF;
 }
 void playerdemo_shutdown()
 {SELFPARAM();
index 05e012aa6e771d2865ea97a64945ff4436b47705..7c19314328b25109ff3400e20fe2215ac8647c15 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PLAYERDEMO_H
 #define PLAYERDEMO_H
 
-void playerdemo_init();
+void playerdemo_init(entity this);
 void playerdemo_shutdown();
 void playerdemo_write();
 float playerdemo_read(entity this);