Community Forum

FarmManager and Farm

Forum Overview >> Farming Simulator 17

CategoryFarming Simulator 17
Created08.01.2019 18:54


Unknown 08.01.2019 18:54
Hi,

iam trying to determine if a player is farmanager of his farm in multiplayer or not.

Right now iam getting this error => dataS/scripts/farms/FarmManager.lua(273) : bad argument #1 to 'ipairs' (table expected, got nil)
While calling those functions in an if query => FarmManager:getFarmByUserId(g_currentMission.playerUserId):isUserFarmManager(g_currentMission.playerUserId)

Iam not really sure where i made the mistake.

Thanks

// Edit should have mentioned that this question is for the FS 19

Espen K. (estyx) 08.01.2019 20:09
Got a function you can look at here:
https://github.com/scfmod/FS19_PlaceAnywhereExtendedMP/blob/master/PlaceAnywhere.lua#L150

So basically you just use following:
playerHasPermission(userId, 'manageRights')

'manageRights' is permission string for farm manager

Jos Kuijpers (Unknown) 09.01.2019 10:35
and your mistake was using FarmManager instead of g_farmManager, the instance.

g_farmManager:getFarmByUserId(g_currentMission.playerUserId):isUserFarmManager(g_currentMission.playerUserId)


Unknown 09.01.2019 18:08
Thank you both.
Now it works.


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