Jump to content
MakeWebGames

attacklist adjustment?


ddgamedesign

Recommended Posts

Hey all,

This is the MySQL query to load users eligible for attack on my 'attacklist' screen:

$users = $db->query (

"SELECT u.`userid`, u.`username`, u.`level`, u.`hp`, u.`gang`, u.`location`, g.`gangname`, g.`gangPREF`, c.`cityname` FROM

`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` LEFT JOIN `cities` c ON c.`cityID` = u.`location` WHERE ( c.`cityID` = ".$ir['location']." ) ");

How do I adjust it to NOT show NPC's on this screen? I only want them to show up on my Battle Tent area.

Link to comment
Share on other sites

$users = $db->query (
"SELECT u.`userid`, u.`username`, u.`level`, u.`hp`, u.`gang`, u.`location`, g.`gangname`, g.`gangPREF`, c.`cityname` FROM 
`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` LEFT JOIN `cities` c ON c.`cityID` = u.`location` WHERE c.`cityID` = ".$ir['location']." AND `u.user_level` != 0 ");
Link to comment
Share on other sites

AlabamaHit: Thanks, but replacing my line with yours gives MySQL Query errors.

Here's the whole file, for info purposes (it was a free mod, so no sweat there):

<?php

/*

* Made By: Djkanna.

*/

require_once (dirname (__file__) .'/globals.php');

$users = $db->query (

"SELECT u.`userid`, u.`username`, u.`level`, u.`hp`, u.`gang`, u.`location`, g.`gangname`, g.`gangPREF`, c.`cityname` FROM

`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` LEFT JOIN `cities` c ON c.`cityID` = u.`location` WHERE ( c.`cityID` = ".$ir['location']." ) ");

echo'pickafight.jpg

';

?>

<table width="100%" class="table">

<tr>

<th>Player</th><th>Status</th><th>Level</th><th>Posse</th><th>Options</th>

</tr>

<?php while ($u = $db->fetch_row ($users) ) : ?>

<tr>

<td><?php echo $u['gang'] != 0 ? "[".$u['gangPREF']."]".stripslashes(htmlentities($u['username'], ENT_QUOTES)) :

"".stripslashes(htmlentities($u['username'], ENT_QUOTES)); ?></td>

<td><?php echo $u['hp'] <= 1 ? "<span style='font-color: red;'>Unconscious</span>" : "<span style='font-color: green;'>Alive</span>"; ?></td>

<td><?php echo number_format($u['level']); ?></td>

<td><?php echo $u['gang'] != 0 ? "".stripslashes(htmlentities($u['gangname'], ENT_QUOTES))."" :

"<span>No Posse</span>"; ?></td>

<td><?php echo $u['hp'] <= 1 ? "<span style='font-color: #999; text-decoration: line-through;'>Attack</span>" :

"<span style='font-color: red;'>Attack!</span>"; ?></td>

</tr>

<?php endwhile; ?>

</table>

<?php $h->endpage (); ?>

Link to comment
Share on other sites

Probary a typo, i do that all the time. Try this

 

$users = $db->query (
"SELECT u.`userid`, u.`username`, u.`level`, u.`hp`, u.`gang`, u.`location`, g.`gangname`, g.`gangPREF`, c.`cityname` FROM 
`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` LEFT JOIN `cities` c ON c.`cityID` = u.`location` WHERE c.`cityID` = ".$ir['location']." AND u.`user_level` != 0 ");

Link to comment
Share on other sites

Edit: Sorry didn't see AlabamaHits post ^^

<?php
/*
* Made By: Djkanna.
*/
require_once (dirname (__file__) .'/globals.php');

$users = $db->query (
"SELECT u.`userid`, u.`username`, u.`level`, u.`hp`, u.`gang`, u.`location`, g.`gangname`, g.`gangPREF`, c.`cityname` FROM
`users` u LEFT JOIN `gangs` g ON `gangID` = u.`gang` LEFT JOIN `cities` c ON c.`cityID` = u.`location` WHERE ( c.`cityID` = ".$ir['location']." && u.`user_level` != 0 ) ");

echo'[img=/pickafight.jpg]

';
?>
<table width="100%" class="table">
<tr>
<th>Player</th><th>Status</th><th>Level</th><th>Posse</th><th>Options</th>
</tr>
<?php while ($u = $db->fetch_row ($users) ) : ?>
<tr>
<td><?php echo $u['gang'] != 0 ? "[".$u['gangPREF']."]".stripslashes(htmlentities($u['username'], ENT_QUOTES)) :
"".stripslashes(htmlentities($u['username'], ENT_QUOTES)); ?></td>

<td><?php echo $u['hp'] <= 1 ? "<span style='font-color: red;'>Unconscious</span>" : "<span style='font-color: green;'>Alive</span>"; ?></td>
<td><?php echo number_format($u['level']); ?></td>
<td><?php echo $u['gang'] != 0 ? "[url='gangs.php?action=view&ID=".$u[']".stripslashes(htmlentities($u['gangname'], ENT_QUOTES))."[/url]" :
"<span>No Posse</span>"; ?></td>

<td><?php echo $u['hp'] <= 1 ? "<span style='font-color: #999; text-decoration: line-through;'>Attack</span>" :
"[url='attack.php?ID=".$u[']<span style='font-color: red;'>Attack!</span>[/url]"; ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php $h->endpage (); ?> 

Try that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...