Jump to content

Snooble

Members
  • Posts

    311
  • Joined

  • Last visited

    Never

Everything posted by Snooble

  1. I have a sql table... NUMBER DATE I insert, "5", "" I need the date of the insert to be put in. example: 21-5-2008 Is it possible to get SQL to datestamp it automatically? or should i generate the date in PHP and save it too? Snoobs
  2. $size = $_FILES['name']['size'] / 1048576; Will give me in MB? what's the function that will limit it to 2 decimal places? so 2.31413 will be 2.31MB? Thanks a lot so far people!! Snoobs
  3. Hey everyone, I'm using "move_uploaded_file" to upload a file to my server, if i use the $_FILES['name']['size'] command i get the size in BYTES. I need the size in mb! What's the best way to do this? So it looks like 2.43mb or 4.92mb. etc. Thank you in advance! Snoobs
  4. Thanks for the tip! Do you have any tips when it comes to learning flash? Any good tutorials to start with? Sam
  5. I made a small feature addon... allows me to choose how many lines are active. just with if statements around the function calls. Thanks ever so much, now i make the flash shell and symbols! I'll pm you a link at the end so you can see your code being used! Sam
  6. You are superb, i'm testing it all now. will keep you updated. Really thought i was going a long way about it, need to learn about arrays more. Thanks so much Sam
  7. bump. really need help.
  8. Hey everyone, I'm making the serverside code for a slot machine so far i have: <?php ////////USER VARIABLES////////// $linebet = 5; $numberoflines = 9; ////////USER VARIABLES////////// //////////////////////////////////////////REELS/////////////////////////// function spin(&$number){ $number = rand(0, 100); if ($number <= 20){$number = BAR;} elseif($number < 45 && $number > 20){$number = X;} else{$number = O;} echo $number; } /////////////////////////////////////////REELS///////////////////////////// ?> <br /> <br /> <br /> <table width="338" height="89" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="20%" height="40"><?php spin($aa); ?></td> <td width="20%" height="40"><?php spin($ba); ?></td> <td width="20%" height="40"><?php spin($ca); ?></td> <td width="20%" height="40"><?php spin($da); ?></td> <td width="20%" height="40"><?php spin($ea); ?></td> </tr> <tr> <td width="20%" height="40"><?php spin($ab); ?></td> <td width="20%" height="40"><?php spin($bb); ?></td> <td width="20%" height="40"><?php spin($cb); ?></td> <td width="20%" height="40"><?php spin($db); ?></td> <td width="20%" height="40"><?php spin($eb); ?></td> </tr> <tr> <td width="20%" height="40"><?php spin($ac); ?></td> <td width="20%" height="40"><?php spin($bc); ?></td> <td width="20%" height="40"><?php spin($cc); ?></td> <td width="20%" height="40"><?php spin($dc); ?></td> <td width="20%" height="40"><?php spin($ec); ?></td> </tr> </table> <br /> PAYOUT - LINES BET - PER LINE - <a href="index.php">SPIN</a><br /> <?php /////////////WINS///////////////// function linecheck(&$lineone, &$linetwo, &$linethree, &$linefour, &$linefive, &$result, &$symbol){ if($lineone == $linetwo && $linetwo == $linethree && $linethree != $linefour){ if ($lineone == "BAR" && $linetwo == "BAR" && $linethree == "BAR"){ $result = 3 * 1; $symbol = "BAR"; } if ($lineone == "X" && $linetwo == "X" && $linethree == "X"){ $result = 2 * 1; $symbol = "X"; } if ($lineone == "O" && $linetwo == "O" && $linethree == "O"){ $result = 1 * 1; $symbol = "O"; } } if($lineone == $linetwo && $linetwo == $linethree && $linethree == $linefour && $linefour != $linefive){ if ($lineone == "BAR" && $linetwo == "BAR" && $linethree == "BAR" && $linefour == "BAR"){ $result = 3 * 4; $symbol = "BAR"; } if ($lineone == "X" && $linetwo == "X" && $linethree == "X" && $linefour == "X"){ $result = 2 * 4; $symbol = "X"; } if ($lineone == "O" && $linetwo == "O" && $linethree == "O" && $linefour == "O"){ $result = 1 * 4; $symbol = "O"; } } if($lineone == $linetwo && $linetwo == $linethree && $linethree == $linefour && $linefour == $linefive){ if ($lineone == "BAR" && $linetwo == "BAR" && $linethree == "BAR" && $linefour == "BAR" && $linefive == "BAR"){ $result = 3 * 5; $symbol = "BAR"; } if ($lineone == "X" && $linetwo == "X" && $linethree == "X" && $linefour == "X" && $linefive == "X"){ $result = 2 * 5; $symbol = "X"; } if ($lineone == "O" && $linetwo == "O" && $linethree == "O" && $linefour == "O" && $linefive == "O"){ $result = 1 * 5; $symbol = "O"; } } } linecheck($ab, $bb, $cb, $db, $eb, $one, $onesymbol); linecheck($aa, $ba, $ca, $da, $ea, $two, $twosymbol); linecheck($ac, $bc, $cc, $dc, $ec, $three, $threesymbol); linecheck($aa, $bb, $cc, $db, $ea, $four, $foursymbol); linecheck($ac, $bb, $ca, $db, $ec, $five, $fivesymbol); linecheck($ac, $bc, $cb, $da, $ea, $six, $sixsymbol); linecheck($aa, $ba, $cb, $dc, $ec, $seven, $sevensymbol); linecheck($ab, $bc, $cc, $dc, $eb, $eight, $eightsymbol); linecheck($ab, $ba, $ca, $da, $eb, $nine, $ninesymbol); /////////////////////WINNING LINES//////////////////////////// function ifwin(&$line, &$start, &$linenumber, $linebet){ if($line != ""){ switch($start){ case "BAR": $line = $linebet * $line; break; case "X": $line = $linebet * $line; break; case "O": $line = $linebet * $line; break; } echo "<br><br>You've won: ".$line." on line ".$linenumber."!"; } } ////////////////////////WINNING LINES///////////////////////// $no1 = 1; $no2 = 2; $no3 = 3; $no4 = 4; $no5 = 5; $no6 = 6; $no7 = 7; $no8 = 8; $no9 = 9; switch($numberoflines){ case 1: ifwin($one, $onesymbol, $no1, $linebet); break; case 2: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); break; case 3: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); break; case 4: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); ifwin($four, $foursymbol, $no4, $linebet); break; case 5: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); ifwin($four, $foursymbol, $no4, $linebet); ifwin($five, $fivesymbol, $no5, $linebet); break; case 6: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); ifwin($four, $foursymbol, $no4, $linebet); ifwin($five, $fivesymbol, $no5, $linebet); ifwin($six, $sixsymbol, $no6, $linebet); break; case 7: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); ifwin($four, $foursymbol, $no4, $linebet); ifwin($five, $fivesymbol, $no5, $linebet); ifwin($six, $sixsymbol, $no6, $linebet); ifwin($seven, $sevensymbol, $no7, $linebet); break; case 8: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); ifwin($four, $foursymbol, $no4, $linebet); ifwin($five, $fivesymbol, $no5, $linebet); ifwin($six, $sixsymbol, $no6, $linebet); ifwin($seven, $sevensymbol, $no7, $linebet); ifwin($eight, $eightsymbol, $no8, $linebet); break; case 9: ifwin($one, $onesymbol, $no1, $linebet); ifwin($two, $twosymbol, $no2, $linebet); ifwin($three, $threesymbol, $no3, $linebet); ifwin($four, $foursymbol, $no4, $linebet); ifwin($five, $fivesymbol, $no5, $linebet); ifwin($six, $sixsymbol, $no6, $linebet); ifwin($seven, $sevensymbol, $no7, $linebet); ifwin($eight, $eightsymbol, $no8, $linebet); ifwin($nine, $ninesymbol, $no9, $linebet); break; } /////////////WINS///////////////// ?> There must be a nicer way to do all this. It shouldn't be too hard to understand, but I don't think I need a lot of the parts I have. The thing is, I want to add up all the wins from each line and output them as a total to the user! Thanks in advance, Sam
  9. echo the varialbe in the first field, in the next echo the variable +1. etc. so - find the name of the field they enter the information in - for example - date - find method of sending info, POST or GET. then: $date = $_POST['date']; or $date = $_GET['date']; echo it in the cell you want, followed by using http://www.w3schools.com/php/php_ref_calendar.asp to help you with days and incrementing the variable.
  10. So I'll create it in Flash and PHP. I've looked into exchanging variables and it seems fine. Can someone please give me a sample script to take a variable from php ($1a) and output the correct image (switch statement?) in flash? As I need somewhere to start. Thanks so much for your help. Sam
  11. should i use java or flash? Thinking about user interaction with the machine. I've looked at popular casinos, and i see .swf's. Apologies for the wrong section. Thanks Snoobs
  12. Hey everyone, I'm starting a project, I want to create a working slot machine, with balance, amount of spin, animated slots, it all. I'm guessing i need a client side, and a server. For the server i'd like to use PHP, for the client, i think flash? (Suggestions welcome) I have a pretty good knowledge of php. To start with, It's going to have to use a lot of rand(), and i'm going to have to work out probability. My question to you all is, is it possible to pass variables between php and flash? if so, how, and how would you go about making it? I want it to be 5 reels with multiple win lines. Thanks in advance for your help. Snoobs
  13. I know how to include files and order by using sql... but you can only order by a column value... i want to know if i can create a formula between columns in the mysql database? column a minus column b = column c. yes or no? thanks Sam
  14. The reason i need the value is cause i wish to use an ORDER BY query to sort my rows... any way of doing that? Thanks Sam
  15. $rating = $list['w'] + $list['l']; $sql = "UPDATE users SET rating = '$rating' where id = '$list['id']'" would work fine but it means i must pull info from the database every page load.. can i not create a script in the database itself? like in excel when you can create formulas between cells? Thanks Sam
  16. Right this is simple but i wonder if you have another way of me doing it. i have 2 number in a database... column WIN and column LOSE i want to create another column in the database (MYSQL) that subtracts LOSE from WIN and stores it in a column called RATING. can i do this through phpmyadmin? EXAMPLE WIN = 10, LOSE = 3. WIN - LOSE = 7 RATING = 7 I want it to remain updated... is the only way i can do it by entering a php script on EVERY page of my website (as wins and losses can happen at anytime)? thanks Sam
  17. It's fine i ended up using the below script... (you're right about it being too confusing) $level = 0; $nextlevel = $list['level'] + 1; $xpneeded = 50; for($i=0; $i<$nextlevel; ++$i) { $level++; $xpneeded = $xpneeded + ($xpneeded / 5); } if($list['xp'] >= $xpneeded){ $updatexp = $list['xp'] - $xpneeded; $levelchange = "UPDATE users SET level = ".$level.", xp = ".$updatexp." WHERE id = ".$list['id'].""; mysql_query($levelchange) or die ("Couldn't execute $sql: " . mysql_error()); $grownlevel = 1; }
  18. Hey everyone, hopefully a quick one: $level = 2; $case = 1; $xpneeded = 50; switch ($list['level']) { case $case: if($list['xp'] >= $xpminus){ $xpchange = $list['xp'] - $xpneeded; $update = "UPDATE users SET level = ".$level.", xp = ".$xpchange." WHERE id = ".$list['id'].""; mysql_query($update); } break; $level = $level ++; $case = $case ++; $xpneeded = $xpneeded + ($xpneeded / 2); case $case: if($list['xp'] >= $xpminus){ $xpchange = $list['xp'] - $xpneeded; $update = "UPDATE users SET level = ".$level.", xp = ".$xpchange." WHERE id = ".$list['id'].""; mysql_query($update); } break; $level = $level ++; $case = $case ++; $xpneeded = $xpneeded + ($xpneeded / 2); case $case: if($list['xp'] >= $xpminus){ $xpchange = $list['xp'] - $xpneeded; $update = "UPDATE users SET level = ".$level.", xp = ".$xpchange." WHERE id = ".$list['id'].""; mysql_query($update); } break; Does it make sense to you lot? the problem is that the switch statements arent recognised and also the ++'s aren't recognised... where would i have to place them... ? Thanks Sam
  19. the reason for the question is because... at the end of the battle i need the stats to refresh straight away... but because the info was taken at the top of the page the updated stats aren't shown by the time the updates have been made...eg STATS READ HERE 5 strength 10 defence BATTLE TIME you won + 2 strength + 1 defence I stats at the top are old... i want them to change immeadiately... any help? thanks again lemmin Sam
  20. Hey everyone... i have a page i want to keep up to date.... its "include 'login.php';" ed into my index... it needs to refresh every 3 seconds. if i use meta refresh it refreshed everything. if i use javascript (window location) it refreshes everything... ?? do i have to use a frame? Thanks Sam
  21. The thing is, the reason i'd say javascript is because i dont mind the content to be on the page to start with (in the source)... and then javascript (if im right) can output the information without refreshing the page?... but (if you dont know javascript) could you help me work out a while($hp > 0){ put information into an array? } just how would i increment the array... so each line equals a number in the array. thanks people Sam
  22. that would be useful.. if the user was to press back on the page what would happen? I need the script to continue until it finishes... otherwise there would be alot of errors... ??
  23. i want to pause... so (for the user) it seems it's turn based... every turn i can output the damage done and the hp left....
  24. ok, so where would i be looking in javascript? to refresh every so many seconds... see i was thinking that the fight would all be done in one process... and each turn put into an array... user1() user2() but how can i get javascript to output each line of the array and how do i put each turn into an array? thanks (sorry for all the questions) Sam
  25. ok, i want to create a battle that the user can view... $name = user1 $hp = 10 $min = 1 $max = 3 $name2 = user2 $hp2 = 40 $min = 5 $max = 7 Every turn user one will deal between 1 and 3 damage (eg. rand(1, 3)) my script needs to output: Your weapon done rand(1,3) damage to $name2 then it should output name2's attack: $name2's weapon did rand(5,7) damage to you it needs to continue the loop untill someones hp goes beneath zero. i need to output each turn eg(user does random damage) one at a time with a 3 sec delay between posting the info the the user. hope that clears it up...? thanks in advance lemmin Sam
×
×
  • 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.