Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about attacking
#11
Server -

Code:
' Check for an npc
        For i = 1 To MAX_MAP_NPCS
        dim packet as string ' Might already be defined, don't know, if so, delete this
            If MapNpc(GetPlayerMap(Index), i).Num > 0 Then
                If MapNpc(GetPlayerMap(Index), i).x = x And MapNpc(GetPlayerMap(Index), i).y = y Then
                    ' Change target
                    Player(Index).Target = i
                    Player(Index).TargetType = TARGET_TYPE_NPC
                    BattleOpen = 1
                    Call PlayerMsg(Index, "Your target is now a " & Trim(Npc(MapNpc(GetPlayerMap(Index), i).Num).Name) & ".", Yellow)
                Else
                BattleOpen = 0
                packet = "Battle" & Sep_Char & BattleOpen & Sep_Char & End_Char
                Call SendData(Index, packet)
                    Exit Sub
              
                End If
            End If
        Next i
      
        Exit Sub
    End If

Client -

Code:
If LCase(Parse(0)) = "battle" Then
        ' Open Battle Form
        BattleOpen = Val(Parse(1))
        If BattleOpen = 1 Then
        frmBattle.Visible = True
        Else
        frmBattle.Visible = False
        End If

That should work, if not, it's not something hard to fix. Good luck.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)