Razor42 Posted December 5, 2013 Share Posted December 5, 2013 Hi guys, Something small I have juts finished for a personal project, it's just a simple edit to the travel system which allows you to add time to travel. First lets add the SQL's: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then open up staff_cities.php add change to: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. After that we need to find monorail.php and change it's name the travel.php and then replace it with: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then after this we need to open up global_funcs.php and add this function in: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Open up cron_minute.php and add: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Now you will need to go through all your files and the files which you want to be "unaccessable" while players are travelling just simple enter check_travel(); underneath the line at the top which says include 'globals.php'! Also make sure you change the link in explore.php from monorial.php to travel.php!! I have tested and does work but if you find any issues let me know and I will fix right away!! Enjoy. Quote Link to comment Share on other sites More sharing options...
sniko Posted December 5, 2013 Share Posted December 5, 2013 Nice. You may have some trouble with your ctype_digit checks. For example, if you run; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. It would return; Strings 1 is valid 1.2 is not valid abc is not valid abc1 is not valid Int 1 is not valid 2 is not valid 1.2 is not valid Also, you've not done a check on; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. to see if it's null before inserting into the database. If, in the table structure, `time` cannot be NULL, the query would fail. I'd suggest doing a check on that. Other than that, nice. Quote Link to comment Share on other sites More sharing options...
Razor42 Posted December 5, 2013 Author Share Posted December 5, 2013 Thank you Sniko. What about if I do..... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then it will just enter as 0 right? Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted December 5, 2013 Share Posted December 5, 2013 (edited) Thank you Sniko. What about if I do..... You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then it will just enter as 0 right? Yeah but like you said it will enter it as 0. What if the game owner doesn't want 0 then they will have to go back and change it when they find out? Just check it and flag them if its not an int. also is there a cron that needs to be done as well? And one other thing, for your check_travel () you should add a userid in there as null or false that will also return a bool. This way you can easily add a players id in there and do a check for traveling for files like attack so if another player is traveling they csnt be attacked Edited December 5, 2013 by KyleMassacre added a tid bit of info Quote Link to comment Share on other sites More sharing options...
Razor42 Posted December 5, 2013 Author Share Posted December 5, 2013 Cron added. Yeah but like you said it will enter it as 0. What if the game owner doesn't want 0 then they will have to go back and change it when they find out? Just check it and flag them if its not an int. It won't enter as 0 if entered properly :)! Quote Link to comment Share on other sites More sharing options...
sniko Posted December 5, 2013 Share Posted December 5, 2013 Cron added. It won't enter as 0 if entered properly :)! I don't think you understood what Kyle was saying. Having a parameter in the check_travel function will allow you to check if an attacking opponent is travelling or not. Also, saying what you said; Assumption. The mother of all... Quote Link to comment Share on other sites More sharing options...
Razor42 Posted December 5, 2013 Author Share Posted December 5, 2013 I understand the part about the check_travel() Quote Link to comment Share on other sites More sharing options...
Djkanna Posted December 5, 2013 Share Posted December 5, 2013 I don't think you understood what Kyle was saying. Having a parameter in the check_travel function will allow you to check if an attacking opponent is travelling or not. Also, saying what you said; Assumption. The mother of all... I like this idea of traveling actually taking time, though wouldn't a player be not allowed to view the city page if they are traveling? Surely if you are traveling from one city to another, you are unable to go shopping or whatever in the city you just left from, as well you just left it. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted December 6, 2013 Share Posted December 6, 2013 Cron added. It won't enter as 0 if entered properly :)! if it was going to be properly added then why use security at all :) Did that hurt???? BUUUUUUURNNNNN!!!!! Seriously, j/k. but seriously ↑ Quote Link to comment Share on other sites More sharing options...
Razor42 Posted December 6, 2013 Author Share Posted December 6, 2013 I like this idea of traveling actually taking time, though wouldn't a player be not allowed to view the city page if they are traveling? Surely if you are traveling from one city to another, you are unable to go shopping or whatever in the city you just left from, as well you just left it. That's why the check_travel() function is added. So that you can just go to any page you want to make "off limits" and add that function, then when travelling they won't be able to access that page. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted December 6, 2013 Share Posted December 6, 2013 That's why the check_travel() function is added. So that you can just go to any page you want to make "off limits" and add that function, then when travelling they won't be able to access that page. My bad, didn't see that little note, in this case: Well done. :) Quote Link to comment Share on other sites More sharing options...
KGKiller Posted January 11, 2014 Share Posted January 11, 2014 This is a great addon to my game is there any way to make it so while the user is flying they can check there mailbox or events? Quote Link to comment Share on other sites More sharing options...
Barrikor Posted January 11, 2014 Share Posted January 11, 2014 This is a great addon to my game is there any way to make it so while the user is flying they can check there mailbox or events? The way Razor has it set up, all you have to do is not add check_travel() to that page. Quote Link to comment Share on other sites More sharing options...
Script47 Posted January 12, 2014 Share Posted January 12, 2014 The way Razor has it set up, all you have to do is not add check_travel() to that page. I think he added to global_funcs so it's called, he did it because it's easier that way instead of manually adding it to each page but that makes KG's thing quite impossible to unless he's willing to add check_travel() in every file manually except mailbox and events. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 12, 2014 Share Posted January 12, 2014 The way Razor has it set up, all you have to do is not add check_travel() to that page. Well yes and no, if you went ahead and added the function to every page then you can remove it from the pages you want them to access. But, the instructions razor gave says to add the function in global funcs which is included in every page automatically. This is a great addon to my game is there any way to make it so while the user is flying they can check there mailbox or events? Possibly what you can try is this: You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Then add at the top of your page (to be safe, above include "globals.php"): 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...
Script47 Posted January 12, 2014 Share Posted January 12, 2014 Well yes and no, if you went ahead and added the function to every page then you can remove it from the pages you want them to access. But, the instructions razor gave says to add the function in global funcs which is included in every page automatically. That's what I put didn't I? Unless I've misunderstood what you mean't? Quote Link to comment Share on other sites More sharing options...
Barrikor Posted January 12, 2014 Share Posted January 12, 2014 (edited) There's a slight difference between calling a function and defining it. Edited January 12, 2014 by Barrikor Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 12, 2014 Share Posted January 12, 2014 That's what I put didn't I? Unless I've misunderstood what you mean't? I must have been writing my reply when you were posting so yeah its basically the same Quote Link to comment Share on other sites More sharing options...
SRB Posted January 12, 2014 Share Posted January 12, 2014 Or, you could think a little and check your header file and add the parts there? Forget all of this; You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Now move similar into the header file where it's needed; Hint: it's normally below the "DONATE AND GIVE ME YOUR MONIIIIEEESS" area, where the main content starts. That is where you need to check for travelling. You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. Simple enough. 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.