From 9f53b96539c2bfb709ffd916968d7939822f291d Mon Sep 17 00:00:00 2001 From: Lucas GAUTHERON Date: Mon, 31 Dec 2012 13:58:16 +0000 Subject: [PATCH] better shotgun checks git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7021 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/serverevents.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/src/serverevents.h b/source/src/serverevents.h index 5c335450..fdaa7660 100644 --- a/source/src/serverevents.h +++ b/source/src/serverevents.h @@ -58,6 +58,7 @@ void processevent(client *c, shotevent &e) default: { int totalrays = 0, maxrays = e.gun==GUN_SHOTGUN ? 3*SGRAYS: 1; + int tothits_c = 0, tothits_m = 0, tothits_o = 0; // sgrays for(int i = 1; ievents.length() && c->events[i].type==GE_HIT; i++) { hitevent &h = c->events[i].hit; @@ -71,14 +72,12 @@ void processevent(client *c, shotevent &e) { h.info = isbigendian() ? endianswap(h.info) : h.info; int bonusdist = h.info&0xFF; - int numhits_c = (h.info & 0x0000FF00) >> 8; - int numhits_m = (h.info & 0x00FF0000) >> 16; - int numhits_o = (h.info & 0xFF000000) >> 24; + int numhits_c = (h.info & 0x0000FF00) >> 8, numhits_m = (h.info & 0x00FF0000) >> 16, numhits_o = (h.info & 0xFF000000) >> 24; + tothits_c += numhits_c; tothits_m += numhits_m; tothits_o += numhits_o; rays = numhits_c + numhits_m + numhits_o; - if(rays < 1) continue; - if(numhits_c > SGRAYS || numhits_m > SGRAYS || numhits_o > SGRAYS || bonusdist > SGDMGBONUS) + if(tothits_c > SGRAYS || tothits_m > SGRAYS || tothits_o > SGRAYS || bonusdist > SGDMGBONUS) { addban(c, DISC_CHEAT); continue;