Jump to content
MakeWebGames

Travelling W/ Time


Razor42

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by KyleMassacre
added a tid bit of info
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...
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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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