help with black name captured

08/29/2014 07:20 girgismena#1
hello every 1
can any1 tell me why when i kill some1 have black name he dosent go to jail ?
i check the codes and is think its right
the code is
PHP Code:
if (PKPoints 99)
            {
                if (
KillerName.EntityFlag == EntityFlag.Player)
                {
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Name " has been captured by " KillerName.Name " and sent in jail! The world is now safer!"System.Drawing.Color.RedMessage.Talk), Program.GamePool);
                    
Teleport(60005050);
                }
                else
                {
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Name " has been captured and sent in jail! The world is now safer!"System.Drawing.Color.RedMessage.Talk), Program.GamePool);
                    
Teleport(60005050); 
08/29/2014 07:34 Spirited#2
I can't see anything immediately wrong with the above code (assuming this is being called from the now-dead character's class). Breakpoint it. It doesn't take much effort to debug the source. Have you tried anything?
08/29/2014 07:39 girgismena#3
Quote:
Originally Posted by Spirited View Post
I can't see anything immediately wrong with the above code (assuming this is being called from the now-dead character's class). Breakpoint it. It doesn't take much effort to debug the source. Have you tried anything?
i tried to do everything and all is failed
and i checked
public void Die(Entity killer)
and i find everything is good too
it same like that
PHP Code:
if (killer.EntityFlag == EntityFlag.Player)
                            
DropRandomStuff(Killer);
                        else
                            
DropRandomStuff(Killer); 
and it drop gear from players if they r have more than 29 pkpoints mean everything is good
but still dosent work
08/29/2014 07:43 Spirited#4
Quote:
Originally Posted by girgismena View Post
i tried to do everything and all is failed
and i checked
public void Die(Entity killer)
and i find everything is good too
it same like that
PHP Code:
if (killer.EntityFlag == EntityFlag.Player)
                            
DropRandomStuff(Killer);
                        else
                            
DropRandomStuff(Killer); 
and it drop gear from players if they r have more than 29 pkpoints mean everything is good
but still dosent work
Again, debug the source. Use breakpoints, put output statements, do something. Just checking code won't fix your problems. You need to test it and step through the execution.

[Only registered and activated users can see links. Click Here To Register...]

Edit: Why do you have an else statement that does the same thing is the if statement? That doesn't look right to me.
08/29/2014 08:35 girgismena#5
1st of all thanks for that post
[Guide] How to Debug Your Server
its my 1st time i see that
i still dont understand everything about breakpoints but i will try to learn how it work from your post
thanks again
08/29/2014 08:51 Spirited#6
Quote:
Originally Posted by girgismena View Post
1st of all thanks for that post
[Guide] How to Debug Your Server
its my 1st time i see that
i still dont understand everything about breakpoints but i will try to learn how it work from your post
thanks again
Well, you seem to know how to read code, so you already have a good foot in the door. Learning how to debug your code is a huge step up though (not in difficultly, but in how effective you are as a programmer). Let me know how well that guide works out for you after you've taught yourself a bit more. If there's anything I can clarify with it, let me know.
08/29/2014 09:18 girgismena#7
Quote:
Originally Posted by Spirited View Post
Well, you seem to know how to read code, so you already have a good foot in the door. Learning how to debug your code is a huge step up though (not in difficultly, but in how effective you are as a programmer). Let me know how well that guide works out for you after you've taught yourself a bit more. If there's anything I can clarify with it, let me know.
thanks again brother
but i have one point i dont understand it yet
when i made breakpoints in that code
PHP Code:
if (PKPoints 99
            { 
                if (
KillerName.EntityFlag == EntityFlag.Player
                { 
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Name " has been captured by " KillerName.Name " and sent in jail! The world is now safer!"System.Drawing.Color.RedMessage.Talk), Program.GamePool); 
                    
Teleport(60005050); 
                } 
                else 
                { 
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Name " has been captured and sent in jail! The world is now safer!"System.Drawing.Color.RedMessage.Talk), Program.GamePool); 
                    
Teleport(60005050); 
and start the project from F11 (Step into)
when i can stop use F11 or F10 and when i have to use F10 or F11 ?
i know its a stupid question but like what i said its my 1st time i use the breakpoints

now i got it
i made my 1st breakpoint :)
but i dont know mean of all what i got
can u explan more ?
if u want me to take pic for what i got i will

---------------
lol thanks alot brother
i understand the problem now after i read ur post more and more and understand what mean of breakpoint and how it work
now i can explan my problem
the problem
"the black name didnt captured cuz the killer didnt got pkpoints when he killing him
so i tried that to be sure is that problem or not
if (PKPoints > 50)
and when i make the account just red name with 51 pk point and killing him
he got captured and sent to jail
now any idea to make the killer got pkpoints on black name
08/29/2014 17:36 Spirited#8
The person dying doesn't have PK Points? Well, now that's a more defined problem that we might be able to help with. Try putting a breakpoint on the actual PK Points property in the character class (the set method that sets PK Points). See how it's being set when you try killing someone). Good luck!
08/29/2014 17:49 girgismena#9
Quote:
Originally Posted by Spirited View Post
The person dying doesn't have PK Points? Well, now that's a more defined problem that we might be able to help with. Try putting a breakpoint on the actual PK Points property in the character class (the set method that sets PK Points). See how it's being set when you try killing someone). Good luck!
no The person dying have PK Points , but if he had more than 100 pk points
the killer didnt got pk points on him
08/29/2014 17:53 Spirited#10
Quote:
Originally Posted by girgismena View Post
no The person dying have PK Points , but if he had more than 100 pk points
the killer didnt got pk points on him
Hm, so you're saying that if the PKer kills another player, the PK points do stack up... but as soon as it stacks up to 100 points, and the PKer gets a black name, the PK points go to zero? Also, just to make sure, the code you posted is being called by the dying character, right?
08/29/2014 18:10 girgismena#11
Quote:
Originally Posted by Spirited View Post
Hm, so you're saying that if the PKer kills another player, the PK points do stack up... but as soon as it stacks up to 100 points, and the PKer gets a black name, the PK points go to zero? Also, just to make sure, the code you posted is being called by the dying character, right?
not go to zero
i know my english is sucks
but i will try to explan more
1-if u have 0 pk point and i killed u i got 10 pk point or 5 or 3 as what i'm ( enamy or guild enamy or normal player)
2- if you have more than 30 pk point and i killed you i got pk point too and drop ur gear
3- if you have more than 100 pk points and i killed you i will not get any pk points
like if you in free map

-------------------
by the way
when i made breakpoint on
if (PKPoints > 99)
and kill some1 have black name
no result in the project
but when i kill some1 else have white name or red name
i got many results
check the pic
and that when i killing normal player
i hope that will help you to understand me
08/30/2014 04:50 Spirited#12
It seems like the code isn't being hit. Try backtracking - put the breakpoint further up in the code and follow it using the step into / step over buttons (as you've seen in my guide).
08/30/2014 05:24 girgismena#13
Quote:
Originally Posted by Spirited View Post
It seems like the code isn't being hit. Try backtracking - put the breakpoint further up in the code and follow it using the step into / step over buttons (as you've seen in my guide).
when i use step into / step over it just go to program class and check codes there
i made many breakpoints
from the 1st code of
PHP Code:
public void DropRandomStuff(Entity KillerName 
to
PHP Code:
if (PKPoints 99)
            {
                if (
KillerName.EntityFlag == EntityFlag.Player)
                {
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Name " has been captured by " KillerName.Name " and sent in jail! The world is now safer!"System.Drawing.Color.RedMessage.Talk), Program.GamePool);
                    
Teleport(60003076);
                }
                else
                {
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Name " has been captured and sent in jail! The world is now safer!"System.Drawing.Color.RedMessage.Talk), Program.GamePool);
                    
Teleport(60003076); 
all have result exept pkpoints > 99
no result it seem like project doesn't read that
i'm really sorry cuz i bother u with my problem .
08/30/2014 05:46 Spirited#14
Remove other breakpoints then. Only target one problem at a time. Are you calling the PK points check from "DropRandomStuff"? That may be your problem. Keep following it up, or right click on the method name and select "Find All References". See where it's being called from and when it's called by the server.
08/30/2014 06:02 girgismena#15
Quote:
Originally Posted by Spirited View Post
Remove other breakpoints then. Only target one problem at a time. Are you calling the PK points check from "DropRandomStuff"? That may be your problem. Keep following it up, or right click on the method name and select "Find All References". See where it's being called from and when it's called by the server.
if it doesn't check from "DropRandomStuff"
so how u can drop gear from ppl have more than 30 pk points ?
and when i make Find All References on the method it just find 3 results
1st result is the method name
2nd
PHP Code:
DropRandomStuff(Killer); 
on die (entity killed) method
3rd 1 in same method
it same like that
PHP Code:
 DropRandomStuff(Killer);
                        else
                            
DropRandomStuff(Killer); 
i think the problem is project read who have more than 99 pk points is white name

oh my god
i find the problem and resolve it by your help
thanks alot , thanks very very much
u r really profisional
u helped me not only to resolve that problem
you helped me to learn how to debug my codes and know how i can find and test the problems .