Not sure if its usefull (as it was for me), but if someone using DSM (
https://forums.alliedmods.net/showthread.php?t=317478)
and want the script to edit the dsm table too so the command listener will work when someone link his discord -> steam.
I'm not a php/sql programmer so it might look wierd/dumb.
Add the following lines (in link.php) after the first connection lines.
PHP Code:
function toSteamID($id) {
if (is_numeric($id) && strlen($id) >= 16) {
$z = bcdiv(bcsub($id, '76561197960265728'), '2');
} elseif (is_numeric($id)) {
$z = bcdiv($id, '2'); // Actually new User ID format
} else {
return $id; // We have no idea what this is, so just return it.
}
$y = bcmod($id, '2');
return 'STEAM_1:' . $y . ':' . floor($z);
}
$steamID = toSteamID($steam64);
$conn2 = new mysqli($DBHOST2, $DBUSERNAME2, $DBPASSWORD2, $DBNAME2, $DBPORT2);
// Check connection
if ($conn2->connect_error) {
die("Connection failed: " . $conn2->connect_error);
}
$sanitizedName = $conn2->escape_string($steamName);
//Update dsm
$sql2 = "UPDATE `dsm` SET userid='".$discordId."', member='1' WHERE steamid= '".$steamID."'";
$dbresult2 = $conn2->query($sql2);
$conn2->close();
if(!$dbresult2) {
echo "Error while saving your steamId and Discord UserId! <br/>";
die();
}
Also add new db information in 'discord_config.php' with the dsm table information.
PHP Code:
// DSM
$DBHOST2 = "-";
$DBPORT2 = 3306;
$DBNAME2 = "dsm";
$DBUSERNAME2 = "-";
$DBPASSWORD2 = "-";
Currently it works fine for me, ik its not the best way to do that, but rewriting the php file / plugin isn't easier.