//===== Hercules Plugin ======================================
//= strcmp script command
//===== By: ==================================================
//= Samuel
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Hercules
//===== Description: =========================================
//= This command compares two strings are returns a value:
//= 1: string 1 > string 2
//= 0: strings are equal
//= -1: string 1 < string 2
//===== Additional Comments: =================================
// 1.0.0 Initial Release
//============================================================
#include <stdio.h>
#include <string.h>
#include "../common/HPMi.h"
#include "../map/script.h"
#include "../common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */
HPExport struct hplugin_info pinfo = {
"strcmp", // Plugin name
SERVER_TYPE_MAP,// Which server types this plugin works with?
"0.1", // Plugin version
HPM_VERSION, // HPM Version (don't change, macro is automatically updated)
};
BUILDIN(strcmp){
const char *str1;
const char *str2;
str1 = script_getstr(st,2);
str2 = script_getstr(st,3);
script_pushint(st,strcmp(str1, str2));
return true;
}
HPExport void plugin_init (void) {
script = GET_SYMBOL("script");
addScriptCommand("strcmp","ss",strcmp);
}