[TUT]VIP Death No Drop Item

Results 1 to 6 of 6
  1. #1
    Enthusiast fil22t is offline
    MemberRank
    Jun 2011 Join Date
    43Posts

    big grin [TUT]VIP Death No Drop Item

    WZ_Char_SRV_SetStatus
    Code:
    USE [warz]
    GO
    /****** Object:  StoredProcedure [dbo].[WZ_Char_SRV_SetStatus]    Script Date: 10/19/2013 10:46:09 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    -- ----------------------------
    -- Procedure structure for [WZ_Char_SRV_SetStatus]
    -- ----------------------------
    
    ALTER PROCEDURE [dbo].[WZ_Char_SRV_SetStatus]
    	@in_CustomerID int,
    	@in_CharID int,
    	@in_Alive int,
    	@in_GamePos varchar(256),
    	@in_GameFlags int,
    	@in_Health float,
    	@in_Hunger float,
    	@in_Thirst float,
    	@in_Toxic float,
    	@in_TimePlayed int,
    	@in_XP int,
    	@in_Reputation int,
    	@in_GameDollars int,
    	@in_Stat00 int,
    	@in_Stat01 int,
    	@in_Stat02 int,
    	@in_Stat03 int,
    	@in_Stat04 int,
    	@in_Stat05 int
    AS
    BEGIN
    	SET NOCOUNT ON;
    	
    	--
    	-- this function should be called only by server, so we skip all validations
    	--
    	
    	-- record last game update
    	update UsersData set GameDollars=@in_GameDollars, lastgamedate=GETDATE() where CustomerID=@in_CustomerID
    
    	declare @IsLegend int = 0
    	select @IsLegend=AccountType from UsersData where CustomerID=@in_CustomerID
    	
    	-- update basic character data
    	update UsersChars set
    		GamePos=@in_GamePos,
    		GameFlags=@in_GameFlags,
    		Alive=@in_Alive,
    		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
    	
    	if(@in_Alive = 0) begin
    	
    		update UsersChars set DeathUtcTime=GETUTCDATE() where CharID=@in_CharID
    		
    		if(@IsLegend = 2) begin
    			-- set default backpack on death
    			update UsersChars set BackpackID=20176, BackpackSize=12 where CharID=@in_CharID
    			-- delete stuff from backpack
    			delete from UsersInventory where CustomerID=@in_CustomerID and CharID=@in_CharID
    		end
    
    	end
    	select 0 as ResultCode
    END
    obj_ServerPlayer.cpp
    Code:
    void obj_ServerPlayer::DoDeath()
    {
    	gServerLogic.LogInfo(peerId_, "Death", ""); CLOG_INDENT;
    	
    	deathTime     = r3dGetTime();
    	if(profile_.ProfileData.AccountType == 2)
    	{
    		// drop all items
    		for(int i=0; i<loadout_->BackpackSize; i++)
    		{
    			const wiInventoryItem& wi = loadout_->Items[i];
    			if(wi.itemID > 0) {
    				BackpackDropItem(i);
    			}
    		}
    		
    		// drop not-default backpack as well
    		if(loadout_->BackpackID != 20176)
    		{
    			// create network object
    			obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", GetRandomPosForItemDrop());
    			obj->SetNetworkID(gServerLogic.GetFreeNetId());
    			obj->NetworkLocal = true;
    			// vars
    			obj->m_Item.itemID   = loadout_->BackpackID;
    			obj->m_Item.quantity = 1;
    		}
    	}
    	// set that character is dead
    	loadout_->Alive   = 0;
    	loadout_->GamePos = GetPosition();
    	loadout_->Health  = 0;
    	// clear attachments
    	if(profile_.ProfileData.AccountType == 2)
    	{
    		loadout_->Attachment[0].Reset();
    		loadout_->Attachment[1].Reset();
    	}
    	//NOTE: server WZ_Char_SRV_SetStatus will clear player backpack, so make that CJobUpdateChar::Exec() won't update it
    	savedLoadout_ = *loadout_;
    
    	gServerLogic.ApiPlayerUpdateChar(this);
    
    	SetLatePacketsBarrier("death");
    	return;
    }
    Credit : Document - Rockyy


  2. #2
    Valued Member Mateuus is offline
    MemberRank
    Mar 2013 Join Date
    123Posts

    Re: [TUT]VIP Death No Drop Item

    Nice! you are in the wrong area

  3. #3
    Account Upgraded | Title Enabled! Poster13 is offline
    MemberRank
    Jun 2013 Join Date
    395Posts

    Re: [TUT]VIP Death No Drop Item

    Whats this???

  4. #4
    Holy mother jesus tractor Kratos147 is offline
    MemberRank
    Jan 2011 Join Date
    CroatiaLocation
    470Posts

    Re: [TUT]VIP Death No Drop Item

    Donators don't drop items when they die maybe? look at the title.

  5. #5
    Account Upgraded | Title Enabled! Poster13 is offline
    MemberRank
    Jun 2013 Join Date
    395Posts

    Re: [TUT]VIP Death No Drop Item

    Quote Originally Posted by Kratos147 View Post
    Donators don't drop items when they die maybe? look at the title.
    Yes thanks, I've already checked it out)

  6. #6
    Apprentice Para X Modsite is offline
    MemberRank
    Sep 2013 Join Date
    15Posts

    Re: [TUT]VIP Death No Drop Item

    Quote Originally Posted by Poster13 View Post
    Yes thanks, I've already checked it out)
    fil22t
    he made my server it work!!!
    Donate user & Dev don't drop item when die.



Advertisement