Ruins of Hell Posted August 21, 2012 Share Posted August 21, 2012 What part "doesn't work"? What steps have you followed to add this packet?Also try this:```Sub HandleCheckCurrency(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim itemamount As LongSet Buffer = New clsBufferBuffer.WriteBytes Data()itemamount = Buffer.ReadLong' check goldIf itemamount > HasItem(index, 1) ThenPlayerMsg index, "Not enough gold.", BrightRedExit SubEnd IfSet Buffer = NothingEnd Sub```Now:```Call CheckCurrency(x)```will check if they have more than x currency. Link to comment Share on other sites More sharing options...
Dawntide Posted August 21, 2012 Author Share Posted August 21, 2012 I did it exactly like you did, but it just shows the chat message, but does not exit the sub, i can still play the minigame. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted August 21, 2012 Share Posted August 21, 2012 Uhhh…? What? Exit Sub exits the subroutine it is currently in. It does not send a message to the client telling it to Exit Sub, or stop something. You can have the server send that message back to the client with another packet, and then the new packet could hide the form from the client. Link to comment Share on other sites More sharing options...
Dawntide Posted August 21, 2012 Author Share Posted August 21, 2012 I have a minigame, you just need to click 1 button, its random if you win or lose. If you win you get 50 gold, if you lose you lose 50 gold.i want it to exit the minigame button click Sub when the player has less than X gold. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted August 21, 2012 Share Posted August 21, 2012 > I have a minigame, you just need to click 1 button, its random if you win or lose. If you win you get 50 gold, if you lose you lose 50 gold.> > i want it to exit the minigame button click Sub when the player has less than X gold.It can't. The server cannot and does not send the "Exit Sub" to the client. The "Exit Sub" exits the current sub the server is in. You will need to send a packet back to the client, which the client could then use to determine whether or not to continue. Link to comment Share on other sites More sharing options...
Dawntide Posted August 21, 2012 Author Share Posted August 21, 2012 And how to send packets from server to client? I only know client to serverIt's so difficult :/ Link to comment Share on other sites More sharing options...
Ruins of Hell Posted August 21, 2012 Share Posted August 21, 2012 Try looking at the existing code, see if you can get that to work (a good place to start is Sub PlayerMsg). If not, I'll help you later. Link to comment Share on other sites More sharing options...
Joyce Posted August 21, 2012 Share Posted August 21, 2012 > And how to send packets from server to client? I only know client to serverI thought I covered this? It's the exact same process, except you're using a different Enum list..And if it's ONE button with a 50/50 chance, why not send a query from the client to the server for the minigame, and let the server randomize it? And just close the form client-side as soon as you click it. Saves a loooot of your trouble, and plugs a major security hole you're creating right now. I was under the assumption you made an actual minigame. Link to comment Share on other sites More sharing options...
Dawntide Posted August 22, 2012 Author Share Posted August 22, 2012 I can not get it to work, it only works if i create a currency label on the minigame and make its caption the same as frmMain.lblGold.Caption and if its 0 then i disable the button. It's not really save, isn't it? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now