Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] Fix God Mode

Joined
Apr 2, 2013
Messages
1,098
Reaction score
4,555



Fix God Mode Chat Command




Fix to enable and disable god mode and show msg


Search for:

PHP:
if(strncmp(cmd, "/god", 4) == 0 && plr->profile_.ProfileData.isDevAccount & wiUserProfile::DAA_GOD)
{
    plr->m_isAdmin_GodMode = true; // once turned on, you cannot disable it (to prevent abuse)
    return 0;
}

Modify to:

PHP:
if(strncmp(cmd, "/god", 4) == 0 && plr->profile_.ProfileData.isDevAccount & wiUserProfile::DAA_GOD) // By Yuri-BR
{
    plr->m_isAdmin_GodMode = !plr->m_isAdmin_GodMode;

    PKT_C2C_ChatMessage_s n2;
    n2.msgChannel = 1;
    n2.userFlag   = 2;
    r3dscpy(n2.gamertag, "<SYSTEM>");
    r3dscpy(n2.msg, plr->m_isAdmin_GodMode ? "GodMode ON" : "God Mode OFF");
    p2pSendToPeer(plr->peerId_, plr, &n2, sizeof(n2));

    return 0;
}



Disable zombie attack infection



Search for:

PHP:
bool ServerGameLogic::ApplyDamageToPlayer(GameObject* fromObj, obj_ServerPlayer* targetPlr, const r3dPoint3D& dmgPos, float damage, int bodyBone, int bodyPart, bool force_damage, STORE_CATEGORIES damageSource, uint32_t dmgItemID, int airState, bool canApplyBleeding)
{
    r3d_assert(fromObj);
    r3d_assert(targetPlr);

Add:

PHP:
if(targetPlr->m_isAdmin_GodMode)
      return false;



Enable hit with god mode



Search for:

PHP:
// admin that is in god mode cannot hit anyone else, to make sure that there will be no abuse
if(m_isAdmin_GodMode)
{
    gServerLogic.LogInfo(peerId_, "AdminAbuse", "admin player %s tried to shoot another player while in god mode", userName);
    return;
}

Modifly to:

PHP:
// admin that is in god mode cannot hit anyone else, to make sure that there will be no abuse
/*if(m_isAdmin_GodMode)
{
    gServerLogic.LogInfo(peerId_, "AdminAbuse", "admin player %s tried to shoot another player while in god mode", userName);
    return;
}*/



Disable zombie sense from weapon fire



Search for:

PHP:
bool obj_Zombie::SenseWeaponFire(const obj_ServerPlayer* plr, const ServerWeapon* wpn)
{

Add:

PHP:
if(plr->m_isAdmin_GodMode)
        return false;
Example of how to use: /god



 
Last edited:
Initiate Mage
Joined
Aug 6, 2023
Messages
4
Reaction score
0



Fix God Mode Chat Command




Fix to enable and disable god mode and show msg



Search for:

PHP:
if(strncmp(cmd, "/god", 4) == 0 && plr->profile_.ProfileData.isDevAccount & wiUserProfile::DAA_GOD)
{
    plr->m_isAdmin_GodMode = true; // once turned on, you cannot disable it (to prevent abuse)
    return 0;
}

Modify to:

PHP:
if(strncmp(cmd, "/god", 4) == 0 && plr->profile_.ProfileData.isDevAccount & wiUserProfile::DAA_GOD) // By Yuri-BR
{
    plr->m_isAdmin_GodMode = !plr->m_isAdmin_GodMode;

    PKT_C2C_ChatMessage_s n2;
    n2.msgChannel = 1;
    n2.userFlag   = 2;
    r3dscpy(n2.gamertag, "<SYSTEM>");
    r3dscpy(n2.msg, plr->m_isAdmin_GodMode ? "GodMode ON" : "God Mode OFF");
    p2pSendToPeer(plr->peerId_, plr, &n2, sizeof(n2));

    return 0;
}



Disable zombie attack infection



Search for:

PHP:
bool ServerGameLogic::ApplyDamageToPlayer(GameObject* fromObj, obj_ServerPlayer* targetPlr, const r3dPoint3D& dmgPos, float damage, int bodyBone, int bodyPart, bool force_damage, STORE_CATEGORIES damageSource, uint32_t dmgItemID, int airState, bool canApplyBleeding)
{
    r3d_assert(fromObj);
    r3d_assert(targetPlr);

Add:

PHP:
if(targetPlr->m_isAdmin_GodMode)
      return false;



Enable hit with god mode



Search for:

PHP:
// admin that is in god mode cannot hit anyone else, to make sure that there will be no abuse
if(m_isAdmin_GodMode)
{
    gServerLogic.LogInfo(peerId_, "AdminAbuse", "admin player %s tried to shoot another player while in god mode", userName);
    return;
}

Modifly to:

PHP:
// admin that is in god mode cannot hit anyone else, to make sure that there will be no abuse
/*if(m_isAdmin_GodMode)
{
    gServerLogic.LogInfo(peerId_, "AdminAbuse", "admin player %s tried to shoot another player while in god mode", userName);
    return;
}*/



Disable zombie sense from weapon fire



Search for:

PHP:
bool obj_Zombie::SenseWeaponFire(const obj_ServerPlayer* plr, const ServerWeapon* wpn)
{

Add:

PHP:
if(plr->m_isAdmin_GodMode)
        return false;


Example of how to use: /god


thank you
 
Back
Top