viewing paste topic/4509- vendor_control_2.0.c | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//===== eAthena Script =====================================
//= Vendor Control
//===== By: ================================================
//= Original by Emistry
//= Rewrite by AnnieRuru
//===== Current Version: ===================================
//= 2.0
//===== Compatible With: ===================================
//= Hercules 2015-10-29
//===== Description: =======================================
//= Vendors only vend on certain coordinate, looks tidy :P
//===== Topic ==============================================
//= http://hercules.ws/board/topic/4509-
//===== Additional Comments: ===============================
//= Emistry ... please don't simply use Bug tracker to request a core developer to get your custom script fixed
//==========================================================
 
#include "common/hercules.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "map/pc.h"
#include "common/mmo.h"
#include "common/HPMDataCheck.h"
 
// Note down the area where your players allow to vend
// this is meant to bypass the 'min_npc_vendchat_distance' check
char mapname[MAP_NAME_LENGTH] = "prontera";
int x1 = 150; // 1st element of setarray .@x
int x2 = 162; // last element of setarray .@x
int y1 = 133; // 1st element of setarray .@y
int y2 = 175; // last element of setarray .@y
 
HPExport struct hplugin_info pinfo = {
        "VendorControl", // Plugin name
        SERVER_TYPE_MAP,// Which server types this plugin works with?
        "2.0",                  // Plugin version
        HPM_VERSION,    // HPM Version (don't change, macro is automatically updated)
};
 
bool npc_isnear_pre( struct block_list * bl ) {
        TBL_PC* sd = (TBL_PC*)bl;
        if ( !strcmp( mapindex_id2name(sd->mapindex), mapname ) && sd->bl.x >= x1 && sd->bl.x <= x2 && sd->bl.y >= y1 && sd->bl.y <= y2 )
                hookStop();
        return false;
}
 
HPExport void plugin_init (void) {
        addHookPre( "npc->isnear", npc_isnear_pre );
}
Viewed 1147 times, submitted by AnnieRuru.