First sorry I thought this would be a server side issue.
This is my setup.
My room variable is manually assign to the room via admin panel.
zone configuration > MyZone > MyRoom > RoomVariable > add (multiple item variable inside here. Mostly Price of the items)
Client login to game > database send SfsObject data back to client to load proper data and convert it into UserVariable.
example:
Code: Select all
List<UserVariable> userVariables = new List<UserVariable>();
userVariables.Add(new SFSUserVariable("CharLevel",(int)ObjIn.GetInt("LVL")));
userVariables.Add(new SFSUserVariable("CharChr",(int)ObjIn.GetInt("CHR")));
userVariables.Add(new SFSUserVariable("CharStr",(int)ObjIn.GetInt("STR")));
userVariables.Add(new SFSUserVariable("CharVig",(int)ObjIn.GetInt("VIG")));
userVariables.Add(new SFSUserVariable("CharSilver",(int)ObjIn.GetInt("SILV")));
Sfs.Send(new SetUserVariablesRequest(userVariables));
Player Go into Shop and try to buy an item and client code does this check:
Code: Select all
if(Sfs.MySelf.GetVariable("CharSilver").GetIntValue() >= Sfs.LastJoinedRoom.GetVariable(ItemID+"Price").GetIntValue())
{
Debug.log("Item Buy Success");
//update player money
List<UserVariable> userVariables = new List<UserVariable>();
userVariables.Add(new SFSUserVariable("CharSilver", (int)Sfs.MySelf.GetVariable("CharSilver").GetIntValue() -Sfs.LastJoinedRoom.GetVariable(ItemID+"Price").GetIntValue()));
Sfs.Send(new SetUserVariablesRequest(userVariables));
}
else
{
Debug.log("Insufficient Funds");
}
Then we would use CheatEngine to hack the game money by changing it's value and it successfully accomplish its task. I was under the impression that a uservariable is stored on the server though the client can see it they shouldn't be able to change it's value without sending a SetUserVariablesRequest.
Is there something I'm not understanding correctly here?