The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 786 - File: showthread.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/showthread.php 786 errorHandler->error






Post Reply 
 
Thread Rating:
  • 2 Votes - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NPC buy limit
Author Message
Staff_Stanic
Journeyman
*

Posts: 96
Likes Given: 25
Likes Received: 14 in 8 posts
Joined: Nov 2012
Reputation: 1

Dimension Shard

Post: #1
NPC buy limit
Sometimes a player sell a lot of items to the same vendor, without any problem or wait for something.
This script "lock" the vendor for some time, so he can't buy anything from players while locked and the player will have to find another NPC to sell his things.

Code:
////////////// Script by: Stanic - Daniel Barbosa Maranhão - Email: pikulinhu@hotmail.com | Skype: daniel.bmaranhao
/// To install open your sphere.ini and add e_PlayerSell to EventsPlayer

[DEFNAME VendorsEconomy]
SellStockDelay    "3600"    //Delay in seconds to "restock" the vendor.

[EVENTS e_PlayerSell]
ON=@ItemSell
LOCAL.MaxAmount=<eval <SERV.VendorMaxSell>-<ARGO.TAG0.SellStock>>
IF (<ARGN1> > <LOCAL.MaxAmount>)
  IF (<LOCAL.MaxAmount>==<SERV.VendorMaxSell>)
   ARGO.SAY Sorry <NAME>, I don't want to buy all these items. Give me <SERV.VendorMaxSell> and we both will be satisfied!
  ELIF (<LOCAL.MaxAmount> > 0)
   ARGO.SAY Sorry <NAME>, my stock of items is almost full and I can only carry with me more <dLOCAL.MaxAmount> items.
  ELSE
   ARGO.SAY Sorry <NAME>, my stock of items is full and I can't take more anything with me.
  ENDIF
  return 1
ENDIF
ARGO.TAG0.SellStock +=<ARGN1>
ARGO.TIMERF <dDEF.SellStockDelay>, SellReStock <ARGN1>

[FUNCTION SellReStock]
TAG.SellStock -=<ARGS>

[EOF]
http://forum.spherecommunity.net/sshare/...ccarry.scp


Attached File(s)
.scp  npccarry.scp (Size: 1,016 bytes / Downloads: 17)
(This post was last modified: 11-28-2013 01:57 AM by Staff_Stanic.)
11-28-2013 01:27 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like Staff_Stanic's post
Post Reply 


Messages In This Thread
NPC buy limit - Staff_Stanic - 11-28-2013 01:27 AM
RE: NPC buy limit - amonvangrell - 11-28-2013, 05:22 AM
RE: NPC buy limit - XuN - 11-28-2013, 07:50 AM
RE: NPC buy limit - Khaos - 11-28-2013, 04:31 PM
RE: NPC buy limit - Staff_Stanic - 11-29-2013, 03:01 AM
RE: NPC buy limit - Khaos - 11-29-2013, 07:56 AM
RE: NPC buy limit - Khaos - 11-30-2013, 12:26 PM
RE: NPC buy limit - amonvangrell - 01-19-2014, 10:23 AM
RE: NPC buy limit - kn4tseb - 09-19-2014, 04:27 AM
RE: NPC buy limit - Extreme - 09-19-2014, 06:34 AM
RE: NPC buy limit - kn4tseb - 09-19-2014, 08:19 AM
RE: NPC buy limit - Extreme - 09-19-2014, 08:38 AM
RE: NPC buy limit - kn4tseb - 09-19-2014, 08:41 AM
RE: NPC buy limit - chrono - 01-18-2022, 07:07 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)