1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

[Release] Web MPF Rosters

Discussion in 'Programming' started by trurascalz, Dec 29, 2012.

  1. trurascalz

    trurascalz C16 Developer Legend

    This is a simple PHP script that loads a 'roster' for the Metropolice Force for halflife 2 roleplay.

    Features:
    Custom Division Configuration
    One page script
    Ordering by rank ( Thanks to RJ for cleaning that bit up!)

    Upcoming:
    *see github commits

    Download Here
    Demo Available on the URL above

    Please Star my repository if you like this!
    You can of course contact me about any issues including installation
     
  2. jamiecross

    jamiecross HTML and VB coder

    Re: [Release] PHP MYSQL Queries

    Thanks for this, I know its your server but just pointing out that Helix is an OTA division not a MPF.

    Edit: Just to point out rename it to "index.php"
     
  3. henoik

    henoik Cloud16 Official Support Staff

    Re: [Release] PHP MYSQL Queries

    I'm pretty sure that Helix is an MPF division dealing with medical stuff.
     
  4. Re: [Release] PHP MYSQL Queries

    Helix is usually an MPF division but really it's 100% based on the server. There is no right or wrong way.
     
  5. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    Is there any way to have the table be ordered by rank? I'm not too good at PHP so I don't know of a way to do this.
     
  6. trurascalz

    trurascalz C16 Developer Legend

    Re: [Release] PHP MYSQL Queries

    Add
    Code:
    ORDER BY `_Name` ASC
    to the end of the queries

    eg

    Code:
    "SELECT * FROM  `characters` WHERE `_Name` LIKE '%SWORD%' AND `_Faction` LIKE  'Metropolice Force' ORDER BY `_Name` ASC"
    Thats the closest you can get i think or create a individual query for each rank
     
  7. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    The only problem is that the ordering is a bit weird. It'll either have letter ranks on top (eg DvL, OfC...) and number ranks on bottom but with low ranks (eg 05,04...) on top and then higher ranks on bottom (eg 01, 02) or vice versa.

    [​IMG] [​IMG]

    If possible, it would be nice to sort it from highest rank on top and lowest on bottom.
     
  8. trurascalz

    trurascalz C16 Developer Legend

    Re: [Release] PHP MYSQL Queries

    then change ASC to DESC

    That is the problem with the query, to my knowledge it has trouble ordering text+numbers without a deal of help - which stumbles me
     
  9. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    This is what I already did. First pic is ASC, second is DESC.
     
  10. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    I did a work around instead. I just kept the DvLs in a seperate table and then had them removed from the division tables.

    Eg
    Code:
    $generalunit = mysql_query("SELECT * FROM  ".$characters." WHERE `_Name` LIKE '%".$general."%' AND `_Name` NOT LIKE '%DvL%' AND `_Faction` LIKE  'Metropolice Force' ORDER BY `_Name` ASC");
     
  11. trurascalz

    trurascalz C16 Developer Legend

    Re: [Release] PHP MYSQL Queries

    I have a method which i will pursue tomorrow
     
  12. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    Please keep me informed, if you can accomplish this and share your method I'd be very grateful.
     
  13. trurascalz

    trurascalz C16 Developer Legend

    Re: [Release] PHP MYSQL Queries

    Ok I have done it, Its a long query but it works and is a bit complicated,

    Here is what you need to add:

    Code:
    order by case when `_Name` LIKE '%DvL%' then 1 when _Name LIKE '%EpU%'  then 2 when _Name LIKE '%OfC%'  then 3 when _Name LIKE '%.01.%'  then 4 when _Name LIKE '%.02.%'  then 5 when _Name LIKE '%.03.%'  then 6 when _Name LIKE '%.04.%'  then 7 when _Name LIKE '%.05.%' then 8 when _Name LIKE '%.RCT.%'  then 9 end");
    So, it go through the Names and when it finds a name with DvL in it will return 1, then it will return 2 when it finds a EpU then 3 for OfC etc, which lets the query know what order to place things into

    I am to lazy to create configurable variables but i will add it to the update list when i get round to it.

    Add that to the end of:

    Code:
    $shield = mysql_query("SELECT * FROM  `characters` WHERE `_Name` LIKE '%SHIELD%' AND `_Faction` LIKE  'Metropolice Force' *HERE* ");
    
    for what ever division you want
     
  14. Soret

    Soret derp

    Re: [Release] PHP MYSQL Queries

    I better like hand crafted rosters, it is easier to make notes and edits on a forum roster then on a php created roster where everyone is displayed.

    Take a look your self, it looks 100% better then what is made in php.

    http://projektkaskade.com/showthread.php/451-Operation-Venetian-Die-Schutzstaffel
    http://projektkaskade.com/showthread.php/7-lt-Union-Metroplex-Authority-ROSTER-gt
    http://projektkaskade.com/showthread.php/8-lt-Combine-Overwatch-Transhuman-Arm-ROSTER-gt

    I think if you just let communities use these php scripts to display off their rosters is just simple laziness and contributes no creativity to the biodiversity of roleplay servers.
     
  15. trurascalz

    trurascalz C16 Developer Legend

    Re: [Release] PHP MYSQL Queries

    I only made this since some factions like the MPF can get really big and sometimes people cannot keep on top of it especially with minor players who don't play as often on a Character. But im not forcing anyone to use this, just there to help people. But let's not argue.
     
  16. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    @trurascalz
    I knew there was a way of doing it, I just wasn't sure how to do it. Thank you trurascalz, this is going to be quite useful!

    @Soret
    That is correct but it is also up to the developer's ability in making the menu appealing. To make something seem natural like a handmade roster would take quite some time in making a proper style, but not impossible. But I also agree with trurascalz, it'll be more useful to the larger communities and it's probably better to just stick with handmade ones until otherwise needed.
     
  17. alexanderk

    alexanderk a Legend

    Re: [Release] PHP MYSQL Queries

    You don't really need to make a roster look appealing as long as it is easy to use and read. That should always be prioritised, and every time I see a roster without any defining rows (i.e. alternating rows or rows with hover-over background), I cringe a little. They're hard to read when you have big amounts of information or a ridiculously large faction.
     
  18. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    Just to let you know, the code had a few errors in them but I fixed them now and made it a little more readable, only this has to be added to the end:

    Code:
    ORDER BY CASE
    	WHEN `_Name` LIKE '%DvL%' THEN 1
    	WHEN `_Name` LIKE '%EpU%' THEN 2
    	WHEN `_Name` LIKE '%OfC%' THEN 3
    	WHEN `_Name` LIKE '%-01.%' THEN 4
    	WHEN `_Name` LIKE '%-02.%' THEN 5
    	WHEN `_Name` LIKE '%-03.%' THEN 6
    	WHEN `_Name` LIKE '%-04.%' THEN 7
    	WHEN `_Name` LIKE '%-05.%' THEN 8
    	WHEN `_Name` LIKE '%-RCT.%' THEN 9
    END ASC
     
  19. Re: [Release] PHP MYSQL Queries

    Getting this error at the bottom of the mpf.php (index.php).

    Warning: mysql_close(): 5 is not a valid MySQL-Link resource in LINKCENSORED on line 240
     
  20. RJ

    RJ no pay Legend Clockwork Customer

    Re: [Release] PHP MYSQL Queries

    I just removed it, still worked fine :V
     

Previous Readers (Total: 0)