ollixsykes Posted February 5, 2018 Author Share Posted February 5, 2018 Hello my friends, i have a little problem on projectiles system, im using resbak engine, i can attack and target my own character with bow,arrows(projectiles weapons only) and i can kill myself, how to fix it? Thanks alot! Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted February 5, 2018 Share Posted February 5, 2018 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 More sharing options...
ollixsykes Posted February 5, 2018 Author Share Posted February 5, 2018 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 Suband this way:* If Player(MyIndex).target = MyIndex Then PlayerMsg Index, "You can't attack yourself.", BrightRed Exit Subon 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 More sharing options...
SolidLink Posted February 5, 2018 Share Posted February 5, 2018 It should be server sided and the possible sub would be tryPlayerShootPlayer Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted February 5, 2018 Share Posted February 5, 2018 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 More sharing options...
ollixsykes Posted February 5, 2018 Author Share Posted February 5, 2018 @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 IfVariable 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 More sharing options...
Mohenjo Daro Posted February 5, 2018 Share Posted February 5, 2018 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 More sharing options...
ollixsykes Posted February 5, 2018 Author Share Posted February 5, 2018 Love you Mohenjo Daro, fixed :)Also thanks for SolidLink for reply too.See ya guys Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted February 5, 2018 Share Posted February 5, 2018 No problem, I marked the fix as the answer so anyone in the future can get the fix as well :) Have a good one! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now