shrek1609 Posted March 10, 2008 Share Posted March 10, 2008 This is my first proper mod i have coded so please be kind :) Users have the option of attempting to break out of jail, costs 5 brave and can only be attempted once every five minutes... Failure to break out results in a longer prison sentence :) Create a file called jailbreak.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Mysql code You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Add to cron_fivemins.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. add to jail.php You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Please post what you think and remember this is my first mod :) p.s. pretty sure i dont need the session_start(); if someone would care to confirm i don't Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod No session_start(); is already declared in globals.php Tip: When starting a php file use <?php and not <? Tip 2: Not to be mean or anything but the require "globals.php"; dont quite work some times ive had problems with it. Use: include("globals.php"); So now that we got that all done your code should look like this at the top: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted March 10, 2008 Author Share Posted March 10, 2008 Re: V2 Escape from Jail mod Thank you will modify my post now and my code :) Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod Yw Quote Link to comment Share on other sites More sharing options...
Isomerizer Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod Tip 2: Not to be mean or anything but the require "globals.php"; dont quite work some times ive had problems with it. Use: include("globals.php"); require(); is used if you require the script its selecting to be able to execute. include(); will only include the selected script, but continue to execute if it can not be located. Maybe why you have problems using it, as the script being selected can not be found, and causes the current script to stop execution. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod Tip 2: Not to be mean or anything but the require "globals.php"; dont quite work some times ive had problems with it. Use: include("globals.php"); require(); is used if you require the script its selecting to be able to execute. include(); will only include the selected script, but continue to execute if it can not be located. Maybe why you have problems using it, as the script being selected can not be found, and causes the current script to stop execution. Not quite. require(); & include(); is exactly the same. You also get require_once(); & include_once();. Differences: The two constructs are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Quote Link to comment Share on other sites More sharing options...
Isomerizer Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod Tip 2: Not to be mean or anything but the require "globals.php"; dont quite work some times ive had problems with it. Use: include("globals.php"); require(); is used if you require the script its selecting to be able to execute. include(); will only include the selected script, but continue to execute if it can not be located. Maybe why you have problems using it, as the script being selected can not be found, and causes the current script to stop execution. Not quite. require(); & include(); is exactly the same. You also get require_once(); & include_once();. Differences: The two constructs are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Thats exactly what i just said but in more simpler words... require(); & include(); are not exactly the same, hence the differences. :lol: Quote Link to comment Share on other sites More sharing options...
tittlemouse Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod i had trouble adding it into my 5 min cron. can someone post a 5 min cron code with it in thanks Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted March 10, 2008 Share Posted March 10, 2008 Re: V2 Escape from Jail mod mysql_query("UPDATE users SET break=1") or print(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Evolution™ Posted March 12, 2008 Share Posted March 12, 2008 Re: V2 Escape from Jail mod thanks works great, can any experienced coder code jail, so break out only comes up when you are in jail please. <?php include "globals.php"; print "<h3>Gangsta-Warz Jail </br> </br> Breaking out of Jail costs 5 Brave</h3> <table width='75%' class=\"table\" border=\"0\" cellspacing=\"1\"><tr bgcolor=gray><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th> <th>Actions</th></tr>"; $q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN gangs c ON u.gang=c.gangID WHERE u.jail > 0 ORDER BY u.jail DESC"); while($r=$db->fetch_row($q)) { print "\n<tr><td>{$r['gangPREFIX']} {$r['username']} [{$r['userid']}]</td><td>{$r['level']}</td><td>{$r['jail']} minutes</td><td>{$r['jail_reason']}</td> <td>[Bust][Bail]</br>[break out]</td></tr>"; } print "</table>"; $h->endpage(); ?> here is my jail now! please re-post here when done, thanks Quote Link to comment Share on other sites More sharing options...
shrek1609 Posted March 12, 2008 Author Share Posted March 12, 2008 Re: V2 Escape from Jail mod thanks works great, can any experienced coder code jail, so break out only comes up when you are in jail please. <?php include "globals.php"; print "<h3>Gangsta-Warz Jail </br> </br> Breaking out of Jail costs 5 Brave</h3> "; if($ir['jail']) { print "<h5><font color='red'>Attempt to Escape from Jail!!! (5 Brave Req) </font><font color='green'>[do]</font></h5>"; } print"<table width='75%' class="table" border="0" cellspacing="1"><tr bgcolor=gray><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th> <th>Actions</th></tr>"; $q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN gangs c ON u.gang=c.gangID WHERE u.jail > 0 ORDER BY u.jail DESC"); while($r=$db->fetch_row($q)) { print "\n<tr><td>{$r['gangPREFIX']} {$r['username']} [{$r['userid']}]</td><td>{$r['level']}</td><td>{$r['jail']} minutes</td><td>{$r['jail_reason']}</td> <td>[Bust][Bail]</br>[break out]</td></tr>"; } print "</table>"; $h->endpage(); ?> here is my jail now! please re-post here when done, thanks here you go... Quote Link to comment Share on other sites More sharing options...
joker313 Posted May 31, 2010 Share Posted May 31, 2010 i am new and need help Parse error: syntax error, unexpected T_STRING in /mnt/w0810/d07/s00/b031023b/www/juggalowars.com/jailbreak.php on line 14 never mind i fixed it Quote Link to comment Share on other sites More sharing options...
NarutoPRG.com Posted May 31, 2010 Share Posted May 31, 2010 Personally, I use require_once('') or include_once(''). Mainly require_once(). As I see just using include() or require(), you just continueslly include the file you want, over & over again. Somehow like A loop. 8| I think this may slowdown your performance, event cause "lag" somehow, I don't know I make this stuff up, lol. But when using require_once() or include_once() your just asking to include that file ONCE. -------------- [mysql]$q=$db->query("SELECT u.*,c.* FROM users[/mysql] All I know of SQL so far that the * means your selecting all columns. So why use 2 stars? - Prove me wrong If I am, please do. Want to get as much knowledge. :) Also, for performance, [mysql]("UPDATE users SET break=1")[/mysql] Could be.. [mysql]("UPDATE `users` SET `break` = '1' ")[/mysql] Please tell me if I am wrong, and tell me how. Like I said, I want the knowledge. :P Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted June 1, 2010 Share Posted June 1, 2010 how would adding quotes around a variable help with performance? Quote Link to comment Share on other sites More sharing options...
NarutoPRG.com Posted June 1, 2010 Share Posted June 1, 2010 I saw a recent post from Djkanna, using the same techniques and he said it helps performance. Iv'e tried it on my mates TESTER game, seems to bring the speed up. :) Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted June 1, 2010 Share Posted June 1, 2010 I don't think it improves speed any...I don't know how to test speeds or I would. But I would say that these 2 querys would be the same. $db->query("UPDATE `blah` SET `blah` = `blah` + '1' WHERE `blah` = '1'"); $db->query("UPDATE blah SET blah = blah + 1 WHERE blah = 1"); Only time I quote is on a string personally, I never do on a number. $do = sprintf("UPDATE blah SET blah = '%s' WHERE blah = 1",mysql_real_escape_string($blah)); $db->query($do); I can't remeber for sure...But if I remeber right, quoting a number is actually a bad thing... But don't hold me to that. I'm not 100% on that. Quote Link to comment Share on other sites More sharing options...
sniko Posted June 1, 2010 Share Posted June 1, 2010 ("UPDATE `users` SET `break` = '1' ") 1 is numeric, so don't quote it Quote Link to comment Share on other sites More sharing options...
NarutoPRG.com Posted June 1, 2010 Share Posted June 1, 2010 @ AlabamaHit: Thanks for the information. I'm not sure myself, I saw Djkanna use something on the line like that, but I personally think Wikipedia could sort us both out, lol. Thanks for the info again. @ Sniko: I'll take your work on this. NOTE: I never saw Djkanna use the ( ' ' ) numbers, so don't take judgement of him any. *Not you guys* ;) 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.