2 void info_player_start (void)
4 self.classname = "info_player_deathmatch";
7 void info_player_deathmatch (void)
15 Finds a point to respawn
18 entity SelectSpawnPoint (void)
20 local entity spot, thing;
23 spot = find (world, classname, "testplayerstart");
30 spot = find(spot, classname, "info_player_deathmatch");
33 if (spot == lastspawn)
36 thing = findradius(spot.origin, 32);
39 if (thing.classname == "player")
51 spot = find (world, classname, "info_player_start");
53 error ("PutClientInServer: no info_player_start on level");
63 Called when a client spawns in the server
66 void PutClientInServer (void)
70 spot = SelectSpawnPoint ();
72 self.classname = "player";
73 self.movetype = MOVETYPE_WALK;
74 self.solid = SOLID_SLIDEBOX;
75 self.flags = FL_CLIENT;
76 self.takedamage = DAMAGE_YES;
78 self.damageforcescale = 2;
80 self.ammo_shells = 100;
81 self.ammo_nails = 100;
82 self.ammo_rockets = 100;
83 self.ammo_cells = 100;
85 self.deadflag = DEAD_NO;
87 self.view_ofs = PL_VIEW_OFS;
88 self.angles = spot.angles;
89 setmodel (self, "models/player/player.zym");
90 setsize (self, PL_MIN, PL_MAX);
91 setorigin (self, spot.origin);
93 self.items = IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER;
96 self.event_hurt = PlayerHurt;
97 self.event_die = PlayerDie;
99 self.statdraintime = time + 5;
100 self.button0 = self.button1 = self.button2 = self.button3 = 0;
105 stuffcmd(self, "chase_active 0");
113 void SetNewParms (void)
123 void SetChangeParms (void)
132 Called when a client types 'kill' in the console
135 void ClientKill (void)
144 Called when a client connects to the server
147 void ClientConnect (void)
150 bprint (self.netname);
151 bprint (" connected\n");
158 Called when a client disconnects from the server
161 void ClientDisconnect (void)
163 ClientDisconnected();
164 bprint (self.netname);
165 bprint (" disconnected\n");
172 When you press the jump key
175 void PlayerJump (void)
177 if (self.deadflag != DEAD_NO)
179 if (self.death_time < time)
184 if (!(self.flags & FL_ONGROUND))
186 if (!(self.flags & FL_JUMPRELEASED))
189 self.velocity_z = self.velocity_z + 300;
191 self.flags = self.flags - FL_ONGROUND;
192 self.flags = self.flags - FL_JUMPRELEASED;
199 Called every frame for each client before the physics are run
202 .float attack_finished;
203 void PlayerPreThink (void)
208 if (self.attack_finished < time)
212 else if (self.button3)
213 W_SecondaryAttack ();
219 self.flags = self.flags | FL_JUMPRELEASED;
221 if (self.deadflag != DEAD_NO)
223 self.angles = self.dead_angles;
227 if (self.weapon == IT_NEX && self.button3)
229 else if (self.viewzoom != 1)
232 if (self.statdraintime < time)
234 if (self.health > 100)
235 self.health = self.health - 1;
236 if (self.armorvalue > 100)
237 self.armorvalue = self.armorvalue - 1;
239 self.statdraintime = time + 1;
242 self.angles_y=self.v_angle_y + 90; // temp
251 Called every frame for each client after the physics are run
254 void PlayerPostThink (void)