void CPlayer::Disconnect() { if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused return; rank->updatePosition( &life ); ingame = false; }
void CPlayer::PutInServer() { restartStats(); ingame = true; killingSpree = 0; items = 0; lastFrag = 0; lastKill = 0.0; is_specialist = 0; //debug frags = 0; if ( ignoreBots(pEdict) ) return; const char* unique; const char* name = STRING(pEdict->v.netname); bool isip = false; switch((int)tsstats_rank->value) { case 1: if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 ) unique = name; // failed to get authid break; case 2: unique = ip; isip = true; break; default: unique = name; } if ( ( rank = g_rank.findEntryInRank( unique , name , isip) ) == 0 ) ingame = false; }
void CPlayer::PutInServer(){ ingame = true; if ( ignoreBots(pEdict) ) return; restartStats(); const char* unique; const char* name = STRING(pEdict->v.netname); bool isip = false; switch((int)dodstats_rank->value) { case 1: if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 ) unique = name; // failed to get authid break; case 2: unique = ip; isip = true; break; default: unique = name; } if ( ( rank = g_rank.findEntryInRank( unique , name , isip) ) == 0 ) ingame = false; }
/* iuser3 = 0 standing up iuser3 = 1 going prone or mg tearing down iuser3 = 2 setting up mg while laying down */ void CPlayer::PreThink() { if(!ingame || ignoreBots(pEdict)) return; if(oldteam != pEdict->v.team && iFTeamForward != -1) MF_ExecuteForward(iFTeamForward, index, pEdict->v.team, oldteam); if(oldclass != pEdict->v.playerclass && iFClassForward != -1) MF_ExecuteForward(iFClassForward, index, pEdict->v.playerclass, oldclass); if(oldprone != pEdict->v.iuser3 && oldprone != 2 && pEdict->v.iuser3 != 2 && iFProneForward != -1) MF_ExecuteForward(iFProneForward, index, pEdict->v.iuser3); if(oldstamina > pEdict->v.fuser4 && iFStaminaForward != -1) MF_ExecuteForward(iFStaminaForward, index, ((int)pEdict->v.fuser4)); if(wpns_bitfield != pEdict->v.weapons) WeaponsCheck(pEdict->v.weapons & ~(1<<31)); // Set the old variables for oldprone = pEdict->v.iuser3; oldteam = pEdict->v.team; oldclass = pEdict->v.playerclass; oldstamina = pEdict->v.fuser4; wpns_bitfield = pEdict->v.weapons & ~(1<<31); }
void CPlayer::Disconnect() { ingame = false; bot = false; savedScore = 0; oldteam = 0; oldclass = 0; oldprone = 0; oldstamina = 0.0f; // Model Stuff sModel.is_model_set = false; sModel.body_num = 0; // Object stuff object.pEdict = NULL; object.type = 0; object.carrying = false; object.do_forward = false; if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused return; rank->updatePosition( &life ); }
void CPlayer::setBody(int bn) { if(!ingame || ignoreBots(pEdict)) return; sModel.body_num = bn; return; }
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk) { if ( !isModuleActive() ) return; if ( ignoreBots(pEdict,pVictim->pEdict) ) return; if ( pVictim->index == index ){ // killed self pVictim->weapons[0].deaths++; pVictim->life.deaths++; pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats return; } pVictim->attackers[index].name = weaponData[wweapon].name; pVictim->attackers[index].kills++; pVictim->attackers[index].hs += hhs; pVictim->attackers[index].tks += ttk; pVictim->attackers[0].kills++; pVictim->attackers[0].hs += hhs; pVictim->attackers[0].tks += ttk; pVictim->weapons[pVictim->current].deaths++; pVictim->weapons[0].deaths++; pVictim->life.deaths++; pVictim->weaponsRnd[pVictim->current].deaths++; // DEC-Weapon (round) stats pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats int vi = pVictim->index; victims[vi].name = weaponData[wweapon].name; victims[vi].deaths++; victims[vi].hs += hhs; victims[vi].tks += ttk; victims[0].deaths++; victims[0].hs += hhs; victims[0].tks += ttk; weaponsRnd[wweapon].kills++; // DEC-Weapon (round) stats weaponsRnd[wweapon].hs += hhs; // DEC-Weapon (round) stats weaponsRnd[wweapon].tks += ttk; // DEC-Weapon (round) stats weaponsRnd[0].kills++; // DEC-Weapon (round) stats weaponsRnd[0].hs += hhs; // DEC-Weapon (round) stats weaponsRnd[0].tks += ttk; // DEC-Weapon (round) stats weapons[wweapon].kills++; weapons[wweapon].hs += hhs; weapons[wweapon].tks += ttk; weapons[0].kills++; weapons[0].hs += hhs; weapons[0].tks += ttk; life.kills++; life.hs += hhs; life.tks += ttk; }
void CPlayer::Disconnect(){ if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused return; if (rank != 0) // Just a sanity check, FL_FAKECLIENT is notoriously unreliable. { rank->updatePosition( &life ); } rank = 0; }
void CPlayer::saveShot(int weapon) { if ( ignoreBots(pEdict) ) return; victims[0].shots++; weapons[weapon].shots++; weapons[0].shots++; life.shots++; weaponsRnd[weapon].shots++; // DEC-Weapon (round) stats weaponsRnd[0].shots++; // DEC-Weapon (round) stats }
bool CPlayer::setModel() { if(!ingame || ignoreBots(pEdict)) return false; if(sModel.is_model_set) { ENTITY_SET_KEYVALUE(pEdict, "model", sModel.modelclass); pEdict->v.body = sModel.body_num; return true; } return false; }
void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){ if ( ignoreBots(pEdict,pVictim->pEdict) ) return; pVictim->attackers[index].hits++; pVictim->attackers[index].damage += ddamage; pVictim->attackers[index].bodyHits[bbody]++; pVictim->attackers[0].hits++; pVictim->attackers[0].damage += ddamage; pVictim->attackers[0].bodyHits[bbody]++; int vi = pVictim->index; victims[vi].hits++; victims[vi].damage += ddamage; victims[vi].bodyHits[bbody]++; victims[0].hits++; victims[0].damage += ddamage; victims[0].bodyHits[bbody]++; weaponsLife[wweapon].hits++; // DEC-Weapon (life) stats weaponsLife[wweapon].damage += ddamage; // DEC-Weapon (life) stats weaponsLife[wweapon].bodyHits[bbody]++; // DEC-Weapon (life) stats weaponsLife[0].hits++; // DEC-Weapon (life) stats weaponsLife[0].damage += ddamage; // DEC-Weapon (life) stats weaponsLife[0].bodyHits[bbody]++; // DEC-Weapon (life) stats weaponsRnd[wweapon].hits++; // DEC-Weapon (round) stats weaponsRnd[wweapon].damage += ddamage; // DEC-Weapon (round) stats weaponsRnd[wweapon].bodyHits[bbody]++; // DEC-Weapon (round) stats weaponsRnd[0].hits++; // DEC-Weapon (round) stats weaponsRnd[0].damage += ddamage; // DEC-Weapon (round) stats weaponsRnd[0].bodyHits[bbody]++; // DEC-Weapon (round) stats weapons[wweapon].hits++; weapons[wweapon].damage += ddamage; weapons[wweapon].bodyHits[bbody]++; weapons[0].hits++; weapons[0].damage += ddamage; weapons[0].bodyHits[bbody]++; life.hits++; life.damage += ddamage; life.bodyHits[bbody]++; round.hits++; round.damage += ddamage; round.bodyHits[bbody]++; }
void CPlayer::updateScore(int weapon, int score) { if ( ignoreBots(pEdict) ) return; life.points += score; round.points += score; weaponsLife[weapon].points += score; weaponsLife[0].points += score; weaponsRnd[weapon].points += score; weaponsRnd[0].points += score; weapons[weapon].points += score; weapons[0].points += score; }
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){ if ( ignoreBots(pEdict,pVictim->pEdict) ) return; if ( pVictim->index == index ) { // killed self pVictim->weapons[0].deaths++; pVictim->life.deaths++; pVictim->round.deaths++; pVictim->weaponsLife[0].deaths++; // DEC-Weapon (life) stats pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats return; } int vw = get_weaponid(pVictim); pVictim->attackers[index].name = (char*)weaponData[wweapon].name; pVictim->attackers[index].kills++; pVictim->attackers[index].hs += hhs; pVictim->attackers[index].tks += ttk; pVictim->attackers[0].kills++; pVictim->attackers[0].hs += hhs; pVictim->attackers[0].tks += ttk; pVictim->weapons[vw].deaths++; pVictim->weapons[0].deaths++; pVictim->life.deaths++; pVictim->round.deaths++; pVictim->weaponsLife[vw].deaths++; // DEC-Weapon (life) stats pVictim->weaponsLife[0].deaths++; // DEC-Weapon (life) stats pVictim->weaponsRnd[vw].deaths++; // DEC-Weapon (round) stats pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats int vi = pVictim->index; victims[vi].name = (char*)weaponData[wweapon].name; victims[vi].deaths++; victims[vi].hs += hhs; victims[vi].tks += ttk; victims[0].deaths++; victims[0].hs += hhs; victims[0].tks += ttk; weaponsLife[wweapon].kills++; // DEC-Weapon (life) stats weaponsLife[wweapon].hs += hhs; // DEC-Weapon (life) stats weaponsLife[wweapon].tks += ttk; // DEC-Weapon (life) stats weaponsLife[0].kills++; // DEC-Weapon (life) stats weaponsLife[0].hs += hhs; // DEC-Weapon (life) stats weaponsLife[0].tks += ttk; // DEC-Weapon (life) stats weaponsRnd[wweapon].kills++; // DEC-Weapon (round) stats weaponsRnd[wweapon].hs += hhs; // DEC-Weapon (round) stats weaponsRnd[wweapon].tks += ttk; // DEC-Weapon (round) stats weaponsRnd[0].kills++; // DEC-Weapon (round) stats weaponsRnd[0].hs += hhs; // DEC-Weapon (round) stats weaponsRnd[0].tks += ttk; // DEC-Weapon (round) stats weapons[wweapon].kills++; weapons[wweapon].hs += hhs; weapons[wweapon].tks += ttk; weapons[0].kills++; weapons[0].hs += hhs; weapons[0].tks += ttk; life.kills++; life.hs += hhs; life.tks += ttk; round.kills++; round.hs += hhs; round.tks += ttk; }