bom galera o titulo ja diz tudo um player não consegue atacar outro nem no ataque nem na magia e o pior e que não da erro pra min postar um Print aqui. Bom pra ajudar a identificar o erro amanha eu posto toda a sub(to no celular). Valeu a atenção galera.
tai as tres subs de playerx player:
tai as tres subs de playerx player:
- Código:
' ###################################
' ## Player Attacking Player ##
' ###################################
Public Sub TryPlayerAttackPlayer(ByVal attacker As Long, ByVal victim As Long)
Dim blockAmount As Long
Dim npcNum As Long
Dim mapNum As Long
Dim Damage As Long
Damage = 0
' Can we attack the npc?
If CanPlayerAttackPlayer(attacker, victim) Then
mapNum = GetPlayerMap(attacker)
' check if NPC can avoid the attack
If CanPlayerDodge(victim) Then
SendActionMsg mapNum, "Defendeu!", Pink, 1, (GetPlayerX(victim) * 32), (GetPlayerY(victim) * 32)
Exit Sub
End If
If CanPlayerParry(victim) Then
SendActionMsg mapNum, "Esquivou!", Pink, 1, (GetPlayerX(victim) * 32), (GetPlayerY(victim) * 32)
Exit Sub
End If
' Get the damage we can do
Damage = GetPlayerDamage(attacker)
' if the npc blocks, take away the block amount
blockAmount = CanPlayerBlock(victim)
Damage = Damage - blockAmount
' take away armour
Damage = Damage - RAND(1, (GetPlayerStat(victim, Agility) * 2))
' randomise for up to 10% lower than max hit
Damage = RAND(1, Damage)
' * 1.5 if can crit
If CanPlayerCrit(attacker) Then
Damage = Damage * 1.5
SendActionMsg mapNum, "Golpe Critico!", BrightCyan, 1, (GetPlayerX(attacker) * 32), (GetPlayerY(attacker) * 32)
End If
If Damage > 0 Then
Call PlayerAttackPlayer(attacker, victim, Damage)
Else
Call PlayerMsg(attacker, "Seu ataque não fez efeito.", BrightRed)
End If
End If
End Sub
Function CanPlayerAttackPlayer(ByVal attacker As Long, ByVal victim As Long, Optional ByVal IsSpell As Boolean = False, Optional ByVal IsProjectile As Boolean = False) As Boolean
If Not IsSpell And Not IsProjectile Then
' Check attack timer
If GetPlayerEquipment(attacker, Weapon) > 0 Then
If GetTickCount < TempPlayer(attacker).AttackTimer + Item(GetPlayerEquipment(attacker, Weapon)).Speed Then Exit Function
Else
If GetTickCount < TempPlayer(attacker).AttackTimer + 1000 Then Exit Function
End If
End If
' Check for subscript out of range
If Not IsPlaying(victim) Then Exit Function
' Make sure they are on the same map
If Not GetPlayerMap(attacker) = GetPlayerMap(victim) Then Exit Function
' Make sure we dont attack the player if they are switching maps
If TempPlayer(victim).GettingMap = YES Then Exit Function
If Not IsSpell And Not IsProjectile Then
' Check if at same coordinates
Select Case GetPlayerDir(attacker)
Case DIR_UP
If Not ((GetPlayerY(victim) + 1 = GetPlayerY(attacker)) And (GetPlayerX(victim) = GetPlayerX(attacker))) Then Exit Function
Case DIR_DOWN
If Not ((GetPlayerY(victim) - 1 = GetPlayerY(attacker)) And (GetPlayerX(victim) = GetPlayerX(attacker))) Then Exit Function
Case DIR_LEFT
If Not ((GetPlayerY(victim) = GetPlayerY(attacker)) And (GetPlayerX(victim) + 1 = GetPlayerX(attacker))) Then Exit Function
Case DIR_RIGHT
If Not ((GetPlayerY(victim) = GetPlayerY(attacker)) And (GetPlayerX(victim) - 1 = GetPlayerX(attacker))) Then Exit Function
Case Else
Exit Function
End Select
End If
' Check if map is attackable
If Not Map(GetPlayerMap(attacker)).Moral = MAP_MORAL_NONE Then
If GetPlayerPK(victim) = NO Then
Call PlayerMsg(attacker, "Está area é protegida!", BrightRed)
Exit Function
End If
End If
' Make sure they have more then 0 hp
If GetPlayerVital(victim, Vitals.HP) <= 0 Then Exit Function
' Check to make sure that they dont have access
If GetPlayerAccess(attacker) > ADMIN_MONITOR Then
Call PlayerMsg(attacker, "Adimistradores não podem atacar players.", BrightBlue)
Exit Function
End If
' Check to make sure the victim isn't an admin
If GetPlayerAccess(victim) > ADMIN_MONITOR Then
Call PlayerMsg(attacker, "Você não pode atacar " & GetPlayerName(victim) & "!", BrightRed)
Exit Function
End If
' Make sure attacker is high enough level
If GetPlayerLevel(attacker) < 10 Then
Call PlayerMsg(attacker, "Você está abaixo do nível 10, você não pode atacar outro jogador ainda!", BrightRed)
Exit Function
End If
' Make sure victim is high enough level
If GetPlayerLevel(victim) < 10 Then
Call PlayerMsg(attacker, GetPlayerName(victim) & " está abaixo do nível 10, você não pode atacar este jogador!", BrightRed)
Exit Function
End If
End Function
Sub PlayerAttackPlayer(ByVal attacker As Long, ByVal victim As Long, ByVal Damage As Long, Optional ByVal spellNum As Long = 0)
Dim Exp As Long
Dim n As Long
Dim i As Long
Dim Buffer As clsBuffer
' Check for subscript out of range
If IsPlaying(attacker) = False Or IsPlaying(victim) = False Or Damage < 0 Then
Exit Sub
End If
' Check for weapon
n = 0
If GetPlayerEquipment(attacker, Weapon) > 0 Then
n = GetPlayerEquipment(attacker, Weapon)
End If
' set the regen timer
TempPlayer(attacker).stopRegen = True
TempPlayer(attacker).stopRegenTimer = GetTickCount
If Damage >= GetPlayerVital(victim, Vitals.HP) Then
SendActionMsg GetPlayerMap(victim), "-" & GetPlayerVital(victim, Vitals.HP), BrightRed, 1, (GetPlayerX(victim) * 32), (GetPlayerY(victim) * 32)
' send the sound
If spellNum > 0 Then SendMapSound victim, GetPlayerX(victim), GetPlayerY(victim), SoundEntity.seSpell, spellNum
' Player is dead
Call GlobalMsg(GetPlayerName(victim) & " foi morto por " & GetPlayerName(attacker), BrightRed)
' Calculate exp to give attacker
Exp = (GetPlayerExp(victim) \ 10)
If Not frmServer.txtEventoEXP.Text = 0 Then
Exp = Exp * frmServer.txtEventoEXP.Text
End If
' Make sure we dont get less then 0
If Exp < 0 Then
Exp = 0
End If
If Exp = 0 Then
Call PlayerMsg(victim, "Você não perdeu experiencia.", BrightRed)
Call PlayerMsg(attacker, "Você não recebeu experiencia..", BrightBlue)
Else
Call SetPlayerExp(victim, GetPlayerExp(victim) - Exp)
SendEXP victim
Call PlayerMsg(victim, "Você perdeu " & Exp & " exp.", BrightRed)
' check if we're in a party
If TempPlayer(attacker).inParty > 0 Then
' pass through party exp share function
Party_ShareExp TempPlayer(attacker).inParty, Exp, attacker
Else
' not in party, get exp for self
If GetPlayerLevel(attacker) < MAX_LEVELS Then
GivePlayerEXP attacker, Exp
CheckPlayerLevelUp attacker
End If
End If
End If
' purge target info of anyone who targetted dead guy
For i = 1 To Player_HighIndex
If IsPlaying(i) And IsConnected(i) Then
If Player(i).Map = GetPlayerMap(attacker) Then
If TempPlayer(i).target = TARGET_TYPE_PLAYER Then
If TempPlayer(i).target = victim Then
TempPlayer(i).target = 0
TempPlayer(i).targetType = TARGET_TYPE_NONE
SendTarget i
End If
End If
End If
End If
Next
If GetPlayerPK(victim) = NO Then
If GetPlayerPK(attacker) = NO Then
Call SetPlayerPK(attacker, YES)
Call SendPlayerData(attacker)
Dim Cem As Long
Dim Nove As Long
If Cem = 1 Then
GiveInvItem attacker, 4, RAND(3, 5)
If Nove = 1 Then
GiveInvItem attacker, 3, RAND(3, 5)
Else
GiveInvItem attacker, 2, 1
Call GlobalMsg(GetPlayerName(attacker) & " Agora é um player assassino!", BrightRed)
End If
End If
End If
Else
GiveInvItem attacker, 2, 1
Call GlobalMsg(GetPlayerName(victim) & " has paid the price for being a Player Killer!!!", BrightRed)
GiveInvItem attacker, 2, 1
End If
Call OnDeath(victim)
Else
' Player not dead, just do the damage
Call SetPlayerVital(victim, Vitals.HP, GetPlayerVital(victim, Vitals.HP) - Damage)
Call SendVital(victim, Vitals.HP)
' send vitals to party if in one
If TempPlayer(victim).inParty > 0 Then SendPartyVitals TempPlayer(victim).inParty, victim
' send the sound
If spellNum > 0 Then SendMapSound victim, GetPlayerX(victim), GetPlayerY(victim), SoundEntity.seSpell, spellNum
SendActionMsg GetPlayerMap(victim), "-" & Damage, BrightRed, 1, (GetPlayerX(victim) * 32), (GetPlayerY(victim) * 32)
SendBlood GetPlayerMap(victim), GetPlayerX(victim), GetPlayerY(victim)
' set the regen timer
TempPlayer(victim).stopRegen = True
TempPlayer(victim).stopRegenTimer = GetTickCount
'if a stunning spell, stun the player
If spellNum > 0 Then
If Spell(spellNum).StunDuration > 0 Then StunPlayer victim, spellNum
' DoT
If Spell(spellNum).Duration > 0 Then
AddDoT_Player victim, spellNum, attacker
End If
End If
End If
' Reset attack timer
TempPlayer(attacker).AttackTimer = GetTickCount
Última edição por Snoopy em Seg maio 19, 2014 8:58 am, editado 1 vez(es)