2 void info_player_start (void)
6 void info_player_deathmatch (void)
14 Finds a point to respawn
17 entity SelectSpawnPoint (void)
22 spot = findchain (classname, "info_player_deathmatch");
27 thing = findradius (spot.origin, 100);
30 if (thing.classname == "player")
42 spot = findchain (classname, "info_player_start");
44 error ("No startpoint found\n");
56 Called when a client spawns in the server
59 void PutClientInServer (void)
63 spot = SelectSpawnPoint ();
65 self.classname = "player";
66 self.movetype = MOVETYPE_WALK;
67 self.solid = SOLID_SLIDEBOX;
68 self.flags = FL_CLIENT;
69 self.takedamage = DAMAGE_YES;
72 self.ammo_shells = 100;
73 self.ammo_nails = 100;
74 self.ammo_rockets = 100;
75 self.ammo_cells = 100;
77 self.deadflag = DEAD_NO;
79 self.view_ofs = PL_VIEW_OFS;
80 self.angles = spot.angles;
81 setmodel (self, "models/player/player.zym");
82 setsize (self, PL_MIN, PL_MAX);
83 setorigin (self, spot.origin);
85 self.items = IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER;
88 self.event_hurt = PlayerHurt;
89 self.event_die = PlayerDie;
91 self.statdraintime = time + 5;
92 self.button0 = self.button1 = self.button2 = self.button3 = 0;
103 void SetNewParms (void)
113 void SetChangeParms (void)
122 Called when a client types 'kill' in the console
125 void ClientKill (void)
134 Called when a client connects to the server
137 void ClientConnect (void)
140 bprint (self.netname);
141 bprint (" connected\n");
148 Called when a client disconnects from the server
151 void ClientDisconnect (void)
153 ClientDisconnected();
154 bprint (self.netname);
155 bprint (" disconnected\n");
162 When you press the jump key
165 void PlayerJump (void)
167 if (self.deadflag != DEAD_NO)
169 if (self.death_time < time)
174 if (!(self.flags & FL_ONGROUND))
176 if (!(self.flags & FL_JUMPRELEASED))
179 self.velocity_z = self.velocity_z + 270;
181 self.flags = self.flags - FL_ONGROUND;
182 self.flags = self.flags - FL_JUMPRELEASED;
189 Called every frame for each client before the physics are run
192 .float attack_finished;
193 void PlayerPreThink (void)
198 if (self.attack_finished < time)
202 else if (self.button3)
203 W_SecondaryAttack ();
209 self.flags = self.flags | FL_JUMPRELEASED;
211 if (self.deadflag != DEAD_NO)
213 self.angles = self.dead_angles;
217 if (self.weapon == IT_NEX && self.button3)
219 else if (self.viewzoom != 1)
222 if (self.statdraintime < time)
224 if (self.health > 100)
225 self.health = self.health - 1;
226 if (self.armorvalue > 100)
227 self.armorvalue = self.armorvalue - 1;
229 self.statdraintime = time + 1;
237 Called every frame for each client after the physics are run
240 void PlayerPostThink (void)