Jump to content

DRTY_KIWI

Member
  • Content Count

    5
  • Joined

  • Last visited

  • Medals

Everything posted by DRTY_KIWI

  1. Anyone managed to call the "RestAPI" class GET/POST methods successfully? I've been messing around trying to get a hello world type example working, but everytime I call the GET method the workbench crashes. If someone has managed to get this working I'd love to see an example. Maybe I'm just missing the obvious, so I'll include my test code below. class PY_TestGameModeClass: SCR_BaseGameModeClass { }; class PY_RestCallback : RestCallback { override void OnSuccess( string data, int dataSize ) { Print(data); // JsonApiStruct json = new JsonApiStruct; // json.ExpandFromRAW(data); SCR_HintManagerComponent.GetInstance().ShowCustomHint(data, "Cat Factz!", 20.0); }; override void OnError( int errorCode ) { Print(" !!! OnError() "); }; }; class PY_TestGameMode: SCR_BaseGameMode { override protected void EOnInit(IEntity owner) { super.EOnInit(owner); if(!System.IsConsoleApp()) //No GUI, so no events for it { Event_OnControllableSpawned.Insert(OnPlayerSpawnedClient); } } static PY_TestGameMode GetInstance() { return PY_TestGameMode.Cast(GetGame().GetGameMode()); } void OnPlayerSpawnedClient(IEntity entity) { GetGame().GetCallqueue().CallLater(ShowCatFact, 5000); } void ShowCatFact() { PY_RestCallback cbx1 = new PY_RestCallback; RestContext ctx = GetGame().GetRestApi().GetContext("https://catfact.ninja/"); ctx.GET(cbx1,"fact"); } }
  2. DRTY_KIWI

    "RestAPI" Class Issues

    For anyone that ends up finding this thread, this issue seems to have been fixed in the latest patch (7th June). The code I was testing is now returning as expected, without crashing the Enfusion workbench.
  3. DRTY_KIWI

    "RestAPI" Class Issues

    Nevermind, I've done some more research and this seems to be a confirmed bug. https://feedback.bistudio.com/T164859 Hopefully this gets fixed in an upcoming patch.
  4. Hi, guys hoping you can help me solve this, I,m a fairly experienced mission scripter but a complete noob when it comes to addons. The problem I,m having is the config file I have created to add an extra item to the game (a simple cube) won,t load at all, and causes the game to become unresponsive at startup. class CfgPatches { class jac_custom { units[] = {}; weapons[] = {}; requiredVersion = 0.100000; }; }; class CfgVehicleClasses { class customClass { displayName = "JAC Custom Shit"; }; }; class cfgVehicles { class Static {}; class jac_square : Static { scope = public; armor = 90; icon = "\ca\data\data\Unknown_object.paa"; model = "\jac_custom\square.p3d"; displayName = "Plate Block"; }; }; Hope you can help thanks.
  5. Hey that worked, thanks!
×