Jump to content
MakeWebGames

V2 Escape from Jail mod


shrek1609

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 years later...

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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