Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Right click


GKO
 Share

Recommended Posts

Ok, ive been trying to add this:

When you right click on another player in picScreen it will bring up a little menu, which will display the players level, and give the option to trade with this player. But i cant seem to get the code figured out.

Could someone please help me with this?

Thanks in advance

Regards,
GKO
Link to comment
Share on other sites

You need to start off by editing the packet that searches where the mouse is clicked and edit it to also run during a right click, if it's a right click to send a packet to the client telling it to open the menu with the data required.
Link to comment
Share on other sites

In frmMain, find Private Sub picScreen_MouseDown

Find this:
```
    If InMapEditor Then
        Call MapEditorMouseDown(Button, x, y, False)
    Else
        ' left click
        If Button = vbLeftButton Then
            ' targetting
            Call PlayerSearch(CurX, CurY)
        ' right click
        ElseIf Button = vbRightButton Then
            If ShiftDown Then
                ' admin warp if we're pressing shift and right clicking
                If GetPlayerAccess(MyIndex) >= 2 Then AdminWarp CurX, CurY
            End If
        End If
    End If
```
Replace it with:
```
    If InMapEditor Then
        Call MapEditorMouseDown(Button, x, y, False)
    Else
        ' left click
        If Button = vbLeftButton Then
            ' targetting
            Call PlayerSearch(CurX, CurY)
        ' right click
        ElseIf Button = vbRightButton Then
            If ShiftDown Then
                ' admin warp if we're pressing shift and right clicking
                If GetPlayerAccess(MyIndex) >= 2 Then AdminWarp CurX, CurY
            Else
                ' this is where your code goes
                ' first search if a player is here (ask server)
                ' server will confirm and tell the client to open up the menu with target index
                ' once an option is clicked, client sends option with target index
                ' server check if legal and gives go ahead
                ' your going to have to make a picturebox with option on frmMain
            End If
        End If
    End If
```
Place your code where I inserted my comments. Good luck.

Read up on packets. I think this might be a good one:
http://www.touchofdeathforums.com/smf/index.php/topic,69393.msg746513.html
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...