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;
102 void SetNewParms (void)
112 void SetChangeParms (void)
121 Called when a client types 'kill' in the console
124 void ClientKill (void)
133 Called when a client connects to the server
136 void ClientConnect (void)
138 bprint (self.netname);
139 bprint (" connected\n");
146 Called when a client disconnects from the server
149 void ClientDisconnect (void)
151 bprint (self.netname);
152 bprint (" disconnected\n");
159 When you press the jump key
162 void PlayerJump (void)
164 if (!(self.flags & FL_ONGROUND))
166 if (!(self.flags & FL_JUMPRELEASED))
169 self.velocity_z = self.velocity_z + 270;
171 self.flags = self.flags - FL_ONGROUND;
172 self.flags = self.flags - FL_JUMPRELEASED;
179 Called every frame for each client before the physics are run
182 .float attack_finished;
183 void PlayerPreThink (void)
185 if (self.button0 && self.attack_finished < time)
191 self.flags = self.flags | FL_JUMPRELEASED;
193 if (self.statdraintime < time)
195 if (self.health > 100)
196 self.health = self.health - 1;
197 if (self.armorvalue > 100)
198 self.armorvalue = self.armorvalue - 1;
200 self.statdraintime = time + 1;
208 Called every frame for each client after the physics are run
211 void PlayerPostThink (void)