Jump to content

Driiper

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Driiper's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello! i creating a game "School project" and then i was wondering how can i have 1 string with rand() instead of 20.. if i have just 1 rand the random number is the same :S Any ideas? Thanks
  2. IF ($geld - 100000 <0) { $message "You dont have enough money"; } else { (This is where my code should go } This didnt work. what am i doing wrong? sorry but im a newb
  3. This function lets players buy Territorys in the game, but i need to make something that prevent peoples from buying if they dont have enough money, when they try to buy they should get a message saying, "You dont have enough money" i tryed but it didnt work
  4. Hello everyone! im creating a function for my game that will make players able to buy Territories but im stuck again what i cant remember how i can make a territory buyable only if you have enough money. at this moment you can buy whatever you want the your money will go down to -100000. how can i make a function that says "IF $geld - 100000 < 0 get error message" do anyone know how to do that? <? $dbres = mysql_query("SELECT * FROM `[land]` WHERE `id`='{$_GET['id']}'"); if($profile = mysql_fetch_object($dbres)) { $id = $profile->id; $owning = ($profile->owner == "none") ? "This land is not captured yet!<br> Buy it for $100.000 <form method=\"post\"><input type=submit name=buy value=Buy!></form>" : "Owner: <b><a href=viewprofile.php?viewprofile={$profile->owner}>{$profile->owner}</a></b>."; if($profile->owner =="{$cookieusername}"){ echo "<a href='est.php?type=1'>Start an crew on this land!</a><BR>"; } if(isset($_POST['buy'])) { $data->url = preg_replace('/\</','&#60;',$_POST['website']); $data->muziek = preg_replace('/\</','&#60;',$_POST['muziek']); $data->info = preg_replace('/\</','&#60;',substr($_POST['info'],0,500)); mysql_query("UPDATE `[land]` SET `owner`='{$cookieusername}' WHERE `id`='{$id}'"); mysql_query("UPDATE `users` SET `geld`=`geld`-'100000' WHERE `username`='$cookieusername'"); print " <tr><td class=\"mainTxt\">This land is yours!</td></tr>\n"; } print <<<ENDHTML <br> <br> <center> <table border=1 cellspacing=0 cellpadding=2 width=30% bordercolor=black class=sub2> <tr> <td align=center background=topic.gif>Owner of this land</td> </tr><tr><tr><td class="mainTxt" align="center">{$owning}</td></tr> </table> </center> </form> <br><br><br><br> <br /><br /> ENDHTML; } ?>
  5. yay it worked now thanks, but now i get a FATAL error. i know theres somthing wronh with line 8 but i dont know what else to write. anyone know? Fatal error: Call to undefined function updatetable() in C:\server\www\www\mafia\thegame\en\make_crew.php on line 8 <?php if ($geld >= 5000000) { //they have equal or more $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); <-------- THIS LINE! $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke";} ?>
  6. what i cant get how i can get this error "Parse error: syntax error, unexpected '{' in C:\server\www\www\mafia\thegame\en\make_crew.php on line 2" when it looks like i have all connected. what did i do wrong? btw i tryed to remove it and then i got somthing with T_Variable..
  7. <? if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke"; ?> If you dont have enough money "$geld" you will get the message that "YOU DONT HAVE THAT MUCH MONEY" but it you have over the ammount 5000000 the db will update your money and create the clan with the clan name the player wrote from the visual site "$ikke"
  8. could you help me to make some sense in it then?
  9. all i need is to get that syntax error away :-\ anyone know howto? can anyone se the error? if so can you correct it. sorry for my newb
  10. That line is supposed to check if the user have 5.000.000 money if not they get the message that they dont have enough money better ?
  11. no that didnt work i will try to explain more if ($crew == 0) { echo "<div class=\"window\">"; echo "<div class=\"mainTitle\">Apply to a clan</div>"; echo "<div class=\"mainText\">"; $lijstGebruikers = "SELECT * FROM crews ORDER BY id ASC"; $resultLijstGebruikers = mysql_query($lijstGebruikers); echo "<form method=\"post\" name=\"form\">"; echo "<select name=\"c\">"; echo "<option value =\"\">Select a clan</option>"; while ($row = mysql_fetch_array($resultLijstGebruikers)) { echo "<option value =\"$row[id]\">$row[name]</option>"; } echo "</select>"; echo "<br /><br /><input type=\"submit\" value=\"Apply\"> "; echo "</form>"; if ($rank > 999) { echo "</div></div>"; echo "<div class=\"window\">"; echo "<div class=\"mainTitle\">Create a Clan</div>"; echo "<div class=\"mainText\">"; ?> <form method="post" action="make_crew.php"> Creating a clan costs $5,000,000 <br /><b>Crew Name:</b><input type=text name=ikke size=20> <br /> <input type=submit value=Create Clan> </form> This is from the form where my users is gonna create a own clan as you se its will go the make_crew.php and then the make_crew.php is supposed to inject the input field called "ikke" to my db. <? if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke"; ?> understand now?
  12. Hello PHP Freaks i have a some problems with my script, i got a "Parse error: syntax error, unexpected '{' in C:\server\www\www\mafia\thegame\en\make_crew.php on line 2" and i cant se whats wrong with it, can anyone help me? sorry but im a noob :S <? if ($Make_crew) (($geld - 5000000) < 0) { $melding = "You don't have that much money."; } else { $new_current = ($geld - 5000000); UpdateTable(users,geld,$new_current,id,$userid); $opdracht = "insert INTO crews values('','$ikke','500000','$cookieusername','0','0')"; $resultaat = mysql_query($opdracht); $melding = "You have made the crew, $ikke"; ?> Thanks Driiper
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.