Sign In Register

How can we help you today?

Start a new topic
Answered

convert json code c++

 how i convert this code {
  "@class": ".RegistrationRequest",
  "displayName": "fdg",
  "password": "fdsg",
  "segments": {},
  "userName": "fdsfg",
  "scriptData": {
  "email": "dsds@iol.pt",
  "level": "4"
  }
}

to c++


Best Answer

 sorry i find the soluction

i forget to include the librarys


Hi Pedro, 


Each request page in the documentation contains an example for each SDK. For the C++ version of this event you can look here.


Regards,

Liam

this is my code
i can´t put scriptdata work


 

GameSparks::Core::GS& gs = UGameSparksModule::GetModulePtr()->GetGSInstance();
	GameSparks::Api::Requests::RegistrationRequest req(gs);
	req.SetUserName(std::string(TCHAR_TO_UTF8(*username)));
	req.SetPassword(std::string(TCHAR_TO_UTF8(*password)));
	req.SetDisplayName(std::string(TCHAR_TO_UTF8(*username)));
	req.Send(UGameSparksStatics::RegistatrianRequest_Response);

 

 

Hello Pedro,


Refer to this:


  

//Create a data object
GSRequestData scriptData;
//Add a string variable with the key 'email'
scriptData.AddString("email", "example@gamesparks.com");

//Create a registration request
GameSparks::Api::Requests::RegistrationRequest request(gsInstance);
request.SetPassword("abcdefgh");
request.SetUserName("abcdefgh");
request.SetDisplayName("abcdefgh");
//Insert the object as the scriptData
request.SetScriptData(scriptData);


// send the request
request.Send(RegistrationRequest_Response);

  


More on C++ functions, requests, responses and data types here: https://docs.gamesparks.com/tutorials/game-engine-integrations/cpp-quick-start.html


Cheers,

Omar

sorry don´t work becouse is to unreal engine and not c++
my bad


 

Answer

 sorry i find the soluction

i forget to include the librarys

Login to post a comment