Documentation
EnglishVote Token
The player votes on our website or from the Discord application, and our platform automatically triggers and signals to your game server, your player's vote in order to reward him.
- Allows you to verify a vote using your player's account token
- Offers better performance
Go to our platform, in the API configuration of your game server and define the URL according to your environment, in these examples, api-vote is the name of the API script:
- Example : https://example.com/api-vote.php
- Example : https://example.com/api-vote/
Voting URL
If you want to exclusively use voting from the Discord application, this step is optional. However, you can add a voting URL to your website and take advantage of both methods.
You must define within your website, a dynamic voting link for your player. This link must imperatively contain the ID of your game server as well as the custom token of your player's account (For example, the ID of the account...) within your game server.
- Example : https://metin2pserver.org/in/game-id-game-seo-name/token/
API
You must create a new file, specific to our API for your website, this script must not be in a secure area and must be freely accessible so that our platform can call it after a vote. Our API allows you to reward your player for having made a vote for your game server within our platform, for this you must adapt and add the script of your reward.
You can test your API using this tool to simulate requests from our platform (Click here).
You can test your API using this tool to simulate requests from our platform (Click here).
<?php
// Secret key of your game server
define('GAME_KEY', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
// Data Verification
if (!isset($_GET['miaw']) && empty($_GET['miaw'])) {
// The request is incomplete
die('GET method is not defined');
} else {
// Data decoding
$_API = json_decode(base64_decode($_GET['miaw']), true, 2, JSON_OBJECT_AS_ARRAY);
// $_API['api'] => URL of your local API
// $_API['key'] => Secret key of your game server
// $_API['origin'] => Origin of the vote
// $_API['status'] => Vote status on Metin2PServer
// $_API['timestamp'] => Date and time of the vote (UTC)
// $_API['ip'] => Your player's IPv4 or IPv6 address (Can be NULL)
// $_API['ipv4'] => Your player's IPv4 address (Can be NULL)
// $_API['token'] => Your player's account token
// $_API['discord'] => Your player's Discord account ID (Can be NULL)
if ($_API['key'] == GAME_KEY) {
// You can reward your player
// Identify your player using $_API['token']
} else {
// The secret keys are not identical
// The request is probably falsified
die('Keys do not match');
}
}
?>