TFS 1.X Bounty Hunter System

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by imkingran, Apr 14, 2014.

  1. Cotizado

    Cotizado Member

    Joined:
    May 12, 2008
    Messages:
    321
    Likes Received:
    5
    Best Answers:
    0
    imkingran likes this.
  2. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,175
    Likes Received:
    353
    Best Answers:
    4
    You can add it if you want, it looks a little ugly in my opinion haha :D

    I'lll leave it up on the same page for tonight so you can see how it looks.

    PHP:
    1. <?php
    2. $main_content .= '
    3.    <TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
    4.        <TR>
    5.            <TD style="text-align:center;"><H2>Bounty Hunters</H2></TD>
    6.        </TR>
    7.        <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
    8.            <TD><CENTER><FONT COLOR=WHITE SIZE=2><b>How to use...</b></FONT></CENTER></TD>
    9.        </TR>        
    10.        <TR BGCOLOR="'.$config['site']['darkborder'].'">
    11.            <TD style="text-align:center;"><b>!hunt prize,nick</b>
    12.        <br><font color="red">It is important to right exactly like this <b>prize,nick</b> with no spaces after the comma.</font>
    13.            <br><i>Example: !hunt 1000000,Player_name
    14.            <br> Will Pay 1KK(1,000,000 gold Pieces) for the Player who Kills Player_name.</i>
    15. <br><b>1kk = 1,000,000 gold</b>
    16. <br><b><font color="green">Money is added to your bank account automatically if you get a Bounty Kill.</font></b></TD>
    17.        </TR>        
    18. </TABLE><br><br><table>        
    19. ';
    20. $main_content .= '
    21.        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
    22.            <TR BGCOLOR="#505050">
    23.                <TD CLASS=white width=28%>
    24.                    <center><B>Hunted by</B></center>
    25.                </TD>
    26.                <TD CLASS=white width=14%>
    27.                    <center><B>Reward</B></center>
    28.                </TD>
    29.                <TD CLASS=white width=28%>
    30.                    <center><B>Player hunted</B></center>
    31.                </TD>
    32.        <TD CLASS=white><b>Outfit</b></TD>
    33.                <TD CLASS=white width=28%>
    34.                    <center><B>Killed by</B></center>
    35.                </TD>
    36.            </TR>';
    37. foreach($SQL->query('SELECT A.* , B.name AS hunted_by, C.name AS player_hunted, D.name AS killed_by
    38.                        FROM bounty_hunters AS A
    39.                        LEFT JOIN players AS B ON A.fp_id = B.id
    40.                        LEFT JOIN players AS C ON A.sp_id = C.id
    41.                        LEFT JOIN players AS D ON A.k_id = D.id
    42.                        ORDER BY A.killed,A.prize DESC') as $bounty) {
    43.         if($num%2 == 0){$color=$config['site']['darkborder'];}else{$color=$config['site']['lightborder'];}
    44.         if ($bounty['killed_by']){
    45.                 $killed_by = '<a href="?subtopic=characters&name='.$bounty['killed_by'].'">'.$bounty['killed_by'].'</a>';
    46.         } else {
    47.                 $killed_by = 'still alive';
    48.         }
    49.     $b = round($bounty[prize] / 1000000,2);
    50.     $skill = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$bounty['sp_id'].'')->fetch();
    51. if($skill['online'] == 1)
    52.                 $main_content .= '
    53.                <TR BGCOLOR="'.$color.'">
    54.                    <TD><center><b><a href="?subtopic=characters&name='.$bounty['hunted_by'].'">'.$bounty['hunted_by'].'</a></b></center></TD>
    55.                    <TD><center><b>'.$b.'  kk</b></center></TD>
    56.                    <TD><center><b><a href="?subtopic=characters&name='.urlencode($bounty['player_hunted']).'"><b><font color="green">'.htmlspecialchars($bounty['player_hunted']).'</font></b></a></b></center></TD>
    57.            <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'http://outfit-images.ots.me/outfit.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
    58.                    <TD><center><b>'.$killed_by.'</b></center></TD>
    59.                </TR>';
    60.     else
    61.                         $main_content .= '
    62.                <TR BGCOLOR="'.$color.'">
    63.                    <TD><center><b><a href="?subtopic=characters&name='.$bounty['hunted_by'].'">'.$bounty['hunted_by'].'</a></b></center></TD>
    64.                    <TD><center><b>'.$b.'  kk</b></center></TD>
    65.                    <TD><center><b><a href="?subtopic=characters&name='.urlencode($bounty['player_hunted']).'"><b><font color="red">'.htmlspecialchars($bounty['player_hunted']).'</font></b></a></b></center></TD>
    66.            <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'http://outfit-images.ots.me/outfit.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
    67.                    <TD><center><b>'.$killed_by.'</b></center></TD>
    68.                </TR>';
    69.         $num++;
    70. }
    71. if($num == 0){
    72.         $main_content.='<TR BGCOLOR="'.$color.'"><TD colspan=4><center>Currently there are not any bounty hunter offer.</center></TD></TR>';
    73. }
    74.     $main_content .='</TABLE></table>';
    75. ?>
     
    Cotizado likes this.
  3. Cotizado

    Cotizado Member

    Joined:
    May 12, 2008
    Messages:
    321
    Likes Received:
    5
    Best Answers:
    0
    yea i will leave it like before
     
  4. Cotizado

    Cotizado Member

    Joined:
    May 12, 2008
    Messages:
    321
    Likes Received:
    5
    Best Answers:
    0
    this is what i mean
    http://acaxia.net/index.php?subtopic=bountyhunters
     
    imkingran likes this.
  5. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,175
    Likes Received:
    353
    Best Answers:
    4
    Cotizado likes this.
  6. Cotizado

    Cotizado Member

    Joined:
    May 12, 2008
    Messages:
    321
    Likes Received:
    5
    Best Answers:
    0
    well i prefere the way my look but it didnt work since there isnt an online column on my players in databace
     
  7. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,175
    Likes Received:
    353
    Best Answers:
    4
    Here this one will work without Online column (you can re-add your edits):
    PHP:
    1. <?php
    2. $main_content .= '
    3.    <TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
    4.        <TR>
    5.            <TD style="text-align:center;"><H2>Bounty Hunters</H2></TD>
    6.        </TR>
    7.        <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
    8.            <TD><CENTER><FONT COLOR=WHITE SIZE=2><b>How to use...</b></FONT></CENTER></TD>
    9.        </TR>        
    10.        <TR BGCOLOR="'.$config['site']['darkborder'].'">
    11.            <TD style="text-align:center;"><b>!hunt prize,nick</b>
    12.        <br><font color="red">It is important to right exactly like this <b>prize,nick</b> with no spaces after the comma.</font>
    13.            <br><i>Example: !hunt 1000000,Player_name
    14.            <br> Will Pay 1KK(1,000,000 gold Pieces) for the Player who Kills Player_name.</i>
    15. <br><b>1kk = 1,000,000 gold</b>
    16. <br><b><font color="green">Money is added to your bank account automatically if you get a Bounty Kill.</font></b></TD>
    17.        </TR>        
    18. </TABLE><br><br><table>        
    19. ';
    20. $main_content .= '
    21.        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
    22.            <TR BGCOLOR="#505050">
    23.                <TD CLASS=white width=28%>
    24.                    <center><B>Hunted by</B></center>
    25.                </TD>
    26.                <TD CLASS=white width=14%>
    27.                    <center><B>Reward</B></center>
    28.                </TD>
    29.                <TD CLASS=white width=28%>
    30.                    <center><B>Player hunted</B></center>
    31.                </TD>
    32.        <TD CLASS=white><b>Outfit</b></TD>
    33.                <TD CLASS=white width=28%>
    34.                    <center><B>Killed by</B></center>
    35.                </TD>
    36.            </TR>';
    37. foreach($SQL->query('SELECT A.* , B.name AS hunted_by, C.name AS player_hunted, D.name AS killed_by
    38.                        FROM bounty_hunters AS A
    39.                        LEFT JOIN players AS B ON A.fp_id = B.id
    40.                        LEFT JOIN players AS C ON A.sp_id = C.id
    41.                        LEFT JOIN players AS D ON A.k_id = D.id
    42.                        ORDER BY A.killed,A.prize DESC') as $bounty) {
    43.         if($num%2 == 0){$color=$config['site']['darkborder'];}else{$color=$config['site']['lightborder'];}
    44.         if ($bounty['killed_by']){
    45.                 $killed_by = '<a href="?subtopic=characters&name='.$bounty['killed_by'].'">'.$bounty['killed_by'].'</a>';
    46.         } else {
    47.                 $killed_by = 'still alive';
    48.         }
    49.     $b = round($bounty[prize] / 1000000,2);
    50.     $skill = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$bounty['sp_id'].'')->fetch();
    51. if(Player::isPlayerOnline($skill['id']))
    52.                 $main_content .= '
    53.                <TR BGCOLOR="'.$color.'">
    54.                    <TD><center><b><a href="?subtopic=characters&name='.$bounty['hunted_by'].'">'.$bounty['hunted_by'].'</a></b></center></TD>
    55.                    <TD><center><b>'.$b.'  kk</b></center></TD>
    56.                    <TD><center><b><a href="?subtopic=characters&name='.urlencode($bounty['player_hunted']).'"><b><font color="green">'.htmlspecialchars($bounty['player_hunted']).'</font></b></a></b></center></TD>
    57.            <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'http://outfit-images.ots.me/outfit.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
    58.                    <TD><center><b>'.$killed_by.'</b></center></TD>
    59.                </TR>';
    60.     else
    61.                         $main_content .= '
    62.                <TR BGCOLOR="'.$color.'">
    63.                    <TD><center><b><a href="?subtopic=characters&name='.$bounty['hunted_by'].'">'.$bounty['hunted_by'].'</a></b></center></TD>
    64.                    <TD><center><b>'.$b.'  kk</b></center></TD>
    65.                    <TD><center><b><a href="?subtopic=characters&name='.urlencode($bounty['player_hunted']).'"><b><font color="red">'.htmlspecialchars($bounty['player_hunted']).'</font></b></a></b></center></TD>
    66.            <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'http://outfit-images.ots.me/outfit.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
    67.                    <TD><center><b>'.$killed_by.'</b></center></TD>
    68.                </TR>';
    69.         $num++;
    70. }
    71. if($num == 0){
    72.         $main_content.='<TR BGCOLOR="'.$color.'"><TD colspan=4><center>Currently there are not any bounty hunter offer.</center></TD></TR>';
    73. }
    74.     $main_content .='</TABLE></table>';
    75. ?>
     
    Cotizado likes this.
  8. Cotizado

    Cotizado Member

    Joined:
    May 12, 2008
    Messages:
    321
    Likes Received:
    5
    Best Answers:
    0
    PHP:
    1.  
    2. <?php
    3. $main_content .= '
    4.    <TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%>
    5.        <TR>
    6.            <TD style="text-align:center;"><H2>Bounty Hunters</H2></TD>
    7.        </TR>
    8.        <TR BGCOLOR="'.$config['site']['vdarkborder'].'">
    9.            <TD><CENTER><FONT COLOR=WHITE SIZE=2><b>How to use...</b></FONT></CENTER></TD>
    10.        </TR>        
    11.        <TR BGCOLOR="'.$config['site']['darkborder'].'">
    12.            <TD style="text-align:center;"><b>!hunt prize,nick</b>
    13.        <br><font color="red">It is important to right exactly like this <b>prize,nick</b> with no spaces after the comma.</font>
    14.            <br><i>Example: !hunt 1000000,Player_name
    15.            <br> Will Pay 1KK(1,000,000 gold Pieces) for the Player who Kills Player_name.</i>
    16. <br><b>1kk = 1,000,000 gold</b>
    17. <br><b><font color="green">Money is added to your bank account automatically if you get a Bounty Kill.</font></b></TD>
    18.        </TR>        
    19. </TABLE><br><br><table>        
    20. ';
    21. $main_content .= '
    22.        <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
    23.            <TR BGCOLOR="#505050">
    24.                <TD CLASS=white width=28%>
    25.                    <center><B>Hunted by</B></center>
    26.                </TD>
    27.                <TD CLASS=white width=14%>
    28.                    <center><B>Reward</B></center>
    29.                </TD>
    30.                <TD CLASS=white width=28%>
    31.                    <center><B>Player hunted</B></center>
    32.                </TD>
    33.        <TD CLASS=white><b>Outfit</b></TD>
    34.                <TD CLASS=white width=28%>
    35.                    <center><B>Killed by</B></center>
    36.                </TD>
    37.            </TR>';
    38. foreach($SQL->query('SELECT A.* , B.name AS hunted_by, C.name AS player_hunted, D.name AS killed_by
    39.                        FROM bounty_hunters AS A
    40.                        LEFT JOIN players AS B ON A.fp_id = B.id
    41.                        LEFT JOIN players AS C ON A.sp_id = C.id
    42.                        LEFT JOIN players AS D ON A.k_id = D.id
    43.                        ORDER BY A.killed,A.prize DESC') as $bounty) {
    44.         if($num%2 == 0){$color=$config['site']['darkborder'];}else{$color=$config['site']['lightborder'];}
    45.         if ($bounty['killed_by']){
    46.                 $killed_by = '<a href="?subtopic=characters&name='.$bounty['killed_by'].'">'.$bounty['killed_by'].'</a>';
    47.         } else {
    48.                 $killed_by = 'still alive';
    49.         }
    50.     $b = round($bounty[prize] / 1000000,2);
    51.     $skill = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$bounty['sp_id'].'')->fetch();
    52. if(Player::isPlayerOnline($skill['id']))
    53.                 $main_content .= '
    54.                <TR BGCOLOR="'.$color.'">
    55.                    <TD><center><b><a href="?subtopic=characters&name='.$bounty['hunted_by'].'">'.$bounty['hunted_by'].'</a></b></center></TD>
    56.                    <TD><center><b>'.$b.'  kk</b></center></TD>
    57.                    <TD><center><b><a href="?subtopic=characters&name='.urlencode($bounty['player_hunted']).'"><b><font>'.htmlspecialchars($bounty['player_hunted']).'</font></b></a></b><span style="color:green">[On]</span></center></TD>
    58.            <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'http://outfit-images.ots.me/outfit.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
    59.                    <TD><center><b>'.$killed_by.'</b></center></TD>
    60.                </TR>';
    61.     else
    62.                         $main_content .= '
    63.                <TR BGCOLOR="'.$color.'">
    64.                    <TD><center><b><a href="?subtopic=characters&name='.$bounty['hunted_by'].'">'.$bounty['hunted_by'].'</a></b></center></TD>
    65.                    <TD><center><b>'.$b.'  kk</b></center></TD>
    66.                    <TD><center><b><a href="?subtopic=characters&name='.urlencode($bounty['player_hunted']).'"><b><font>'.htmlspecialchars($bounty['player_hunted']).'</font></b></a></b><span style="color:red">[Off]</span></center></TD>
    67.            <TD><div style="position: relative; width: 32px; height: 32px;"><div style="background-image: url(\'http://outfit-images.ots.me/outfit.php?id='.$skill['looktype'].'&addons='.$skill['lookaddons'].'&head='.$skill['lookhead'].'&body='.$skill['lookbody'].'&legs='.$skill['looklegs'].'&feet='.$skill['lookfeet'].'\'); position: absolute; width: 64px; height: 80px; background-position: bottom right; background-repeat: no-repeat; right: 0px; bottom: 0px;"></div></div></TD>
    68.                    <TD><center><b>'.$killed_by.'</b></center></TD>
    69.                </TR>';
    70.         $num++;
    71. }
    72. if($num == 0){
    73.         $main_content.='<TR BGCOLOR="'.$color.'"><TD colspan=4><center>Currently there are not any bounty hunter offer.</center></TD></TR>';
    74. }
    75.     $main_content .='</TABLE></table>';
    76. ?>
    77.  
     
    imkingran likes this.
  9. EwR

    EwR Member

    Joined:
    Aug 28, 2013
    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    Console error!
    data/talkactions/scripts/bh-add.lua:eek:nsay
    data/talkactions/scripts/bh-add.lua:12: attempt to call global 'getPlayerGUIDByName' <a nil value>
    stack traceback:
    [C]: in function 'getPlayerGUIDByName'
    data/talkactions/scripts/bh-add.lua:12: in function <data/talkactions/scripts/bh-add.lua:1

    Im usinf TFS 1,0 any help please?
     
  10. EwR

    EwR Member

    Joined:
    Aug 28, 2013
    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    HALP XD
     
  11. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,907
    Best Answers:
    4
    Code (Text):
    1.  
    2. function getPlayerGUIDByName(name)
    3.      local player = Player(name)
    4.      if player ~= nil then
    5.          return player:getGuid()
    6.      end
    7.      local resultId = db.storeQuery("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(name))
    8.      if resultId ~= false then
    9.          local guid = result.getDataInt(resultId, "id")
    10.          result.free(resultId)
    11.          return guid
    12.      end
    13.      return 0
    14. end
    15.  
    https://github.com/otland/forgottenserver/blob/master/data/compat.lua
     
  12. EwR

    EwR Member

    Joined:
    Aug 28, 2013
    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    i replace all bh-add for this?
     
    Last edited: Sep 26, 2014
  13. EwR

    EwR Member

    Joined:
    Aug 28, 2013
    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    BUMP
    ok i put that on globla.lua and now say this:

    attempt to call global doPlayerSendTextMessage
     
    Last edited: Sep 26, 2014
  14. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,907
    Best Answers:
    4
    You can choose to add compat.lua to your datapack, then also add this at the top of global.lua.
    Code (Text):
    1. dofile('data/compat.lua')
    Or you can also change the TFS 0.2 functions to TFS 1.0 metatable functions by using the compat.lua as example to see how to do that.
     
  15. EwR

    EwR Member

    Joined:
    Aug 28, 2013
    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    I have on top of my global.lua this

    Code (Text):
    1. dofile('data/libs.lua')
    and this on libs.lua
    Code (Text):
    1. -- load storages first
    2. dofile('data/lib/051-storages.lua')
    3.  
    4. dofile('data/lib/001-string.lua')
    5. dofile('data/lib/002-tables.lua')
    6.  
    7. dofile('data/lib/050-functions.lua')
    8.  
    9. dofile('data/lib/demonOakQuest.lua')
    10. dofile('data/lib/killingInTheNameOfQuest.lua')
    11. dofile('data/lib/missionSelect.lua')
    12. dofile('data/lib/svargrondArenaQuest.lua')
    13. dofile('data/lib/achievements_lib.lua')
    14.  
    So i change that to have the "normal" functions to bounty hunter system and others can work?

    Edit: ok i make it and alot of errors in distro :( i put back libs.lua on global
     
    Last edited: Sep 26, 2014
  16. EwR

    EwR Member

    Joined:
    Aug 28, 2013
    Messages:
    95
    Likes Received:
    3
    Best Answers:
    0
    OK i solve it, all work, but now in web BountyHunter doesnt disappear, and the player is killed already
     
  17. fagotti

    fagotti New Member

    Joined:
    Nov 6, 2014
    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    You can edit to work on ZNOTE website ??
     
  18. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,175
    Likes Received:
    353
    Best Answers:
    4
    Sorry I'm not familiar with Znote. If someone can make it then I can add it to the main post.


    p.s.
    I updated the scripts to meta-tables but I haven't tested them.
    If you get any errors just post here.
     
  19. Cotizado

    Cotizado Member

    Joined:
    May 12, 2008
    Messages:
    321
    Likes Received:
    5
    Best Answers:
    0
    Can You make an event that broadcast the hunted players?
     
  20. imkingran

    imkingran Learning everyday. Premium User

    Joined:
    Jan 15, 2014
    Messages:
    1,175
    Likes Received:
    353
    Best Answers:
    4
    Explain a little more what you mean exactly.

    It already broadcast when you place the bounty and when you kill the player. Do you want it to broadcast on a time interval throughout the day as well?
     
    Cotizado likes this.

Share This Page

Loading...