Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3

Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3
pvp not killing defendant
DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • September 19, 2019, 12:45:28 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: pvp not killing defendant  (Read 4502 times)
0 Members and 1 Guest are viewing this topic.
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« on: March 14, 2004, 02:21:51 PM »

when someone defeats another with pvp, the attacked person is not dying.  is that how it always was?  because now that person can be attacked over and over again.

edit: for some reason i had this line commented out Huh
Code:
      $sql = "UPDATE accounts SET alive=0, killedin='$killedin', goldinbank=goldinbank-IF(gold<$badguy[creaturegold],gold-$badguy[creaturegold],0),gold=gold-$badguy[creaturegold], experience=experience*.95, slainby=\"".addslashes($session[user][name])."\" WHERE acctid=$badguy[acctid]";
« Last Edit: March 14, 2004, 02:36:00 PM by sixf00t4 » Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #1 on: March 14, 2004, 03:29:46 PM »

hmmm, that didnt fix it.
Logged

Luinefirithion
Guest
« Reply #2 on: March 16, 2004, 03:02:47 PM »

Does the attacker get the experience and the gold the defender has on hand?

When a player kills another player, the dead defender remains dead until he logs in again.  When that player logs in he is alive and will be vulnerable to attack again (so long as a certain amount of time has passed since the first PvP, I think it's 10 minutes).
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #3 on: March 16, 2004, 03:58:30 PM »

the attack does get the gold and exp.  and both get the emails of the event.  

sees the list of players, clicks on one, defeats him, looks at the list again, and that person is still there.  so essentially, they can attack that person every 10 minutes.
Logged

Kendaer
Guest
« Reply #4 on: March 16, 2004, 06:05:33 PM »

When a player is attacked, they are marked 'dead' *until* they log in again.

They will NOT need to face ramius or resurrect or anything else.  This is deliberate.

So what is *most likely* happening.
A kills B.
B logs in to read the emails and logs out (which resets their 'killed flag')
C kills B
B logs in to read the emails and logs out.
Repeat.

This is *deliberate behaviour* so that a player is not penalized for being attacked while offline.  If players are not smart about it however, it can cause them to lose more than they would otherwise lose due to being killed repeatedly.
Logged
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #5 on: March 16, 2004, 10:06:35 PM »

no, i set up dummy accounts.  had them with 2 defense. then i attacked them.  got the exp and gold and all that.  and 10 minutes late i could still attack them.

my pvp code:

Code:
      $sql = "SELECT gold FROM accounts WHERE acctid='".(int)$badguy['acctid']."'";
      $result = db_query($sql);
      $row = db_fetch_assoc($result);
      $badguy[creaturegold]=((int)$row[gold]>(int)$badguy[creaturegold]?(int)$badguy[creaturegold]:(int)$row[gold]);
      //$sql = "UPDATE accounts SET alive=0, killedin='$killedin', goldinbank=goldinbank-IF(gold<$badguy[creaturegold],gold-$badguy[creaturegold],0),gold=gold-$badguy[creaturegold], experience=experience*.95, slainby=\"".addslashes($session[user][name])."\" WHERE acctid=$badguy[acctid]";
// \/- Gunnar Kreitz
      $lostexp = round($badguy['creatureexp']*getsetting("pvpdeflose",5)/100,0);
       $mailmessage = "`^".$session['user']['name']."`2 attacked you in $killedin`2 with %p `^".$session['user']['weapon']."`2, and defeated you!"
            ." `n`nYou noticed %o had an initial hp of `^".$badguy['playerstarthp']."`2 and just before you died %o had `^".$session['user']['hitpoints']."`2 remaining."
            ." `n`nAs a result, you lost `\$".getsetting("pvpdeflose",5)."%`2 of your experience (approximately $lostexp points), and `^".$badguy[creaturegold]."`2 gold. They also received `^".$badguy[creaturebounty]." `2in bounty gold."
            ." `n`nDon't you think it's time for some revenge?";
       $mailmessage = str_replace("%p",($session['user']['sex']?"her":"his"),$mailmessage);
       $mailmessage = str_replace("%o",($session['user']['sex']?"she":"he"),$mailmessage);
       systemmail($badguy['acctid'],"`2You were killed in $killedin`2",$mailmessage);
// /\- Gunnar Kreitz

      $sql = "UPDATE accounts SET alive=0, bounty=0, goldinbank=goldinbank-IF(gold<$badguy[creaturegold],gold-$badguy[creaturegold],0),gold=gold-$badguy[creaturegold], experience=experience-$lostexp WHERE acctid=".(int)$badguy[acctid]."";
 $sql = "SELECT evil FROM accounts WHERE acctid='".(int)$badguy['acctid']."'";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
        if ($result > 99){
            $sql = "UPDATE accounts SET jail=1 WHERE acctid=".(int)$badguy[acctid]."";
            addnews("`4".$session['user']['name']."`3 turned `4{$badguy['creaturename']} over to the constable!");
        }
 $sql = "SELECT jail FROM accounts WHERE acctid='".(int)$badguy['acctid']."'";
        $result = db_query($sql);
        $row = db_fetch_assoc($result);
        if ($result==1) addnews("`4{$badguy['creaturename']} must have slipped out of jail.");       
db_query($sql);

obviously this isnt the whole file, just the part about alive=0.  that first commented $sql statement dosent do anything different commented or uncommented.
Logged

Kendaer
Guest
« Reply #6 on: March 17, 2004, 12:28:13 PM »

Right.. that first commented sql statement is an artifact.. it's no longer used.

However the second one also correctly sets the 'alive' flag.

I don't know what's going on in your code, but you've also modified other parts of your code.
I can tell you that the pvp aliveness works correctly on a stock server, so you need to look elsewhere for what is breaking your code.

And I see it.

Look here

Code:
$sql = "UPDATE accounts SET alive=0, bounty=0, goldinbank=goldinbank-IF(gold<$badguy[creaturegold],gold-$badguy[creaturegold],0),gold=gold-$badguy[creaturegold], experience=experience-$lostexp WHERE acctid=".(int)$badguy[acctid]."";
$sql = "SELECT evil FROM accounts WHERE acctid='".(int)$badguy['acctid']."'";
        $result = db_query($sql);

There are *two* sql statements there.
The first 'UPDATE accounts' and the second 'SELECT evil'.
However, you are only running db_query() after the SECOND one (which since you are using the same $sql variable overwrites the first).  Therefore you are NEVER executing the first query which actually sets the player to dead, clears their bounty, docks their experience, etc.

Insert a $result=db_query($sql) between
Code:
$sql = "UPDATE accounts SET alive=0, bounty=0, goldinbank=goldinbank-IF(gold<$badguy[creaturegold],gold-$badguy[creaturegold],0),gold=gold-$badguy[creaturegold], experience=experience-$lostexp WHERE acctid=".(int)$badguy[acctid]."";

and
Code:
$sql = "SELECT evil FROM accounts WHERE acctid='".(int)$badguy['acctid']."'";

And always assume it's your own modifications which are breaking things first Smiley Smiley Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
73 Guests, 1 User
pistasheo
Home Forums News Downloads Login Register Advanced Search