[TUT]Public death count

Results 1 to 6 of 6
  1. #1
    Account Upgraded | Title Enabled! TehByte is offline
    MemberRank
    Nov 2008 Join Date
    313Posts

    [TUT]Public death count

    Ok, well this is a simple system to count the amount of players that have died on your server. This is good for PK servers I guess, but it's also on RS.

    So first in player.java we shall make a int;
    Code:
    public int DeathCount = 0;
    We make it "public" so it counts everyone and not just one player, otherwise it would just be an int

    Next we will add this code in your death method (found in player.java search for your death message)
    Code:
    DeathCount += 1;
    This will make it so that when each player dies it adds to the public int so it will count for everyone and not just one player.

    Next we need to echo the variable, in runescape this sign is shown on the signpost outside the lumbridge prayer centre thing, but you can make it a command or what ever.
    Code:
    case SIGNPOST;
    p.frames.sendMessage(p, "So far today " +p.DeathCount+ "player(s) have died on UR SERVER");
    break;
    Yeh, so have fun kiddies.


  2. #2
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: [TUT]Public death count

    thanks, been BORROWING this for along time, luuulz

  3. #3
    Account Upgraded | Title Enabled! TehByte is offline
    MemberRank
    Nov 2008 Join Date
    313Posts

    Re: [TUT]Public death count

    Lmao Joe,
    Your welcome (:

    Like, 10 views, 1 post? AMGZ LEECH XD

  4. #4
    right + down + X GhostSnyper is offline
    MemberRank
    May 2006 Join Date
    AZ, USALocation
    2,818Posts

    Re: [TUT]Public death count

    Just so you know, it's a public int not because it's available to all players, but because making it public makes it available to all classes. Protected int makes it available to all classes in it's current package, and private int is using the int within it's own class only. Making an int player specific is making an int in a player object... Lulz

  5. #5
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: [TUT]Public death count

    Quote Originally Posted by GhostSnyper View Post
    Just so you know, it's a public int not because it's available to all players, but because making it public makes it available to all classes. Protected int makes it available to all classes in it's current package, and private int is using the int within it's own class only. Making an int player specific is making an int in a player object... Lulz
    Were u talking to us? because thats the most simplest thing loooool..

    But yeh, i suppose if this is the tut section, you need some knowledge of what is going on with this code :P

  6. #6
    Account Upgraded | Title Enabled! TehByte is offline
    MemberRank
    Nov 2008 Join Date
    313Posts

    Re: [TUT]Public death count

    Quote Originally Posted by GhostSnyper View Post
    Just so you know, it's a public int not because it's available to all players, but because making it public makes it available to all classes. Protected int makes it available to all classes in it's current package, and private int is using the int within it's own class only. Making an int player specific is making an int in a player object... Lulz
    Yeh, but for most people they just need to know "int" works for one player only, doesn't show for others unless you use like "p2" or what ever, and "public int" makes it accessable for all players without the "p2" value infront.

    Thats a simpe way to explain it.



Advertisement