server without SafeWriting, is it possible?

Page:1 2 3 4 5 6 7 8 9  

  • Zi;

    Now when this is done, look SafeWritingMain.lua from SafeWriting.pak for further implementation of protocol, you basically need to register server and later update it inside network. To find given code, simply search for "reg.php" and "up.php" So far you register your server at CryMP by connecting to http://crymp.net/api/reg.php and provide details in GET or POST params, it doesn't matter, (GET params are those inside URL, like thread.php?id=123... so GET param "id" equals "123" now), after successfuly registered, you should retrieve token, which will later be used to update your server in the list. For example --mapPath should look like this: multiplayer/ps/mesa function register_server(port, name, numPlayers, maxPlayers, mapPath, mapDownloadLink, timeLeft) mapDownloadLink=mapDownloadLink or "" -- http link to map download timeLeft=timeLeft or 0 --remaining round time in seconds local result = http_request("http://crymp.net/api/reg.php?ver=6156&port="..urlencode(port).."&name="..urlencode(name).."&numpl="..numPlayers.."&maxPl="..maxPlayers.."&map="..urlencode(mapPath) ... and so on...) local token=string.match(result,"<<Cookie>>([a-z0-9]-)<<") return token end Updating server is similar to this, only you need to pass token as "&cookie=" inside URL to /api/up.php

    ❤️ 0
  • golden_elite13

    Thank you Zi; ^^ I tried all this and it seems to work.. but not totally, i don't think if the updating is made.. players list don't appear on the list and we cannot see the max players number.. but that's not all, sfwcl players haven't any valid profileID on my server (all are "0")... I'll be happy if you explain me how to get all work^^ Thanks a lot :)

    ❤️ 0
  • golden_elite13

    Or maybe all the answers i'm searching for are in SafeWritingMain.lua but it'a bit messy in this script.. maybe i don't see all necessary informations (and code)

    ❤️ 0
  • Zi;

    Well, here comes the problem, profile ID will always be 0, thing is SSM SafeWriting uses custom profile ID implementation not based on game one, player.profile corresponds to profile ID, so it can be changed anytime by Lua, I don't know how about Phoenix/Patriot though, I think there is function player.actor:GetProfileId(), but no idea how it is implemented. About max players, I am sorry, I made a typo in my answer :D it isn't &maxPl, but just &maxpl - all lowercase. Now for players list, it works like this: Iterate over each player and append to player string in format: @name%rank%kills%deaths%profileId Pass the string to server as &players=... So code: function build_players_string() local players = g_gameRules.game:GetPlayers() or {} local plstring = "" for i,v in pairs(pls) do if v and v.GetName then plstring=plstring.."@"; local name=v:GetName(); local k,d=GetPlayerScore(v); --change this according to SSM Patriot to get kills and deaths into k,d variables!!! local rank=0; if g_gameRules.class=="PowerStruggle" and g_gameRules.GetPlayerRank and v and v.id then rank=g_gameRules:GetPlayerRank(v.id) or 1; end local id=v.profile; --change this according to SSM Patriot to pass profile ID of player!! local str=name.."%"..rank.."%"..k.."%"..d.."%"..id; plstring=plstring..str; end end return plstring end

    ❤️ 0
  • Zi;

    And now to assign profile IDs accordingly, when player connects, they pass !validate profile uid name to authenticate So all you gotta do is validate if it's not spoofed by connecting http://crymp.net/api/validate.php?prof=...&uid=..., if you get response "%Validation:Failed%", then it's failed, otherwise change player's profile ID accordingly to command, for further details see ServerFolder/ChatCommands/Validation.lua :D Also you should skip checking profile IDs, if user passes ID in range 800000 - 1000000 in !validate command, that means it's temporary unregistered account / not logged in. :D

    ❤️ 0
  • golden_elite13

    Thank you Zi, i will try this^^

    ❤️ 0
  • Zi;

    By the way, if you open latest SafeWritingMain.lua, yeah it is a little bit mess, but all required code is located on lines from 557 to 644

    ❤️ 0
  • golden_elite13

    Yes it's where i was looking to compare with my code, but even after correcting and veryfing the players max numbers doesn't change :/ always and 0, maybe the http request has something false... Is the order important ? ("&port" before "&maxpl" etc..) I think the problem is in the updating function because my server appear on the list few seconds after i launched it.. and disappears. Mmmh and I don't know on what "frequency" has to be the updating function ? Or what other func calls it ??

    ❤️ 0
  • Zi;

    Order isn't important, just make sure everything is lowercase in names of params (&port=...&maxpl=...), frequency is good when it's around 45 seconds, even 30 seconds is welcome, but that is little overkill :D Only important order is to connect reg.php first and then only up.php to update

    ❤️ 0
  • Zi;

    Don't forget to pass &cookie=... token in every up.php request (token you got in reg.php), for example if response was <<Cookie>>blablabla<<, token is "blablabla", so you pass &cookie=blablabla into every next request. Also try passing empty "&pass=" in every up.php request, that's used when server has no password

    ❤️ 0
Page:1 2 3 4 5 6 7 8 9