Community Forum

How to check if you are the server or the client?

Forum Overview >> Scripting

CategoryScripting
Created18.12.2021 16:22


Bob Bobster (Bobster82) 18.12.2021 16:22
Hello,

How do I get my mod only running on a server and not on a client? Like, mod.isServer then "code"
As single player you are always the server, right?

And when in multiplayer, when u save, does only the server save? or do you need to specify it in your mod?

Thanks in advance!

edit:
Are these still valid?
g_currentMission.missionDynamicInfo.isMultiplayer
g_currentMission.missionDynamicInfo.isClient

so if isMultiplayer and isClient then its a client and not a server, if isClient is false, then its the server??

And how to test muliplayer games?

Bob Bobster (Bobster82) 21.12.2021 20:22
I found out how to get those values, but I have a hard time getting date from the server to the client and the other way around.
How do you get data passing around? Is this only posible trough events?

I need to sync data on player join from the server.
I need to sync data to the server and others when changing something in the mod (like a menu)

Anyone any pointers? I like figuring it out, but sometimes a helping hand to move further would be nice haha

Bob Bobster (Bobster82) 22.12.2021 09:53
If we have enough time, we figure it out ourselves haha.

Got a working event system now, so no more answers needed.
Thanks


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