1 | /* |
1 | /* |
2 | * static char *rcsid_c_wiz_c = |
2 | * static char *rcsid_c_wiz_c = |
3 | * "$Id: c_wiz.c,v 1.3 2006/05/12 22:29:15 root Exp $"; |
3 | * "$Id: c_wiz.c,v 1.4 2006/05/12 23:15:36 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
241 | "%s banishes %s from the land!", op->name, pl->ob->name); |
241 | "%s banishes %s from the land!", op->name, pl->ob->name); |
242 | command_kick(op, pl->ob->name); |
242 | command_kick(op, pl->ob->name); |
243 | return 1; |
243 | return 1; |
244 | } |
244 | } |
245 | |
245 | |
|
|
246 | int |
246 | int command_kick(object *op, char *params) { |
247 | command_kick (object *op, char *params) |
|
|
248 | { |
247 | struct pl *pl; |
249 | struct pl *pl; |
248 | |
250 | |
249 | for (pl = first_player; pl != NULL; pl = pl->next) { |
251 | for (pl = first_player; pl != NULL; pl = pl->next) |
250 | if ((params == NULL || !strcmp(pl->ob->name, params)) && pl->ob != op) { |
252 | if (params == NULL || !strcmp (pl->ob->name, params)) |
251 | object *op; |
253 | { |
252 | |
|
|
253 | op = pl->ob; |
254 | object *op = pl->ob; |
254 | if (!QUERY_FLAG(op, FLAG_REMOVED)) { |
255 | |
|
|
256 | if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) |
|
|
257 | { |
255 | /* Avion : Here we handle the KICK global event */ |
258 | /* Avion : Here we handle the KICK global event */ |
256 | execute_global_event(EVENT_KICK, op, params); |
259 | execute_global_event (EVENT_KICK, op, params); |
257 | |
260 | |
258 | if (!QUERY_FLAG(op, FLAG_FREED)) { |
|
|
259 | check_score(op); /* Always check score */ |
|
|
260 | |
|
|
261 | (void)save_player(op, 0); |
|
|
262 | |
|
|
263 | if (op->map) |
|
|
264 | op->map->players--; |
|
|
265 | } |
|
|
266 | |
|
|
267 | #if MAP_MAXTIMEOUT |
|
|
268 | if (op->map) |
|
|
269 | op->map->timeout = MAP_TIMEOUT(op->map); |
|
|
270 | #endif |
|
|
271 | remove_ob(op); |
|
|
272 | } |
|
|
273 | |
|
|
274 | op->direction = 0; |
|
|
275 | new_draw_info_format(NDI_UNIQUE|NDI_ALL|NDI_RED, 5, op, |
261 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, |
276 | "%s is kicked out of the game.", op->name); |
262 | "%s is kicked out of the game.", |
|
|
263 | op->name); |
277 | strcpy(op->contr->killer, "kicked"); |
264 | strcpy (op->contr->killer, "kicked"); |
|
|
265 | } |
278 | |
266 | |
279 | pl->socket.status = Ns_Dead; |
267 | pl->socket.status = Ns_Dead; |
280 | } |
268 | } |
281 | } |
|
|
282 | |
269 | |
283 | return 1; |
270 | return 1; |
284 | } |
271 | } |
285 | |
272 | |
286 | int command_save_overlay(object *op, char *params) { |
273 | int command_save_overlay(object *op, char *params) { |
287 | if (!op) |
274 | if (!op) |
288 | return 0; |
275 | return 0; |
… | |
… | |
337 | "You remove %s's muzzle.", pl->ob->name); |
324 | "You remove %s's muzzle.", pl->ob->name); |
338 | return 1; |
325 | return 1; |
339 | } |
326 | } |
340 | } |
327 | } |
341 | |
328 | |
|
|
329 | int |
342 | int command_shutdown(object *op, char *params) { |
330 | command_shutdown (object * op, char *params) |
|
|
331 | { |
|
|
332 | struct pl *pl; |
|
|
333 | |
343 | if (op!=NULL && !QUERY_FLAG(op, FLAG_WIZ)) { |
334 | if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ)) |
|
|
335 | { |
344 | new_draw_info(NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
336 | new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); |
345 | return 1; |
337 | return 1; |
346 | } |
338 | } |
347 | |
339 | |
348 | /* |
340 | for (pl = first_player; pl != NULL; pl = pl->next) |
349 | * We need to give op - command_kick expects it. however, this means |
|
|
350 | * the op won't get kicked off, so we do it ourselves |
|
|
351 | */ |
|
|
352 | command_kick(op, NULL); |
|
|
353 | check_score(op); /* Always check score */ |
|
|
354 | (void)save_player(op, 0); |
341 | save_player (pl->ob, 0); |
355 | play_again(op); |
342 | |
356 | cleanup(); |
343 | cleanup (); |
357 | /* not reached */ |
344 | /* not reached */ |
358 | return 1; |
345 | return 1; |
359 | } |
346 | } |
360 | |
347 | |
361 | int command_goto(object *op, char *params) |
348 | int command_goto(object *op, char *params) |
362 | { |
349 | { |
363 | char *name; |
350 | char *name; |