Jump to content
MakeWebGames

Recommended Posts

Posted

For the top gangs: $gang = mysql_fetch_object(mysql_query("SELECT * FROM `gangs` ORDER BY `gang_rep` ASC LIMIT 5")); - you will need to change the db columns to w/e yours are..

For the top gangs in the city: I don't know.

Posted

Yes you are correct Crimgame, otherwise it would simply show the overall top gangs...

I like this idea so i may create this for my game...I have a custom gang system so my version would not help you guys but ill see about posting some code for the default system as well...this should be a simple task..:P

Cheers

Posted

Correct me if I am wrong, but wouldn't it be impossible to order gangs via the city they are in without adding/modifying the gangs? For example, President could be in Location1, Vice in Location 2, and various other members spread out across different cities?

Posted

Faz you do have a valid point i think a good solution would be when they setup a gang (if you have a existing game make the gang base in default location) it allows the president(founder) to set a location of the base. Allow them to change location via gang staff panel (only allow president to) and charge them like 10k or something (count the times they change and then do #times changes * 10k).

Posted

so we need to count the number of gangs in the city first right.... then count the players in those gangs..... ?(

maybe i will just do top gangs by respect lol even them im confused on the how it will work per city... i only get errors so my code wont even help lol il work on it

Posted

<?php

$query = mysql_query("SELECT `id`,`president` FROM `gangs` ORDER BY `respect` DESC LIMIT 5");

$rank = 0;

while($r = mysql_fetch_array($query))

:

$rank++;

$mems = mysql_fetch_array(mysql_query("SELECT COUNT(`userid`) AS `u` FROM `users` WHERE `gang`={$r['id']}"));

$loc = mysql_fetch_array(mysql_query("SELECT `location` FROM `users` WHERE `userid`={$r['president']}"));

$loca = mysql_fetch_array(mysql_query("SELECT `cityname` FROM `cities` WHERE `cityid`={$loc['location']}"));

//start Grammar

if($rank == 1)

{

$g = "st";

}

if($rank == 2)

{

$g = "nd";

}

if($rank == 3)

{

$g = "rd";

}

if($rank == 4 || $rank == 5)

{

$g = "th";

}

echo "The {$rank}<sup>$g</sup> is in {$loca['cityname']} with ".number_format($mems['u'])." members";

endwhile;

?>

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...