Hi all i have small problem with AoE spell

as you can see it is not easy charm that would appear to have been in the middle of a spell

Function InUseArea(ByVal index As Long, ByVal SpellNum As Long)
Dim i As Long, n As Byte
Dim Mapa As Long, x As Byte, y As Byte

    n = Spell(SpellNum).AoE
    Mapa = GetPlayerMap(index)

    For x = 0 To n
        For y = 0 To n
            SendAnimation Mapa, Spell(SpellNum).SpellAnim, GetPlayerX(index) - x, GetPlayerY(index) + y
            SendAnimation Mapa, Spell(SpellNum).SpellAnim, GetPlayerX(index) + x, GetPlayerY(index) + y
            SendAnimation Mapa, Spell(SpellNum).SpellAnim, GetPlayerX(index) - x, GetPlayerY(index) - y
            SendAnimation Mapa, Spell(SpellNum).SpellAnim, GetPlayerX(index) + x, GetPlayerY(index) - y
        Next
    Next

    For i = 1 To MAX_MAP_NPCS
        If MapNpc(Mapa).NPC(i).x = x Then
            If MapNpc(Mapa).NPC(i).y = y Then
                PlayerAttackNpc index, i, Spell(SpellNum).Vital
            End If
        End If
    Next

    For i = 1 To Player_HighIndex
        If i = GetPlayerMap(index) Then Exit Function

        If GetPlayerMap(i) = Mapa Then
            If GetPlayerX(i) = x Then
                If GetPlayerY(i) = y Then
                    PlayerAttackPlayer index, i, Spell(SpellNum).Vital, SpellNum
                End If
            End If
        End If
    Next
End Function