[Tutorial] Auto Revive char when leaving the server

Joined
Nov 27, 2018
Messages
546
Reaction score
205
Below is a solution: when a character dies on the server and goes to the Main Menu, this function will instantly revive him.



Code:
Auto Revive Funct:

Edit in: WarZ_Server.sln

    open obj_ServerPlayer.cpp
    and edit:

    // set that character is dead
    loadout_->Alive   = 1; // default (0)
    loadout_->GamePos = GetPosition();
    loadout_->Health  = 100; // default (0)
    loadout_->MedBleeding = 0.0f;
    loadout_->MedFeverCold = 0.0f;
    loadout_->MedBloodInfection = 0.0f;
    // clear attachments
    loadout_->Attachment[0].Reset();
    loadout_->Attachment[1].Reset();
    loadout_->Stats.Deaths++;
   
Edit in you SQL:

    Open Function and Edit: WZ_Char_SRV_SetStatus

in: update UsersChars set

comment this Alive=@in_Alive:

-- update basic character data
    update UsersChars set
        GameFlags=@in_GameFlags,
        --Alive=@in_Alive, // char death and auto-revive
        Health=@in_Health,
        Food=@in_Hunger,
        Water=@in_Thirst,
        Toxic=@in_Toxic,
        TimePlayed=@in_TimePlayed,
        LastUpdateDate=GETDATE(),
        XP=@in_XP,
        Reputation=@in_Reputation,
        Stat00=@in_Stat00,
        Stat01=@in_Stat01,
        Stat02=@in_Stat02,
        Stat03=@in_Stat03,
        Stat04=@in_Stat04,
        Stat05=@in_Stat05
    where CharID=@in_CharID
 
Back