Jump to content
MakeWebGames

1 brave ea minute


nyjatt

Recommended Posts

Hi I want to know how can I make it so that yu get 1 brave each minute no 1 every 5 minutes.

And another question while I'm at it

Ok well I want to add crimes that run under a time limit so if I make a section for gta: have 4 options there on what crime I can do ... choose 1 and commit the crime. If it pass or fails I have to wait x seconds to do it again and. Their is a ticker showing. I kind of know how to code the crime but the thing is how will I be able to add this to the game that's more of the question then how to code it.

So to brief all that up how can I add a crime with a time ticker and how to reduce brave from 1 brave ea 5 mins to 1 ea minute.

Link to comment
Share on other sites

Thanks for the brave part im gonna try it out when I go on my computer. For the second part I mean like I want to add more categories for crime. (Not from the admin panel) like I want to add crimes that run on time then on brave. So yu have to wait like 30 seconds before you can do the crime again.

Thanks in ahead

Link to comment
Share on other sites

Thanks for the brave part im gonna try it out when I go on my computer. For the second part I mean like I want to add more categories for crime. (Not from the admin panel) like I want to add crimes that run on time then on brave. So yu have to wait like 30 seconds before you can do the crime again.

Thanks in ahead

Link to comment
Share on other sites

ok so how would i add to the crimes to the game cause i cant figure that out and this is the code i have for the crimes is this well formatted and is it compatiable?

 

<?php

if ($_POST['Commit']){

$radiobutton=$_POST['radiobutton'];

if ($radiobutton == "1"){

$crime_chance = rand(1,10);

$crimetime1 = 10;

$Crime_exp = rand(1,10);

$Crime_money =rand(100,500);

$timewait1=time()+ $crimetime1;

$sql2="SELECT * from crimetimes WHERE name='$name'";

$result2=mysql_query($sql2);

while($rows2=mysql_fetch_array($result2)){ // Start looping table row

$timeleft1= $rows2['crime1'];

$available1= $rows2['crime1a'];

 

$last1 = $timeleft1 - time();

if ($available1 == 1) {

echo "You need to wait be fore you can do this crime";

}elseif ($crime_chance == 2){

echo "You fail HAHAHAHA";

$result = mysql_query("UPDATE crimetimes SET crime1a='1', crime1='$timewait1' WHERE name='$name'")

or die(mysql_error());

}else{

$result = mysql_query("UPDATE crimetimes SET crime1a='1', crime1='$timewait1' WHERE name='$name'")

or die(mysql_error());

$result = mysql_query("UPDATE users SET exp=exp+'$Crime_exp', money=money+'$Crime_money' WHERE name='$name'")

or die(mysql_error());

 

echo "You Stole from a child and received $$Crime_money";

}

}

}

}

$sql2="SELECT * from crimetimes WHERE name='$name'";

$result2=mysql_query($sql2);

while($rows2=mysql_fetch_array($result2)){ // Start looping table row

$timeleft1= $rows2['crime1'];

$timeleft2= $rows2['crime2'];

$timeleft3= $rows2['crime3'];

$timeleft4= $rows2['crime4'];

$timeleft5= $rows2['crime5'];

 

$last1 = $timeleft1 - time();

$last2 = $timeleft2 - time();

$last3 = $timeleft3 - time();

$last4 = $timeleft4 - time();

$last5 = $timeleft5 - time();

}

 

if($last1 <= 0){

$result = mysql_query("UPDATE crimetimes SET crime1a='0', crime1='' WHERE name='$name'")

or die(mysql_error());

}

if($last2 <= 0){

$result = mysql_query("UPDATE crimetimes SET crime2a='0', crime2='' WHERE name='$name'")

or die(mysql_error());

}

if($last3 <= 0){

$result = mysql_query("UPDATE crimetimes SET crime3a='0', crime3='' WHERE name='$name'")

or die(mysql_error());

}

if($last4 <= 0){

$result = mysql_query("UPDATE crimetimes SET crime4a='0', crime4='' WHERE name='$name'")

or die(mysql_error());

}

if($last5 <= 0){

$result = mysql_query("UPDATE crimetimes SET crime5a='0', crime5='' WHERE name='$name'")

or die(mysql_error());

}

 

?>

Link to comment
Share on other sites

use this for your 1 minute crons...

http://makewebgames.io/showthread.php/32642-any-version-Removal-of-1-minute-crons

 

How i do those tricky time things is add a table call it TIME add ID,cTIME...

Then when the person executes a crime have a query INSERT the userid and time into that table...

Then use an if statement like ...

if ($r['cTIME'] ==0){

//crime stuff

}else {

echo ' Sorry time is not up yet.';

}

I then add the query to update that time in the 1 minute cron...

Edited by lucky3809
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...