Community Forum

Anyway to send/recieve data from a FS22 Script

Forum Overview >> Farming Simulator 22

CategoryFarming Simulator 22
Created16.03.2022 17:39


Christian Hill (WiredOrange) 16.03.2022 17:39
I am looking at making an in-game script so I can edit in-game data from a website. (IE Adding/Removing money, spawning in vehicles @ a certain location) Obviously, this also means I need to read data. I asked a few months ago on discord and someone said that all HTTP(s) is handled in the engine and it's blocked in LUA. I just wanted to know if this was still true and if it is, is there another way around this?

Colin Smith (WrinkleysRule) 16.03.2022 19:24
I doubt that it would be possible as it would obviously be a security issue and leave the game open to all sorts of hacks/problems.

Matheus Contassot (mattcontassot) 17.03.2022 21:30
I am trying to do a thing like that, I want give contract for another farmer without need to be in game.

Matheus Contassot (mattcontassot) 17.03.2022 21:35
I would like add this tag in farms.xml:

<contracting>
<farm farmId="2"/>
</contracting>

Of corse if only add this in farms.xml will only work after server reboot... because it is the only moment the server read this file, otherwise only write.

But I am sure it's possible to do a thing like that through a mod.

Michael T. (mx11de) 21.03.2022 19:02
@mattcontassot
Write it to an extra xml file an save or read it perodic with an script and then to the MissionManager

Matheus Contassot (mattcontassot) 28.03.2022 00:36
@mx11de I'm a dev but not modder, I read the documentation about MissionManager and I guess it's related only between player and npc contract, am I wrong?

What I want is farm A gives authorization for farmer B (farmId="2") access his fields and equipments, like:

<contracting>
<farm farmId="2"/>
</contracting>

Are you sure if I reasearch again about "missionManager" function I'll be able to do this even not beeing online in the server?

P.S: I read about the function here: https://gdn.giants-software.com/documentation_scripting_fs19.php?version=engine&category=5&class=40

Matheus Contassot (mattcontassot) 28.03.2022 00:55
@mx11de I'm a dev but not modder, I read the documentation about MissionManager and I guess it's related only between player and npc contract, am I wrong?

What I want is farm A gives authorization for farmer B (farmId="2") access his fields and equipments, like:

<contracting>
<farm farmId="2"/>
</contracting>

Are you sure if I reasearch again about "missionManager" function I'll be able to do this even not beeing online in the server?

P.S: I read about the function here: https://gdn.giants-software.com/documentation_scripting_fs19.php?version=engine&category=5&class=40

Colin Smith (WrinkleysRule) 28.03.2022 11:56
You will probably find the FS19 script has been updated so check the new scripts in the debugger data$_scripts folder
Also as you appear to want to give permissions there is this function in the MissionStartEvent.lua

function MissionStartEvent:run(connection)
if not connection:getIsServer() then
local senderUserId = g_currentMission.userManager:getUserIdByConnection(connection)
local senderFarm = g_farmManager:getFarmByUserId(senderUserId)

if g_currentMission:getHasPlayerPermission("manageContracts", connection, senderFarm.farmId) then
g_missionManager:startMission(self.mission, self.farmId, self.spawnVehicles)
end
end
end





Note: Log in to post. Create a new account here.