Jump to content
MakeWebGames

Looking for a coder!


stevenrfc

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by stevenrfc
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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']

Link to comment
Share on other sites

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 by stevenrfc
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

:)

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

Link to comment
Share on other sites

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

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