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
Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:
Can a php script be
Open/Close Links in Php
Hello, Hoping someone can inform me how I can get PHP to automatically open a set of links in a new
Internal class functions don't seem to get executed.
Hi. Can someone please put me out of my misery on this. I don't write much PHP and this has me baffl
Header redirect
Hello ive got a problem ive got form with its action set to itself.
Code: <form id="f
ereg_replace()
Basically what i need to do is
$title = "This Suck's"
$striped = ereg_repl
foreach result into a single variable
Hi,
I have this code...
Code: [Select]foreach ($_POST['Interests'] as $interest =&
problem with php server update from mid 2009
Hi,
I have this navigation menu on 2 websites which used to work just fine. After a recent up
Update not working ... please help
Hi,
I am trying to update a row using an edit form by passing id of the row .. but it is not
Auto install
Hi I have a directory lets say "apps" that I then have more folders ie "email",
SAP BCS. BPS
Hi all,
I am seeking reading note on the following in BW
BCS, BPS
ADVANCE