wwww23 发表于 2009-9-17 00:14:19

形形色色的代码,Rulzy等各位大大帮忙啊!

本帖最后由 wwww23 于 2009-9-17 00:26 编辑

这应该是C代码吧,比AMXX代码更难懂,请问怎样设置才能不记录 玩家记录,谢谢。
引用向段可疑的代码,不知对不对:
void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){

        rankBots = (int)csstats_rankbots->value ? true:false;

        for( int i = 1; i <= gpGlobals->maxClients; ++i)
                GET_PLAYER_POINTER_I(i)->Init( i , pEdictList + i );
        RETURN_META(MRES_IGNORED);
}
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::PutInServer(){

        //if ( ignoreBots(pEdict) )
        if ( (int)csstats_rankbots->value == 0 &&
               IsBot() )
                return;

        restartStats();
        const char* name = STRING(pEdict->v.netname);
        const char* unique = name;
        bool isip = false;
        switch((int)csstats_rank->value) {
        case 1:
                if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 )
                        unique = name; // failed to get authid
                break;
        case 2:
                unique = ip;
                isip = true;
        }
        rank = g_rank.findEntryInRank( unique , name , isip);
}
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.deaths++;
                pVictim->life.deaths++;
                pVictim->weaponsRnd.deaths++;       // DEC-Weapon (round) stats
                return;
        }

        pVictim->attackers.name = weaponData.name;
        pVictim->attackers.kills++;
        pVictim->attackers.hs += hhs;
        pVictim->attackers.tks += ttk;
        pVictim->attackers.kills++;
        pVictim->attackers.hs += hhs;
        pVictim->attackers.tks += ttk;
        pVictim->weapons.deaths++;
        pVictim->weapons.deaths++;
        pVictim->life.deaths++;
       
       
        pVictim->weaponsRnd.deaths++; // DEC-Weapon (round) stats
        pVictim->weaponsRnd.deaths++;                   // DEC-Weapon (round) stats
       
        int vi = pVictim->index;
        victims.name = weaponData.name;
        victims.deaths++;
        victims.hs += hhs;
        victims.tks += ttk;
        victims.deaths++;
        victims.hs += hhs;
        victims.tks += ttk;
       
        weaponsRnd.kills++;                // DEC-Weapon (round) stats
        weaponsRnd.hs += hhs;         // DEC-Weapon (round) stats
        weaponsRnd.tks += ttk;   // DEC-Weapon (round) stats
        weaponsRnd.kills++;                     // DEC-Weapon (round) stats
        weaponsRnd.hs += hhs;            // DEC-Weapon (round) stats
        weaponsRnd.tks += ttk;          // DEC-Weapon (round) stats
       
        weapons.kills++;
        weapons.hs += hhs;
        weapons.tks += ttk;
        weapons.kills++;
        weapons.hs += hhs;
        weapons.tks += ttk;
        life.kills++;
        life.hs += hhs;
        life.tks += ttk;
}

void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){

        if ( ignoreBots(pEdict,pVictim->pEdict) )
                return;

        if ( index == pVictim->index ) return;

        pVictim->attackers.hits++;
        pVictim->attackers.damage += ddamage;
        pVictim->attackers.bodyHits++;
        pVictim->attackers.hits++;
        pVictim->attackers.damage += ddamage;
        pVictim->attackers.bodyHits++;


        int vi = pVictim->index;
        victims.hits++;
        victims.damage += ddamage;
        victims.bodyHits++;
        victims.hits++;
        victims.damage += ddamage;
        victims.bodyHits++;

        weaponsRnd.hits++;            // DEC-Weapon (round) stats
        weaponsRnd.damage += ddamage;    // DEC-Weapon (round) stats
        weaponsRnd.bodyHits++;   // DEC-Weapon (round) stats
        weaponsRnd.hits++;                   // DEC-Weapon (round) stats
        weaponsRnd.damage += ddamage;         // DEC-Weapon (round) stats
        weaponsRnd.bodyHits++;      // DEC-Weapon (round) stats

        weapons.hits++;
        weapons.damage += ddamage;
        weapons.bodyHits++;
        weapons.hits++;
        weapons.damage += ddamage;
        weapons.bodyHits++;

        life.hits++;
        life.damage += ddamage;
        life.bodyHits++;
}


void CPlayer::saveShot(int weapon){

        if ( ignoreBots(pEdict) )
                return;

        victims.shots++;
        weapons.shots++;
        weapons.shots++;
        life.shots++;
        weaponsRnd.shots++;       // DEC-Weapon (round) stats
        weaponsRnd.shots++;            // DEC-Weapon (round) stats
}


bool ignoreBots(edict_t *pEnt, edict_t *pOther)
{
        rankBots = (int)csstats_rankbots->value ? true : false;
        if (!rankBots && (pEnt->v.flags & FL_FAKECLIENT || (pOther && pOther->v.flags & FL_FAKECLIENT)))
        {
                return true;
        }

        return false;
}

wwww23 发表于 2009-9-19 06:19:26

花血本等各位大大帮忙,:call:,先谢谢了

sonic44944 发表于 2009-9-20 14:36:14

……代码里有表情符号,看着头疼

wwww23 发表于 2009-10-5 04:41:13

没人理,可怜:'(

lili2009 发表于 2010-3-14 19:50:49

4# wwww23


http://forums.alliedmods.net/forumdisplay.php?f=3
页: [1]
查看完整版本: 形形色色的代码,Rulzy等各位大大帮忙啊!