Jump to content
MakeWebGames

Recommended Posts

Posted

My users have asked me if I could do a little more work on the crimes, or, more spesificly, that your bravebar does not upgrade every time you level up, but rather when you get so and so much crime experience. I thought it was a good idea, so I wonder if there is anyone here who has made something similar to it, (for free), so I don't have to make it from scratch? If there is not, I'll post it for you here when I've coded it, :D

Posted

Re: Crime Update

 

i think he means like mines where u have exp then u go to the next mine

so u do crimes and get crime exp to level up your brave rather than it going up when u level up

 

Exactly!

Posted

Re: Crime Update

you need to edit the check_level so it doesnt change the brave when the user levels up then you need to add a new function so when the user gets a certain amount of crime exp there brave goes up ill see what i can do about the seond one but the first youll have to do yourself

Posted

Re: Crime Update

Ok Ive Done Them Both

First Thing to Do It Add These Querys:

ALTER TABLE `users` ADD `braveLVL` INT(3) NOT NULL DEFAULT '1';
ALTER TABLE `users` ADD `cEXPneeded` INT(11) NOT NULL DEFAULT '500';

Replace The Function check_level With This:

 

function check_level()
{
global $db;
global $ir,$c,$userid;
$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);
if($ir['exp'] >= $ir['exp_needed'])
{
$expu=$ir['exp']-$ir['exp_needed'];
$ir['level']+=1;
$ir['exp']=$expu;
$ir['energy']+=2;
$ir['maxenergy']+=2;
$ir['hp']+=50;
$ir['maxhp']+=50;
$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);
$db->query("UPDATE users SET level=level+1,exp=$expu,energy=energy+2,maxenergy=maxenergy+2,hp=hp+50,maxhp=maxhp+50 where userid=$userid");
}
}

Then Just Before The ?> Add This

function check_brave()
{
global $db;
global $ir,$c,$userid;
$ir['cEXPneeded']=(int) ($ir['braveLVL']*500);
if($ir['crimeexp'] >= $ir['cEXPneeded'])
{
$ir['braveLVL']+=1
$ir['brave']+=2;
$ir['maxbrave']+=2;
$ir['cEXPneeded']=(int) ($ir['braveLVL']*500);
$db->query("UPDATE users SET brave=brave+2,maxbrave=maxbrave+2, braveLVL=braveLVL+1 where userid=$userid");
}
}

 

And Yes I Know I Used INT(3) because i dont think anyone will get over brave lvl 999 you can change it if you want

Posted

Re: Crime Update

it's simple as:

 

if($ir['crimexp'] >= VALUE) {
  $brave = 2
  mysql_query('UPDATE `users` SET `brave` = (`brave` + ',$brave,'),`maxbrave` = (`maxbrave` + ',$brave,'),`crimexp` = 0 WHERE `userid` = ',$ir['userid']);
}
Posted

Re: Crime Update

I've changed it a little bit, (Set max nerve and fixed two small errors) and I'll post it here, in case anyone else wants to this great upgrade. :-D

 

	
if ($ir['braveLVL'] < 100)
	{
	       $ir['crimeEXPneeded']=(int) (($ir['braveLVL']+1)*($ir['braveLVL']+1)*($ir['braveLVL']+1)*4.2+(500*$ir['braveLVL']));
		if($ir['crimexp'] >= $ir['crimeEXPneeded'])
			{
				$ir['braveLVL']+=1;
				$ir['brave']+=5;
				$ir['maxbrave']+=5;
				//$ir['cEXPneeded'] = (int) ($ir['braveLVL']*500);
				$ir['crimeEXPneeded'] = (int) (($ir['braveLVL']+1)*($ir['braveLVL']+1)*($ir['braveLVL']+1)*4.2+(500*$ir['braveLVL']));
				$db->query("UPDATE users SET brave=brave+5,maxbrave=maxbrave+5,braveLVL=braveLVL+1 WHERE userid=$userid");
			}
	}
Posted

Re: Crime Update

 

I've changed it a little bit, (Set max nerve and fixed two small errors) and I'll post it here, in case anyone else wants to use this great upgrade. :-D

 

	
if ($ir['braveLVL'] < 100)
	{
	       $ir['crimeEXPneeded']=(int) (($ir['braveLVL']+1)*($ir['braveLVL']+1)*($ir['braveLVL']+1)*4.2+(500*$ir['braveLVL']));
		if($ir['crimexp'] >= $ir['crimeEXPneeded'])
			{
				$ir['braveLVL']+=1;
				$ir['brave']+=5;
				$ir['maxbrave']+=5;
				//$ir['cEXPneeded'] = (int) ($ir['braveLVL']*500);
				$ir['crimeEXPneeded'] = (int) (($ir['braveLVL']+1)*($ir['braveLVL']+1)*($ir['braveLVL']+1)*4.2+(500*$ir['braveLVL']));
				$db->query("UPDATE users SET brave=brave+5,maxbrave=maxbrave+5,braveLVL=braveLVL+1 WHERE userid=$userid");
			}
	}

 

  • 10 months later...

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