Re: [Add-On] Lives System
This is actually useless 'ret.totalLives = 5;'
You can simply make the DEFAULT '5' and then remove it from the 'INSERT INTO' PreparedStatement in saveToDB.
Also, it won't be ps.setInt(69, totalLives); for most people, so keep in mind it differs for each source.
Re: [Add-On] Lives System
The first piece of advice, I didn't know that was even possible so thank you.
As for the second one, I already know, although I guess it'd be helpful for other players that don't.
Re: [Add-On] Lives System
Would be cooler if you 'lock' the character on perm death and then reenable it after doing some kind of payment (refering to votes, not money..).
IMO, the char deletion would only attract a very small group of players since most people are for the lvl's and high stat items. Giving them a chance to 'reborn' their character would increase the players interest and make it useful for real use in a pserver.
Re: [Add-On] Lives System
Also, it would be better to change this:
Code:
if (gmLevel == 0) {
totalLives--;
}
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
to
Code:
if (gmLevel == 0) {
totalLives--;
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
}
Because it will never go under 1 if gmLevel > 0
Re: [Add-On] Lives System
Quote:
Originally Posted by
kevintjuh93
Also, it would be better to change this:
Code:
if (gmLevel == 0) {
totalLives--;
}
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
to
Code:
if (gmLevel == 0) {
totalLives--;
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
}
Because it will never go under 1 if gmLevel > 0
Well, I made it so GM's wouldn't be able to lose lives. And in yours, GM's still wouldn't lose lives, it would have to be...
PHP Code:
totalLives--;
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
Re: [Add-On] Lives System
Quote:
Originally Posted by
Nmb1Gamer
Well, I made it so GM's wouldn't be able to lose lives. And in yours, GM's still wouldn't lose lives, it would have to be...
PHP Code:
totalLives--;
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
No, you missed his point.
This:
PHP Code:
if (gmLevel == 0) {
totalLives--;
}
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
Would first check the GM level, if it's 0 it will decrease totalLives. Then, it will check if totalLives is smaller than 1, and if so it will DC and delete the Char.
In this example:
PHP Code:
if (gmLevel == 0) {
totalLives--;
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
}
It checks for the gmLevel, if it's 0 it will decrease totalLives by 1. It will also check if totalLives is smaller than 1 and DC and delete the Char.
However, if the gmLevel is not 0, it will skip all of it. Including the part that checks if totalLives is smaller than 1.
Why would you do this? It's more efficient lol. It saves you 3 extra lines of code to be executed for every character.
Re: [Add-On] Lives System
Quote:
Originally Posted by
Lapje
No, you missed his point.
This:
PHP Code:
if (gmLevel == 0) {
totalLives--;
}
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
Would first check the GM level, if it's 0 it will decrease totalLives. Then, it will check if totalLives is smaller than 1, and if so it will DC and delete the Char.
In this example:
PHP Code:
if (gmLevel == 0) {
totalLives--;
if (totalLives < 1) {
client.disconnect();
client.deleteCharacter(id);
}
}
It checks for the gmLevel, if it's 0 it will decrease totalLives by 1. It will also check if totalLives is smaller than 1 and DC and delete the Char.
However, if the gmLevel is not 0, it will skip all of it. Including the part that checks if totalLives is smaller than 1.
Why would you do this? It's more efficient lol. It saves you 3 extra lines of code to be executed for every character.
Ah I see. Thanks for clarifying that lol.
Re: [Add-On] Lives System
*cough like button cough*
Any plans on expanding this?
Re: [Add-On] Lives System
I might expand on it later on, although I already have in the source that I'm working on. I pretty much gave everyone the basic layout for it so they can build off of it lol.
Re: [Add-On] Lives System
PHP Code:
private int totalLives;
Y U NO
PHP Code:
private int lives;