diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 17043ab8..78bddb00 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -407,23 +407,25 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) loopi(MAXCLIENTS) { int cn = getint(p); - if(cn<0) break; - int state = getint(p), lifesequence = getint(p), gunselect = getint(p), flagscore = getint(p), frags = getint(p), deaths = getint(p); - bool equip = getint(p) > 0; + if(p.overread() || cn<0) break; + int state = getint(p), lifesequence = getint(p), gunselect = getint(p), flagscore = getint(p), frags = getint(p), deaths = getint(p), health = getint(p), armour = getint(p); + int ammo[NUMGUNS], mag[NUMGUNS]; + loopi(NUMGUNS) ammo[i] = getint(p); + loopi(NUMGUNS) mag[i] = getint(p); playerent *d = (cn == getclientnum() ? player1 : newclient(cn)); if(!d) continue; if(d!=player1) d->state = state; d->lifesequence = lifesequence; - d->selectweapon(gunselect); d->flagscore = flagscore; d->frags = frags; d->deaths = deaths; - if(equip) + if(d!=player1) { - d->health = getint(p); - d->armour = getint(p); - loopi(NUMGUNS) d->ammo[i] = getint(p); - loopi(NUMGUNS) d->mag[i] = getint(p); + d->selectweapon(gunselect); + d->health = health; + d->armour = armour; + memcpy(d->ammo, ammo, sizeof(ammo)); + memcpy(d->mag, mag, sizeof(mag)); } } break; diff --git a/source/src/server.cpp b/source/src/server.cpp index e73b17cc..cf6b5f21 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1490,7 +1490,6 @@ void welcomepacket(ucharbuf &p, int n) putint(p, c.state.flagscore); putint(p, c.state.frags); putint(p, c.state.deaths); - putint(p, 1); putint(p, c.state.health); putint(p, c.state.armour); loopi(NUMGUNS) putint(p, c.state.ammo[i]); @@ -1627,7 +1626,7 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1 if(sc) { sc->restore(cl->state); - sendf(-1, 1, "ri8", SV_RESUME, sender, cl->state.state, cl->state.lifesequence, cl->state.gunselect, sc->flagscore, sc->frags, sc->deaths, 0, -1); + sendf(-1, 1, "ri2i8vvi", SV_RESUME, sender, cl->state.state, cl->state.lifesequence, cl->state.gunselect, sc->flagscore, sc->frags, sc->deaths, cl->state.health, cl->state.armour, NUMGUNS, cl->state.ammo, NUMGUNS, cl->state.mag, -1); } } getstring(text, p);