Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Can't find exactly what you've been wanting? Try searching for what you are looking for in the search box to the right. ----------->


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: [v1] & [v2] Travel to Location Button on Profiles  (Read 1855 times)

Cyanide

  • Global Moderator
  • Basic Member
  • *****
  • Reputation Power: 38
  • Cyanide has no influence.
  • Offline Offline
  • Posts: 55
    • MSN Messenger - xcyanide187x@live.com
    • View Profile
[v1] & [v2] Travel to Location Button on Profiles
« on: April 01, 2009, 03:28:16 AM »
(v1) travelto.php:
Code: [Select]
<?php
/*==================================
Travel To User Location By Cyanide
http://suburban-assault.com
http://infintium.net
This is FREE software.
===================================*/
session_start();
require 
"global_func.php";
if(
$_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require 
"header.php";
$h = new headers;
$h->startheaders();
include 
"mysql.php";
global 
$c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
if(
$ir['money'] < 5000)
{
print 
"<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You dont have enough money travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>&gt; Go Back</a>"
;
$h->endpage();
exit();
}
$ct=mysql_query("SELECT * FROM cities WHERE cityid='{$_GET['to']}'",$c) or die(mysql_error());
$to=mysql_fetch_array($ct);
if(
$ir['level'] < $to['cityminlevel'])
{
print 
"<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You cannot yet travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>&gt; Go Back</a>"
;
$h->endpage();
exit();
}
else
{
mysql_query("UPDATE users SET money=money-5000, location='{$_GET['to']}' WHERE userid=$userid",$c) or die(mysql_error());
print 
"<center>You have paid $5,000 and traveled to {$to['cityname']}.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>&gt; Back to Users Profile</a>"
;
$h->endpage();
exit();
}
?>

(v2) travelto.php:
Code: [Select]
<?php
/*==================================
Travel To User Location By Cyanide
http://suburban-assault.com
http://infintium.net
This is FREE software.
===================================*/
include "globals.php";
if(
$ir['money'] < 5000)
{
print 
"<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You dont have enough money travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>&gt; Go Back</a>"
;
$h->endpage();
exit();
}
$ct=mysql_query("SELECT * FROM cities WHERE cityid='{$_GET['to']}'",$c) or die(mysql_error());
$to=mysql_fetch_array($ct);
if(
$ir['level'] < $to['cityminlevel'])
{
print 
"<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You cannot yet travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>&gt; Go Back</a>"
;
$h->endpage();
exit();
}
else
{
mysql_query("UPDATE users SET money=money-5000, location='{$_GET['to']}' WHERE userid=$userid",$c) or die(mysql_error());
print 
"<center>You have paid $5,000 and traveled to {$to['cityname']}.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>&gt; Back to Users Profile</a>"
;
$h->endpage();
exit();
}
?>

Add think link to viewuser.php:
Code: [Select]
<a href='travelto.php?to={$r['location']}&ID={$r['userid']}'>[Travel to Location]</a>
Logged

Karlos

  • Basic Member
  • *
  • Reputation Power: 0
  • Karlos is looked down upon.
  • Offline Offline
  • Posts: 9
    • View Profile
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #1 on: April 02, 2009, 01:54:24 AM »
Personally way to much code for a simple piece of code...

if($ir['location'] != $r['location']) {
 echo 
sprintf("[<a href='docks.php?to=%u'>Travel</a>]", @intval($r['location']));
}
Logged

Redsnake420

  • Active Member
  • **
  • Reputation Power: 41
  • Redsnake420 has no influence.
  • Offline Offline
  • Posts: 115
    • View Profile
    • WWW
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #2 on: April 03, 2009, 04:23:21 PM »
does this stop them from being able to go to cities where they aren't high enough level yet
Logged

UnknownOne

  • Basic Member
  • *
  • Reputation Power: 0
  • UnknownOne is looked down upon.
  • Offline Offline
  • Posts: 6
    • View Profile
    • Email
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #3 on: April 18, 2009, 02:26:00 PM »
sprintf not printf xD
Logged

Kyle

  • Basic Member
  • *
  • Reputation Power: 4
  • Kyle has no influence.
  • Offline Offline
  • Posts: 23
    • View Profile
    • Email
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #4 on: April 18, 2009, 04:34:52 PM »
There's actualy sprintf & printf.. maybe read the tutorial ;)
« Last Edit: April 21, 2009, 06:18:55 PM by Kyle »
Logged

Karlos

  • Basic Member
  • *
  • Reputation Power: 0
  • Karlos is looked down upon.
  • Offline Offline
  • Posts: 9
    • View Profile
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #5 on: April 21, 2009, 02:56:26 PM »
Maybe a miss type... Don't act like you never do it.
Logged

envy002

  • Basic Member
  • *
  • Reputation Power: 22
  • envy002 has no influence.
  • Offline Offline
  • Posts: 5
    • View Profile
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #6 on: March 27, 2010, 07:16:08 PM »
GOOD MOD JUST ADDED TO MY GAME.. THANK YOU ;D
Logged

Demon

  • Basic Member
  • *
  • Reputation Power: 1
  • Demon has no influence.
  • Offline Offline
  • Posts: 2
    • View Profile
    • Email
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #7 on: September 01, 2010, 11:09:32 AM »
Thanks, im new to mccodes, well been playin it for a while, but wanted to own my own one :) Well, i added it, but didnt check if it works yet, but yeh im happy with it :) Thanks again.
Logged

Cyanide

  • Global Moderator
  • Basic Member
  • *****
  • Reputation Power: 38
  • Cyanide has no influence.
  • Offline Offline
  • Posts: 55
    • MSN Messenger - xcyanide187x@live.com
    • View Profile
Re: [v1] & [v2] Travel to Location Button on Profiles
« Reply #8 on: September 24, 2010, 02:48:38 AM »
Wow...I can't believe some of the stuff I coded is still getting hits....this stuff is OLD!
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.