stevenrfc Posted April 16, 2012 Share Posted April 16, 2012 Hello :) I bought redux last month and i am now looking for someone to help me with a feature that i would like. I do not have the skills yet to add something like this in, but im looking to hire someone who can. At the moment i just want to look at prices and an estimate on how long it would take? What I am looking for A sort of ranking system for players. Every time a player commits a crime then they get some rank exp which gets added to a rank progress bar which will be next to brave, Once they reach 100% then they move onto the next level. I would like 20 levels each with there own rank name, and once each level is complete then the player receives an event along with special items/money, depending on which level they have completed. I would also like images to appear on the players profiles, these images will change depending on what rank they are at (I can create these images). You could call this a crime rank if you like. I can take care of all the images here, i just need someone with the knowledge and skills to code this. Im not sure how much this would cost, if it were to cost alot then i might have to save for a bit because im in full time education up until june lol. Also i would appreciate it if anyone could point me in the right direction of a trusted coder, i dont really know anyone here so i dont know whos trusted and who isnt :) Anyway, i hope i have supplied enough details so someone can get back to me. Thank you for your time :D Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 16, 2012 Author Share Posted April 16, 2012 Wow thank you for this, even though its not finished, i really appreciate this mate! Thanks :D Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted April 17, 2012 Share Posted April 17, 2012 Cant be bothered tbh sorry Good luck with the job interview SRB Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted April 17, 2012 Share Posted April 17, 2012 function check_rank_level() { global $c, $db, $ir; $data_array = array( 2 => array('exp_needed' => 1000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 2 Recieved!'), 3 => array('exp_needed' => 2000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 3 Recieved!'), 4 => array('exp_needed' => 3000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 4 Recieved!') ); $next_level = ($ir['rank_level'] + 1); if(!in_array($next_level, $data_array)) {return false;} if($ir['rank_exp'] >= $data_array[$next_level]['exp_needed']) { mysql_query('UPDATE `users` SET `rank_level` = (`rank_level` + 1), `money` = (`money` + '.$data_array[$next_level]['money_gained'].'), `crystals` = (`money` + '.$data_array[$next_level]['points_gained'].'), `rank_exp` = 0 WHERE `userid` = '.$ir['userid']); foreach($data[$next_level]['items_id'] as $arg) { mysql_query('INSERT INTO `inventory` (`user_id`,`item_id`)VALUES('.$ir['userid'].', '.$arg.')'); } event_add($ir['userid'], $data_array[$next_level]['event']); } } check_rank_level(); function display_rank($user, $request = 'rankName') { global $db, $c; $user = mysql_query('SELECT `rank_level` FROM `users` WHERE `userid` = '.$user); if(!mysql_num_rows($user)) {return false;} $user = mysql_fetch_assoc($user); $rank_array = array( 1 => array('rankName' => 'elite', 'rankImage' => ''), 2 => array('rankName' => 'super elite', 'rankImage' => ''), 3 => array('rankName' => 'super kindle', 'rankImage' => '') ); return ($request == 'rankName') ? $rank_array[$user['rank_level']]['rankName'] : '<img src="'.$rank_array[$user['rank_level']]['rankImage'].'" />'; } Untested. Usage: display_rank($their['userid'], 'rankName'); for the rank name display_rank($their['userid'], 'rankImage'); for the rank image Reason i made it 2 seperate call's is because i do not know where you want your image to your text. This is untested, and please note that this will break your script as i do not know the inventory table, so it will not add item's. mysql_query('INSERT INTO `inventory` (`user_id`,`item_id`)VALUES('.$ir['userid'].', '.$arg.')'); Anyone care to give me the fields to the users inventory? Also, It's very easy to add on to this. at the moment it's got 2,3,4 ranks to check. To add another just copy a line from the $data_array as so: 4 => array('exp_needed' => 3000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 4 Recieved!') Becomes 4 => array('exp_needed' => 3000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 4 Recieved!'), 5 => array('exp_needed' => 4000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 5 Recieved!') NB: If adding more ranks, remember that each line has to have an ended comma (,) EXCEPT for the last, or it will break. EG: $data_array = array( 2 => array('exp_needed' => 1000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 2 Recieved!'), 3 => array('exp_needed' => 2000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 3 Recieved!'), 4 => array('exp_needed' => 3000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 4 Recieved!'), ); Will break $data_array = array( 2 => array('exp_needed' => 1000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 2 Recieved!'), 3 => array('exp_needed' => 2000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 3 Recieved!'), 4 => array('exp_needed' => 3000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20), 'event' => 'Rank 4 Recieved!') ); will not break. You can have more than 1 item and you can customize the event for each rank along with the money and crystals/points gained. If you do not want to give any money, simply make it 0, same for points gained, and if you do not want to give items then make the items_id => array(20) to items_id => array(). This is untested, so any error's post up, either SRB or myself will fix. Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted April 17, 2012 Share Posted April 17, 2012 (edited) double post Edited April 17, 2012 by HauntedDawg double post Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted April 17, 2012 Share Posted April 17, 2012 Thanks @HD The final comma shouldnt break the array. I often leave mine open that way. Sorry for short reply, on the move and on the iPad which sucks for forum typing On a certain PHP version it does break i don't remember which tho. Quote Link to comment Share on other sites More sharing options...
Dominion Posted April 17, 2012 Share Posted April 17, 2012 On a certain PHP version it does break i don't remember which tho. Not that it really matters, but you may be remembering something that is now irrelevant. I believe, for example, Zend's standards recommend a trailing comma in an array. Anyway to the original post, if you're not sure on who to go with there are ways to find out e.g. http://makewebgames.io/showthread.php/39952-My-list-of-trusted-coders , not a full list, and to be honest it's one persons view (some of which people will disagree on), but it's a start. Look through their posts etc to make sure they at least seem to understand what they talk about. As for this mod SRB, and HD seem to have given you a nice starting point. Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 17, 2012 Author Share Posted April 17, 2012 (edited) This is untested, and please note that this will break your script as i do not know the inventory table, so it will not add item's. mysql_query('INSERT INTO `inventory` (`user_id`,`item_id`)VALUES('.$ir['userid'].', '.$arg.')'); Anyone care to give me the fields to the users inventory? Is this what you mean mate? Sorry for my lack of knowledge in this area inv_id inv_itemid inv_userid inv_qty Would just like to say thanks to you guys for helping me, i really appreciate it! :D:D @SomeRandomBastard i think thats all, thank you :D Edited April 17, 2012 by stevenrfc Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted April 18, 2012 Share Posted April 18, 2012 function check_rank_level() { global $c, $db, $ir; $data_array = array( 2 => array('exp_needed' => 1000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20 => 1), 'event' => 'Rank 2 Recieved!'), 3 => array('exp_needed' => 2000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20 => 1), 'event' => 'Rank 3 Recieved!'), 4 => array('exp_needed' => 3000, 'money_gained' => 500, 'points_gained' => 20, 'items_id' => array(20 => 1), 'event' => 'Rank 4 Recieved!') ); $next_level = ($ir['rank_level'] + 1); if(!in_array($next_level, $data_array)) {return false;} if($ir['rank_exp'] >= $data_array[$next_level]['exp_needed']) { mysql_query('UPDATE `users` SET `rank_level` = (`rank_level` + 1), `money` = (`money` + '.$data_array[$next_level]['money_gained'].'), `crystals` = (`money` + '.$data_array[$next_level]['points_gained'].'), `rank_exp` = 0 WHERE `userid` = '.$ir['userid']); foreach($data_array[$next_level]['items_id'] as $arg => $qty) { mysql_query('INSERT INTO `inventory` VALUES(NULL, '.$arg.', '.$ir['userid'].', '.$qty.')'); } event_add($ir['userid'], $data_array[$next_level]['event']); } } check_rank_level(); function display_rank($user, $request = 'rankName') { global $db, $c; $user = mysql_query('SELECT `rank_level` FROM `users` WHERE `userid` = '.$user); if(!mysql_num_rows($user)) {return false;} $user = mysql_fetch_assoc($user); $rank_array = array( 1 => array('rankName' => 'elite', 'rankImage' => ''), 2 => array('rankName' => 'super elite', 'rankImage' => ''), 3 => array('rankName' => 'super kindle', 'rankImage' => '') ); return ($request == 'rankName') ? $rank_array[$user['rank_level']]['rankName'] : '<img src="'.$rank_array[$user['rank_level']]['rankImage'].'" />'; } Updated to work off your inventory table. And added the ability to add the quantity of an item EG: 'items_id' => array(itemid1 => qty1, itemid2 => qty2) Let's say itemid1 is itemID 40 and qty1 is 3, itemid2 is itemID 23 and qty is 50. 'items_id' => array(40 => 3, 23 => 50); If you need anything else then just ask. Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 18, 2012 Author Share Posted April 18, 2012 Thank you so much! :D:D Much appreciated! I will add this in tomorrow :D Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 21, 2012 Author Share Posted April 21, 2012 Hello I have added the sql and php, but I am having trouble displaying the rank and image. I tried to add the image and rank name underneath brave and i also tried to add it to users profile, but they didn't work. I'm pretty sure im not doing it right lol. Could someone please explain how i can display this? Thank you :) Quote Link to comment Share on other sites More sharing options...
Dave Posted April 21, 2012 Share Posted April 21, 2012 From the looks of the code you'd need to do something along the lines of display_rank($userid,'rankName') //for the name display_rank($userid,'rankImage') //for the image Where obviously $userid is which ever user you wanted to grab the image of. So on viewuser I believe you'd need to use $r['userid'] Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 21, 2012 Author Share Posted April 21, 2012 (edited) From the looks of the code you'd need to do something along the lines of display_rank($userid,'rankName') //for the name display_rank($userid,'rankImage') //for the image Where obviously $userid is which ever user you wanted to grab the image of. So on viewuser I believe you'd need to use $r['userid'] Thank you for the reply But that just displays my userid, but its cool i think i might have it edit: nope still cant find out how to do it :( Edited April 21, 2012 by stevenrfc Quote Link to comment Share on other sites More sharing options...
Dave Posted April 21, 2012 Share Posted April 21, 2012 Thank you i added this in {$r['userid']} and it worked, but it only comes up with the number of the level, so it says "1". How would i display the actual name of the rank, eg "noob", "elite" .. etc. Thank you :) He seems to be missing a ] on this line return ($request == 'rankName') ? $rank_array[$user['rank_level']]['rankName'] : '<img src="'.$rank_array[$user['rank_level']]['rankImage'].'" />'; So replace that line with this one return ($request == 'rankName') ? $rank_array[$user['rank_level']]['rankName']] : '<img src="'.$rank_array[$user['rank_level']]['rankImage'].'" />'; Then hopefully it should function correctly... Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 21, 2012 Author Share Posted April 21, 2012 Thanks for the reply :) I added in the extra ] but got this error. "Parse error: syntax error, unexpected ']' in /home/eliteco3/public_html/Global/globals.php on line 206" Quote Link to comment Share on other sites More sharing options...
Lara2850 Posted April 22, 2012 Share Posted April 22, 2012 I've been trying to follow this thread and to do the same thing using the crimexp in place of the rank_exp, but after following everything here, I get this error: Parse error: syntax error, unexpected ']' in /home/root2247/public_html/Global/globals.php on line 188. Any help appreciated. Thanks Lara ;) Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 22, 2012 Author Share Posted April 22, 2012 Thanks for the reply :) When i try to add it to viewuser.php, i get this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/eliteco3/public_html/Mods/viewuser.php on line 97 Also when i tried to add them underneath the stat bars they just show up as "display_rank($ir['rank_level'], 'Image'); display_rank($ir['rank_level']);" Maybe im adding them wrong lol ? Quote Link to comment Share on other sites More sharing options...
Lithium Posted April 22, 2012 Share Posted April 22, 2012 show the entire line... and maybe 2-3 lines after and before the line you added that Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 22, 2012 Author Share Posted April 22, 2012 :) On viewuser.php echo " <h3>Profile for {$r['username']}</h3> <table width=100% cellspacing=1 class='table'><tr style='background:gray'><th>General Info</th><th>Financial Info</th> <th>Display Pic</th></tr> <tr> <td> Name: $user_name<br /> User Level: $userl<br /> $u_duties Gender: {$r['gender']}<br /> Rank: display_rank($ir['rank_level']); <br /> Signed Up: $sup<br /> Last Active: $lon<br /> Last Action: $ula<br /> Last Login: $ull<br /> Online: $on<br /> Days Old: {$r['daysold']}<br /> Location: {$location} </td> On template.php <div class="content"> <span class="menu"> <ul> display_rank($ir['rank_level'], 'Image'); <br /> display_rank($ir['rank_level']); <b><p>progress bar will go here..</p></b> <hr /> [<a href='<?php echo gen_url('logout',true); ?>'>Emergency Logout</a>] <br /><hr class="hr"/> Also i checked phpmyadmin and it seems like im not getting any rank exp from doing crimes lol Quote Link to comment Share on other sites More sharing options...
Lithium Posted April 22, 2012 Share Posted April 22, 2012 On viewuser.php Rank: ".display_rank($ir['rank_level'])." <br /> On template.php <?=display_rank($ir['rank_level'], 'Image');?> <br /> <?=display_rank($ir['rank_level']);?> As for the crimes not getting any exp... unless you added the query to add exp, they only give crimexp or regular xp Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 22, 2012 Author Share Posted April 22, 2012 Thanks for the reply mate :) Its got rid of the error, but nothing shows up on either page. on view user its like this "Rank: " and theres nothing there and on the template its the same lol Thanks :) Quote Link to comment Share on other sites More sharing options...
Lithium Posted April 22, 2012 Share Posted April 22, 2012 by any chance you placed the path/to/image on the function? also, by any chance you made the changes needed to somehow be able to check the rank? Quote Link to comment Share on other sites More sharing options...
stevenrfc Posted April 22, 2012 Author Share Posted April 22, 2012 Yeah i put an image path down like this Is that right? $rank_array = array ( 1 => array('rankName' => 'Noob', 'rankImage' => 'images/none.png'), And i havent made any changes apart from adding more ranks and editing names. :) Thanks Quote Link to comment Share on other sites More sharing options...
Lara2850 Posted April 22, 2012 Share Posted April 22, 2012 I'm getting the same as Stevenrfc and when I put what you suggest on the viewuser.php Lithiam, it doesnt display anything. Also, like Steven, my exp isn't being added either. Feeling very blonde here, but appreciate all of the help guys! Lara ;) Quote Link to comment Share on other sites More sharing options...
Dominion Posted April 22, 2012 Share Posted April 22, 2012 I'm getting the same as Stevenrfc and when I put what you suggest on the viewuser.php Lithiam, it doesnt display anything. Also, like Steven, my exp isn't being added either. Make sure error reporting is turned on... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.