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

A Little problem


ollixsykes
 Share

Recommended Posts

On the client, find the attack code for the bow, then check your target. Add a check if you're targeting yourself, and exit the sub if you are.

It should look something like this:
```If Player(MyIndex).Target = MyIndex Then Exit Sub```

I don't know if that code will work or not, but it should look very similar to that.

***

(You will need VB6 to edit this, Visual Studios will not work)
Link to comment
Share on other sites

Are you sure it is on client side? not server side? i tried this way:


* If targetType = TARGET_TYPE_PLAYER And Target = index Then
PlayerMsg index, "You can't attack yourself.", BrightRed
Exit Sub

and this way:


* If Player(MyIndex).target = MyIndex Then
PlayerMsg Index, "You can't attack yourself.", BrightRed
Exit Sub

on createprojectile sub at client source, because i don't have any bow or something code related on client , also don't worked :|


Thanks for the fast reply!
Link to comment
Share on other sites

It can be client or server side. The thing is, it's more work for the server to do when you can just have a check in the client. It doesn't really matter if a player has a client without the fix, it's their fault, so it doesn't need to be server side.

Basically, does it affect anyone's game play if a player has a client they shouldn't without this fix? And the answer is no, not really.

***

~~Find~~

~~Public Sub CheckAttack()~~

***

~~Under~~

~~If StunDuration > 0 Then Exit Sub ' stunned, can't attack~~

***

~~Add This~~

~~If myTargetType = TARGET_TYPE_PLAYER Then
If myTarget = MyIndex Then
PlayerMsg Index, "You can’t attack yourself.", BrightRed
Exit Sub
End If
End If~~


***

~~This change isn't tested, but I did look for variable names so the code should work. Let me know if it does or doesn't :)~~
Link to comment
Share on other sites

@mohenjo-daro said in [A Little problem](/post/701231):
> If myTargetType = TARGET_TYPE_PLAYER Then
> If myTarget = MyIndex Then
> PlayerMsg Index, "You can’t attack yourself.", BrightRed
> Exit Sub
> End If
> End If

Variable not defined in both methods (index) and (myIndex)

Edit: defined the variables and i still can attack myself
Link to comment
Share on other sites

Ok, I tested the following code in AE (based off of Resbak) and it worked.

Go to
```
Public Sub CheckAttack()
```

***

Under
```
With TempPlayer(MyIndex)
.Attacking = 1
.AttackTimer = GetTickCount
End With
```

***

Add
```
If myTargetType = TARGET_TYPE_PLAYER Then
If myTarget = MyIndex Then
Call AddText("You can’t attack yourself.", BrightRed)
Exit Sub
End If
End If
```

***

MyIndex should be a global, so you shouldn't need to define it. (Don't forget to remove the previous code from the other post).
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...