Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 15043

[Fix] Spawn Protection

$
0
0
My server files,
Fixed: killed by noname? nulled player names.
Time Spawn: 20 seconds update; 55 seconds!


AI_Player.cpp

:thumbup1:

Code:

// update HUD fix
        {
            {
                float bloodAlpha = 1.0f-R3D_MIN(r3dGetTime()-lastTimeHit, 1.0f);
                hudMain->setBloodAlpha(bloodAlpha);
            }


            bool bShowWarning = false;
            bAllowToUseWeapons = true;
            if(CurLoadout.GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox)
                bAllowToUseWeapons = false;
            if(CurLoadout.GameFlags & wiCharDataFull::GAMEFLAG_isSpawnProtected)
            {
                bShowWarning = true;
                m_AuraType = AT_SPAWNPROTECTION;
            }else{
                m_AuraType = AT_NONE;
            }
            if(bAllowToUseWeapons == false || bShowWarning == true)
                hudMain->showSafeZoneWarning(true);
            else
                hudMain->showSafeZoneWarning(false);


            hudMain->setVisibility(lifeProperties.getPlayerVisibility());
            hudMain->setHearing(lifeProperties.getPlayerHearRadius());


            //hudMain->setTime(CGL.GetServerGameTime());
            if(hudPause->isActive())
                hudPause->setTime(CGL.GetServerGameTime());


            hudMain->setLifeParams((int)CurLoadout.Hunger, (int)CurLoadout.Thirst, (int)CurLoadout.Health, (int)CurLoadout.Toxic, int(((getMaxStamina()-m_Stamina)/getMaxStamina())*100.0f));
            if(m_Weapons[m_SelectedWeapon])
            {
                if(m_Weapons[m_SelectedWeapon]->getCategory() == storecat_GRENADE) // treated as items
                {
                    const wiInventoryItem& wi = m_Weapons[m_SelectedWeapon]->getPlayerItem();
                    hudMain->setWeaponInfo(R3D_MIN(1, wi.quantity), R3D_MIN(0, wi.quantity-1), 1);
                }
                else
                    hudMain->setWeaponInfo(m_Weapons[m_SelectedWeapon]->getNumBulletsLeft(), m_Weapons[m_SelectedWeapon]->getNumClipsLeft(), (int)m_Weapons[m_SelectedWeapon]->getFiremode());
            }


            if(r3dGetTime() > showSlotsInfoTimer && showSlotsInfoTimer>0)
            {
                hudMain->showSlots(false);
                showSlotsInfoTimer = 0;
            }
        }
        {

UserProfile.h

search + f

Code:

GAMEFLAG_NearPostBox = (1 << 0),
add this

Code:

GAMEFLAG_isSpawnProtected = (1 << 0 ),
That's all in the client :blush:

Now for the server warz_server

//obj_ServerPlayer.cpp


//in
Code:

void obj_ServerPlayer::UpdateGameWorldFlags()
//after


Code:

loadout_->GameFlags = 0;
//add


//
Code:

//Spawn Protection Code here
        if((((r3dGetTime() - startPlayTime_) <= 55.0f)))
        loadout_->GameFlags |= wiCharDataFull::GAMEFLAG_isSpawnProtected;

//ServerGameLogic.cpp


//in
Code:

bool ServerGameLogic::ApplyDamageToPlayer(GameObject* fromObj, obj_ServerPlayer* targetPlr, const r3dPoint3D& dmgPos, float damage, int bodyBone, int bodyPart, bool force_damage, STORE_CATEGORIES damageSource, int airState )
//change line number 749 line about postboxes to this


Code:

if(((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox)||
        (targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_isSpawnProtected)) && !force_damage)

Thanks, www.deLiricez.biz

Viewing all articles
Browse latest Browse all 15043

Trending Articles