Author Topic: Client Sided - Server Sided Communication Help  (Read 1240 times)

Ok so when a certain event is called a shop opens for the player. I was wondering how to find when a player closes the shop GUI without relying on the client telling me when. Because then they could just remove the code. canvas.pushDialog the GUI open and use the shop whenever and wherever they want.

You can't prevent the client from removing the code and there is no way to detect if a GUI is open on a specific client. What exactly are you trying to do?

You can't prevent the client from removing the code and there is no way to detect if a GUI is open on a specific client. What exactly are you trying to do?
There is an event that opens the shop (the shop has a GUI).
I don't want them to be able to manually open the shop and buy things whenever/wherever.

There is an event that opens the shop (the shop has a GUI).
I don't want them to be able to manually open the shop and buy things whenever/wherever.

Add checks to your server-sided purchasing command?

Add checks to your server-sided purchasing command?
To check what?

To check what?

That the client should be allowed to purchase items.

That the client should be allowed to purchase items.
When the event is activated I suppose I could tell the server they are allowed to purchase items but when would I set it sot their not allowed to purchase items?

When the event is activated I suppose I could tell the server they are allowed to purchase items but when would I set it sot their not allowed to purchase items?

... what.

The server should know whether they are allowed to purchase items or not. Nothing should need to tell it.
What the hell are you trying to do?

... what.

The server should know whether they are allowed to purchase items or not. Nothing should need to tell it.
What the hell are you trying to do?
Ok lets say when the event is called it does %client.canPurchase = true; and then they can purchase items. When will I know to do %client.canPurchase = false; ?

you use the second when you don't want them to buy
if it's a shop brick, try doing a check around the player when they're trying to buy for a shop brick within range

you use the second when you don't want them to buy
*Facepalm*
if it's a shop brick, try doing a check around the player when they're trying to buy for a shop brick within range
It's an event, not a brick. But I suppose I could it so that when their position changes it closes the shop and does not allow them to purchase anything.

« Last Edit: July 05, 2012, 09:58:33 PM by jes00 »

Ok lets say when the event is called it does %client.canPurchase = true; and then they can purchase items. When will I know to do %client.canPurchase = false; ?

When you were planning to close the purchasing GUI from the server.

*Facepalm*
why did you facepalm? He's saying that the check should occur at a critical moment.
It's an event, not a brick. But I suppose I could it so that when their position changes it closes the shop and does not allow them to purchase anything.
Of course it's a brick! The absolute only way for events to exist is on a brick, so it can never not be a brick!

But I suppose I could it so that when their position changes it closes the shop and does not allow them to purchase anything.

This isn't the sort of thing one can just do.

Are they actually moving? Did they just jump? Did someone else cause them to move?

These aren't simple checks you can just figure out overnight. Well, actually, you can, but still.
I would really recommend simply changing their player to an immobile one while the window is supposed to be open.

This isn't the sort of thing one can just do.

Are they actually moving? Did they just jump? Did someone else cause them to move?

These aren't simple checks you can just figure out overnight. Well, actually, you can, but still.
I would really recommend simply changing their player to an immobile one while the window is supposed to be open.
Similarly, you could just use setVelocity(0 0 0);