[Release] Sell Gun - Cmd

Results 1 to 14 of 14
  1. #1
    Member MRsrac is offline
    MemberRank
    Nov 2013 Join Date
    Da caveLocation
    82Posts

    config [Release] Sell Gun - Cmd

    Hey,
    releasing my Sell Gun for $ feature, so if you want to make some looters happy...

    You can sell guns and gear.
    Weight = Money.
    4x multiplier for Sniper rifles
    5%-10% bonus with skills.

    No GUI, you sell item that you put in the 5 slot(6 quickslot?).
    It's the base, there is NPC & skills already but then you would have no fun with it, right?
    Then Have fun!

    ServerGameLogic.h

    Search for
    Code:
    	int		  Cmd_GiveItem(obj_ServerPlayer* plr, const char* cmd);
    Add below
    Code:
    	int		  Cmd_Sell(obj_ServerPlayer* plr, const char* cmd);
    ServerGameLogic.cpp

    Search for
    Code:
    	if(strncmp(cmd, "/gi", 3) == 0)
    		return Cmd_GiveItem(plr, cmd);
    Add below
    Code:
    	if(strncmp(cmd, "/sell", 5) == 0)
    		return Cmd_Sell(plr, cmd);
    Search for
    Code:
    int ServerGameLogic::Cmd_GiveItem(obj_ServerPlayer* plr, const char* cmd)
    {
    Add above
    Code:
    int ServerGameLogic::Cmd_Sell(obj_ServerPlayer* plr, const char* cmd)
    {
    	if(plr->loadout_->GameFlags & plr->loadout_->GAMEFLAG_NearPostBox)
    	{
    		//read item from 6 quickslot
    		wiInventoryItem& wi = plr->loadout_->Items[5];
    		const BaseItemConfig* itm = g_pWeaponArmory->getConfig(wi.itemID);
    		if(!itm) return 2; //if not from weapon armory
    		
    		int prize = int(itm->m_Weight + 0.5); //convert weight to int
    
    
    		prize *= 1000;
    
    
    		if(prize < 1) return 2;
    		
    		//remove
    		wi.quantity--;
    		if(wi.quantity == 0)
    		{
    			wi.Reset();
    		}
    
    
    		if(itm->category != storecat_SNP) prize = prize / 4; // 400% bonus for selling sniper rifle
    
    
    		//skills 31 & 33
    		int bonus;
    		if(plr->loadout_->Stats.skillid33 == 1)
    		{
    			//10% bonus
    			bonus = prize / 5;
    			bonus /= 2;
    			prize += bonus;
    		}
    		else if(plr->loadout_->Stats.skillid31 == 1)
    		{
    			//5% bonus
    			bonus = prize / 5;
    			bonus /= 4;
    			prize += bonus;
    		}
    		
    		//log
    		r3dOutToLog("%s - sold %s for $%d\n", plr->loadout_->Gamertag, itm->m_StoreName, prize);
    		
    		//send message
    		PKT_C2C_ChatMessage_s n2;
    		n2.userFlag = 0;
    		n2.msgChannel = 1;
    
    
    		char message[128];
    		sprintf(message, "You have sold %s for $%d", itm->m_StoreName, prize);
    
    
    		r3dscpy(n2.msg, message);
    		r3dscpy(n2.gamertag, "<System>");
    		p2pSendToPeer(plr->peerId_, plr, &n2, sizeof(n2));
    		
    		//add the prize
    		plr->profile_.ProfileData.GameDollars += prize;
    
    
    		return 1;
    	}
    	
    	return 2;
    }


  2. #2
    m70b1jr#9501 m70b1jr is offline
    MemberRank
    May 2013 Join Date
    North CarolinaLocation
    862Posts

    Re: [Release] Sell Gun - Cmd

    So wait. If you walking into a safezone, do /sell it will sell your item? in the 5 slot?
    Sweet! I'm sure it won't be hard making a NPC ment for selling these items, or make it where you can right click on the item and sell it.

  3. #3
    Account Upgraded | Title Enabled! AlexRedd is offline
    MemberRank
    Jan 2014 Join Date
    310Posts

    Re: [Release] Sell Gun - Cmd

    Thanks for the release!
    Why items are not removed from the backpack after sale?

  4. #4
    Member MRsrac is offline
    MemberRank
    Nov 2013 Join Date
    Da caveLocation
    82Posts

    Re: [Release] Sell Gun - Cmd

    Quote Originally Posted by AlexRedd View Post
    Thanks for the release!
    Why items are not removed from the backpack after sale?
    It does not?
    //remove
    wi.quantity--;
    if(wi.quantity == 0)
    {
    wi.Reset();
    }

  5. #5
    Account Upgraded | Title Enabled! AlexRedd is offline
    MemberRank
    Jan 2014 Join Date
    310Posts

    Re: [Release] Sell Gun - Cmd

    Quote Originally Posted by MRsrac View Post
    It does not?
    works, but is visually items in a backpack
    if you exit the menu, the items disappear




  6. #6
    Account Upgraded | Title Enabled! AlexRedd is offline
    MemberRank
    Jan 2014 Join Date
    310Posts

    Re: [Release] Sell Gun - Cmd

    need code for remove items
    Last edited by AlexRedd; 22-09-14 at 11:48 AM.

  7. #7
    Member MRsrac is offline
    MemberRank
    Nov 2013 Join Date
    Da caveLocation
    82Posts

    Re: [Release] Sell Gun - Cmd

    Quote Originally Posted by AlexRedd View Post
    works, but is visually items in a backpack
    if you exit the menu, the items disappear
    Well, then it's all about sending a packet that backpack slot modified.
    You can use RemoveItem function from my Stack Clips release and then replace
    wi.quantity--;
    if(wi.quantity == 0)
    {
    wi.Reset();
    }
    with
    wi.quantity--;
    if(wi.quantity <= 0)
    {
    wi.Reset();
    }
    RemoveItem(5, wi.quantity);
    ... or you can just manually set up and send the packet, if you are capable to do that.
    Last edited by MRsrac; 25-07-14 at 09:56 PM. Reason: typo

  8. #8
    Account Upgraded | Title Enabled! AlexRedd is offline
    MemberRank
    Jan 2014 Join Date
    310Posts

    Re: [Release] Sell Gun - Cmd

    delete this post
    Last edited by AlexRedd; 12-09-14 at 07:09 AM.

  9. #9
    Valued Member linuxking51 is offline
    MemberRank
    Oct 2013 Join Date
    132Posts

    Re: [Release] Sell Gun - Cmd

    a white man as an NPC incorporates sell for?

  10. #10
    Account Upgraded | Title Enabled! rapido15 is offline
    MemberRank
    Oct 2011 Join Date
    435Posts

    Re: [Release] Sell Gun - Cmd

    Quote Originally Posted by MRsrac View Post
    Well, then it's all about sending a packet that backpack slot modified.
    You can use RemoveItem function from my Stack Clips release and then replace

    with


    ... or you can just manually set up and send the packet, if you are capable to do that.
    'RemoveItem':Identifier not found
    someone has solved this? already I add the function for delete the items from the stack tut but still get this in the sell command any idea how to fix the code? (i'm poor in programing) :s

  11. #11
    Account Upgraded | Title Enabled! GetRektBambi is offline
    MemberRank
    Oct 2015 Join Date
    268Posts

    Re: [Release] Sell Gun - Cmd

    Saved me some time thanks, but will be better with Npc with trade like hud, place the items in and he gives you an offer them you accept or decline, will make for more bulk sale.

  12. #12
    Member Thiago Costa is offline
    MemberRank
    Sep 2013 Join Date
    51Posts

    Re: [Release] Sell Gun - Cmd

    As it does to sell the gun?
    I did /sell and it was not.


    Can someone help?

  13. #13
    ☆Dying Dawn☆ Bombillo is offline
    MemberRank
    Jan 2012 Join Date
    ValhallaLocation
    977Posts

    Re: [Release] Sell Gun - Cmd

    Quote Originally Posted by Thiago Costa View Post
    As it does to sell the gun?
    I did /sell and it was not.


    Can someone help?
    put the item in the slot 5 and do /sell but your item doesn't disappear until you logout from the map so you still can use the item or trade it to another person..

  14. #14
    Member Thiago Costa is offline
    MemberRank
    Sep 2013 Join Date
    51Posts

    Re: [Release] Sell Gun - Cmd

    Quote Originally Posted by Bombillo View Post
    put the item in the slot 5 and do /sell but your item doesn't disappear until you logout from the map so you still can use the item or trade it to another person..

    I do it, but it says invalid command.



Advertisement