Convidado Convidado
| Assunto: ADM pode atacar o player e o player pode atacar o ADM. Qua 13 Jul 2011, 21:48 | |
| --- Server ~ Side ---
Procure pela function: - Código:
-
Function CanAttackPlayer(ByVal Attacker As Long, ByVal Victim As Long) As Boolean E Substitua ela toda por: - Código:
-
Function CanAttackPlayer(ByVal Attacker As Long, ByVal Victim As Long) As Boolean Dim AttackSpeed As Long Dim x As Long Dim y As Long
If GetPlayerWeaponSlot(Attacker) > 0 Then AttackSpeed = Item(GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))).AttackSpeed Else AttackSpeed = 0 End If
CanAttackPlayer = False
' Checar por Subscript out of range If IsPlaying(Attacker) = False Or IsPlaying(Victim) = False Then Exit Function End If
' Ter certeza que não tem 0 de HP If GetPlayerHP(Victim) <= 0 Then Exit Function End If
' Ter certeza que não estamos atacando enquanto ele troca de mapa If Player(Victim).GettingMap = YES Then Exit Function End If
' Ter certeza que estão no mesmo mapa If (GetPlayerMap(Attacker) = GetPlayerMap(Victim)) And (GetTickCount > Player(Attacker).AttackTimer + AttackSpeed) Then x = DirToX(GetPlayerX(Attacker), GetPlayerDir(Attacker)) y = DirToY(GetPlayerY(Attacker), GetPlayerDir(Attacker))
If (GetPlayerY(Victim) = y) And (GetPlayerX(Victim) = x) Then If Map(GetPlayerMap(Victim)).Tile(x, y).Type <> TILE_TYPE_ARENA And Map(GetPlayerMap(Attacker)).Tile(GetPlayerX(Attacker), GetPlayerY(Attacker)).Type <> TILE_TYPE_ARENA Then
' Checar se o mapa é atacavel If Map(GetPlayerMap(Attacker)).Moral = MAP_MORAL_NONE Or Map(GetPlayerMap(Attacker)).Moral = MAP_MORAL_NO_PENALTY Or GetPlayerPK(Victim) = YES Then
' Ter certeza que se possui level suficiente If GetPlayerLevel(Attacker) < 10 Then Call PlayerMsg(Attacker, "Você está abaixo do nível 10, portanto, você não pode atacar um jogador!", BrightRed) Else
If GetPlayerLevel(Victim) < 10 Then Call PlayerMsg(Attacker, GetPlayerName(Victim) & " está abaixo do nível 10, portanto não pode ser atacado!", BrightRed) Else
If Trim$(GetPlayerGuild(Attacker)) <> vbNullString And GetPlayerGuild(Victim) <> vbNullString Then If Trim$(GetPlayerGuild(Attacker)) <> Trim$(GetPlayerGuild(Victim)) Then CanAttackPlayer = True Else Call PlayerMsg(Attacker, "Você não pode atacar um jogador do seu clã!", BrightRed) End If
Else CanAttackPlayer = True End If End If End If
Else Call PlayerMsg(Attacker, "Esta é uma zona segura!", BrightRed) End If End If End If
ElseIf Map(GetPlayerMap(Victim)).Tile(x, y).Type = TILE_TYPE_ARENA And Map(GetPlayerMap(Attacker)).Tile(GetPlayerX(Attacker), GetPlayerY(Attacker)).Type = TILE_TYPE_ARENA Then CanAttackPlayer = True End If
End Function Pronto, testado e aprovado por mim, dúvidas contate.
Créditos: RenanR.Até, Renan |
|