You can make the website item shop open in the in-game browser when clicking on the “rotating” coin in the bottom left of the screen.
ATTENTION! Before proceding make sure that your game client has the upgraded web browser! By default, the game client still uses internet explorer which is very old! You should upgrade your in-game browser to the latest version of CEF or you will not be able to open the in-game item shop since the item shop of my website uses modern web technologies that are not supported by the very old internet explorer.
First of all, you will need to locate the .env
file of your website.
If you are using HestiaCP you will find the .env
file in the following path:
/home/<your user>/web/<your domain>/public_html
You need to copy the APP_KEY
that you find the .env
file. It will look like this:
APP_KEY=base64:lettersandnumber=
Copy everything after APP_KEY=
, so you need to copy
base64:lettersandnumber=
You must include base64: at the beginning the = at the end of the string.
Now, in your file server open the file cmd_general.cpp
and replace the ACMD(do_in_game_mall)
function with the following one:
ACMD(do_in_game_mall)
{
char buf[512+1];
char sas[33];
MD5_CTX ctx;
const char secretKey[] = "base64:.......="; // change with the one in the .ENV file
const char websiteUrl[] = "https://mywebsite.com"; // WITHOUT "/" at the end!!!
snprintf(buf, sizeof(buf), "%u%s", ch->GetAID(), secretKey);
MD5Init(&ctx);
MD5Update(&ctx, (const unsigned char *) buf, strlen(buf));
#ifdef __FreeBSD__
MD5End(&ctx, sas);
#else
static const char hex[] = "0123456789abcdef";
unsigned char digest[16];
MD5Final(digest, &ctx);
int i;
for (i = 0; i < 16; ++i) {
sas[i+i] = hex[digest[i] >> 4];
sas[i+i+1] = hex[digest[i] & 0x0f];
}
sas[i+i] = '\0';
#endif
snprintf(buf, sizeof(buf), "mall %s/in-game-shop?aid=%u&secret=%s", websiteUrl, ch->GetAID(), sas);
ch->ChatPacket(CHAT_TYPE_COMMAND, buf);
}
Do not forget to update the following two variables in the code above with your data!
const char secretKey[]
const char websiteUrl[]
You can recompile your file server and you are done!