Hey! As some of you might noticed lately, you don't need SSM anymore to be listed at CryMP.net, it's enough to just modify your CryNetwork.dll and master does job for you. But there is even more now, now you can quickly check if profile ID is valid (one sent by player using !validate id token) and really simply like this:
1. Grab SHA1 for Lua library here: https://raw.githubusercontent.com/kikito/sha1.lua/master/sha1.lua
2. Get your private key for server here: http://crymp.net/api/mykey.php (it's bound to IP, if your server changes IP, please consider checking for key again)
3. Implement this simple script into your SSM:
sha1 = require "sha1"
privkey = "YOUR_PRIVATE_KEY"
function verifyToken(id, token, privkey)
local tok, t = string.match(token, "([a-f0-9A-F]+)_(.*)")
if tok:len()<40 then return nil; end
local vlen = tok:len() - 40
local hsh = tok:sub(0, vlen)
local org = id..":"..t..":"..privkey
local sign=sha1(org)
local part=sign:sub(0,vlen)
return (part==hsh)
end
And use it like this
AddChatCommand("validate", function(self, player, msg, id, token) --beware, this is SafeWriting syntax
-- change it depending on your SSM way of creating chat commands with arguments
local num_id = tonumber(id)
local ok = false
if num_id>800000 then
ok=true;
else
local valid = verifyToken(id, token, privkey)
if valid then ok=true; end
if not ok then
--- in this case offline validation failed
num_id = math.random(800000, 1000000) -- if it failed, lets just assign random profile to player
end
end
player.profile = num_id
--in case your are using Patriot do this:
player.actor.GetProfileId = function(s) return num_id end
end,{WORD,WORD});
In case you are using some other SSM (like AegisX, or any other that uses function like GetProfile(player) to return profile ID), please consider rewriting your function to return simply player.profile or 0, like this:
function XGetProfile(player)
return player.profile or 0;
end
-- and make sure to set player.profile = num_id; in your validation command
❤️ 0