devonbnice Posted December 10, 2010 Posted December 10, 2010 Hey everyone, This is my first time posting a mod on here. I've been coding my game and have made quite abit of mods. I figured i would go ahead and give this one out. It's nothing major, just a little addon to the explore. Basically what it does is, when someone goes the city, there is a chance of running into a bomb which then you will have to defuse, or end up in the hospital. Although if you do defuse it, you will receive a small cash bonus. First Copy and paste this into your explore.php (at the top) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. SQL [mysql] ALTER TABLE `users` ADD `bomb` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 [/mysql] That should be it. Any further question let me know. If anyone wants to colab and make a mod, please leave me a message. Thank you, Devon Quote
secret_life Posted December 10, 2010 Posted December 10, 2010 nice mod i love it how can i set chance to get a bomb when player go in explorer ? this is this line ? You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. if i enter other number like this $int == 3 OR $int == 5 that give more chance to get a bomb ?? thanks Quote
Uridium Posted December 10, 2010 Posted December 10, 2010 Nice mod but just one Query why is if ( $ir['bomb'] < 1 ) { print " What are you doing? "; print " <hr>> Back<hr>"; exit; Pointing to Zero when your add to database is also 0 wouldnt this continously give the above message as it cant insert or add to database to make it 1 so making it if ( $ir['bomb'] == 1 ) should cure that problem.. Quote
Jordan Palmer Posted December 10, 2010 Posted December 10, 2010 Nice mod but just one Query why is if ( $ir['bomb'] < 1 ) { print " What are you doing? "; print " > Back"; exit; Pointing to Zero when your add to database is also 0 wouldnt this continously give the above message as it cant insert or add to database to make it 1 so making it if ( $ir['bomb'] == 1 ) should cure that problem.. His way is alot better.. ie if someone manges to go to -1 his still will read it :) Quote
DJShad10 Posted December 10, 2010 Posted December 10, 2010 hey im getting ready for work but i want to use this mod it sounds awesome...i will let you know what i happens tonight Thanks Shad Quote
devonbnice Posted December 10, 2010 Author Posted December 10, 2010 Thanks for the feedback guys, really appericate it. And yes sweetboy25 the varible $int is the chance of them getting the bomb I have it set to select a random number between 1,100 and if the number lands on 1,50,100, They will get the bomb. if its any other number, it will just continue on with the original explore. Also, Illusions i have it set like that because if someone gets the bomb the sql gets set to 1 until they pick a wire. its pretty much for if someone clicks the city and backs out, and goes back to the city, they will still have to defuse the bomb before they will be able to continue on with the rest of the city. Lets say you click CITY and you get the bomb, the bomb sql is now set to 1, and will not be set back to 0 until they cut a wire. also, if the person doesnt have a bomb and they try and type explore.php?cut=red,blue, or green in the address box. the script will stop since they arnt even suppose to be cutting a wire anyway. Quote
Uridium Posted December 10, 2010 Posted December 10, 2010 Also, Illusions i have it set like that because if someone gets the bomb the sql gets set to 1 until they pick a wire. its pretty much for if someone clicks the city and backs out, and goes back to the city, they will still have to defuse the bomb before they will be able to continue on with the rest of the city Sorry you will have to excuse me as i didnt read the whole page fully then noticed after i posted that, that it was meant for an addition into the explore.php sorry about that.. Quote
Curt Posted December 11, 2010 Posted December 11, 2010 nice addition to the free mods section :) I will try this mod out myself soon. Quote
secret_life Posted December 11, 2010 Posted December 11, 2010 thanks devonbnice i have try it and i always cut the blue wire and i won every time the wire you need to cut is random or .... Quote
Jordan Palmer Posted December 11, 2010 Posted December 11, 2010 I was wondering a few things... Why are you using mysql_ instead of using the database class? Surely if your gunna "speed" up your mod then you'd select the info needed instead of using $ir aswell? Why print out every line separately? [mysql]mysql_query("UPDATE users SET hospital = $time WHERE userid=$userid"); mysql_query("UPDATE users SET hospreason = 'Severe burns' WHERE userid=$userid"); mysql_query("UPDATE users SET bomb = 0 WHERE userid=$userid"); [/mysql] Why are you running 3 queries when one query would be quite enough? Just a few things that make me think Quote
Dominion Posted December 11, 2010 Posted December 11, 2010 I was wondering a few things... Why are you using mysql_ instead of using the database class? Surely if your gunna "speed" up your mod then you'd select the info needed instead of using $ir aswell? Why print out every line separately? The $ir query runs anyway so it would only speed it up if you have optimized your whole site. With a free mod there is no one for you to know who has, therefore using $ir is better than running a second pointless query. Not sure why people print every line, however it’s not only this mod I have seen it in.The three queries I agree there’s no need. Quote
Jordan Palmer Posted December 11, 2010 Posted December 11, 2010 But what I mean is why if your speeding up your mod call for $ir? I'd sooner make a query and select what I need...otherwise you might aswell just use the db class.. I never said this is the only mod but this is something that I saw when reading through it. Quote
Dominion Posted December 11, 2010 Posted December 11, 2010 But what I mean is why if your speeding up your mod call for $ir? I'd sooner make a query and select what I need...otherwise you might aswell just use the db class.. I never said this is the only mod but this is something that I saw when reading through it. So you would ignore the $ir stuff, and run a 2nd query for no reason? As explore already has globals included it’s a bit of a waste... If you mean you would remove the $ir crap, and only call what is needed as i said before, it’s a free mod no way to know who has removes it. Most people leave it there to use, therefore using it is better than running a 2nd query. As for using the database class I tend not to unless it’s something a little bigger, adding the connection identifier and “or die(mysql_error());” is all the mcc class does... Now something like the ezrpg class file makes it worth using. Quote
Jordan Palmer Posted December 11, 2010 Posted December 11, 2010 Ah shit, Sorry I was reading it as it's a new mod...not as a addon to explore.. -.- Quote
Danny696 Posted December 11, 2010 Posted December 11, 2010 Language please Jordan, forum is PG-13, now ban yourself! Quote
Dominion Posted December 11, 2010 Posted December 11, 2010 Ah shit, Sorry I was reading it as it's a new mod...not as a addon to explore.. -.- You're the second one to make that mistake, yet if I thought It was a standalone page (You know what I mean) first thing I would point out is the lack of a php open tag. :whistling: Quote
Uridium Posted December 11, 2010 Posted December 11, 2010 You could change from mysql_query("UPDATE users SET hospital = $time WHERE userid=$userid"); mysql_query("UPDATE users SET hospreason = 'Severe burns' WHERE userid=$userid"); mysql_query("UPDATE users SET bomb = 0 WHERE userid=$userid"); to mysql_query("UPDATE users SET hospital = $time, hospreason = 'Severe burns', bomb = 0 WHERE userid=$userid"); save some space :) Quote
devonbnice Posted December 11, 2010 Author Posted December 11, 2010 I guess i could of done that :p I just put them on different lines, because it helps me read it better. Just a personal thing. Quote
Uridium Posted December 11, 2010 Posted December 11, 2010 Not mocking your script Devonbnice by any means as its free and an excellent addition :) Quote
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.