script is pulling more then they have....
Posted on
16th Feb 2014 07:03 pm by
admin
I have this script for my game where they can change there race. This will cost them 2,500 points. However in our database points are called crystals.
If the person has 500 points, and the script takes 2,500 it will put them at -2,000 points. I need the script to tell them they dont have enough points and then not change there race because they dont have enough to do so. However im not to sure on how I would write it.
This is the race change script im editing, can anyone explain how to write this to do what I need:
Code: function conf_race_change()
{
global $ir,$c,$userid,$h;
if($ir['race'] == "Pirate") { $r="Ninja"; } else { $r="Pirate"; }
print "Switching your race will cost 2,500 points. Are you sure you want to become a $r?<br />
<a href='preferences.php?action=racechange2'>Yes</a> | <a href='preferences.php'>No</a>";
}
function do_race_change()
{
global $db,$ir,$c,$userid,$h;
if($ir['race'] == "Pirate") { $r="Ninja"; } else { $r="Pirate"; }
$db->query("UPDATE users SET race='$r' WHERE userid=$userid");
$db->query("UPDATE users SET crystals=crystals-2500 WHERE userid=$userid");
print "Success, you are now $r!<br />
<a href='preferences.php'>Back</a>";
}
No comments posted yet
Your Answer:
Login to answer
64
25
Other forums
Help with Hyperlink
Hi,
What I am trying to do may be simple, I just can't get it to work. Ok...
I am usin
Using loop to count number of entries
I'm writing a program that must ask user to type in numbers. After each entry, the program has to re
how to query data from website using VC?
I want to query some datum from a website,so I need a program to read data from a .csv file, and ass
Help If user voted, block them
On my Prayer request site, i let users Click a button to Pray for somone that has posted a pray, i g
Odd or Even
Inside of a while loop I need to echo several rows of info...easy enough.
In the loop (for th
Linux socket programming
Where can I find a good introduction to socket programming?
IF STATEMENT HELP
Hi
i have created a calendar from a table:
Code: Calendar: October 2009
<table w
Creating a unique 'control panel' for each user
Hi there,
I'm thinking of designing a site that will allow users to sign up and have their ow
Logic question
im wondering what's the best method to do the above list:
it is for alliance @ MMORPG game
Chat Box in PHP
I was thinking in doing a Chat Box in PHP. For that I would use a form with two fields, Nick and Mes