Jump to content

slipvayne

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

slipvayne's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wow I feel so stupid that I didn't notice that. :| Thanks.
  2. I've never used array's because I've always found a way to do something without them. I have finally taught myself how array's work, but I cannot seem to add a key and value to an array without my code creating another array inside that one. I'm not sure what I'm doing wrong, but this is what I'm getting. From what I understand, print_r is suppose to print out an array. This is what my print_r displays: Array ( [knife] => 2000 ) Array ( [baseballbat] => 2000 [knife] => 2000 ) Array ( [colt] => 2000 [knife] => 2000 [baseballbat] => 2000 ) Array ( [deserteagle] => 2000 [baseballbat] => 2000 [knife] => 2000 [colt] => 2000 ) Array ( [ingram] => 2000 [colt] => 2000 [knife] => 2000 [baseballbat] => 2000 [deserteagle] => 2000 ) Array ( [deserteagle] => 2000 [ump40] => 2000 [baseballbat] => 2000 [knife] => 2000 [colt] => 2000 [ingram] => 2000 ) Array ( [colt] => 2000 [ingram] => 2000 [deserteagle] => 2000 [knife] => 2000 [baseballbat] => 2000 [ump40] => 2000 [grenades] => 958 ) Array ( [baseballbat] => 2000 [ump40] => 2000 [colt] => 2000 [knife] => 2000 [deserteagle] => 2000 [ingram] => 2000 [grenades] => 958 ) Array ( [deserteagle] => 2000 [ingram] => 2000 [baseballbat] => 2000 [knife] => 2000 [colt] => 2000 [ump40] => 2000 [grenades] => 958 ) Array ( [colt] => 2000 [ump40] => 2000 [deserteagle] => 2000 [knife] => 2000 [baseballbat] => 2000 [ingram] => 2000 [grenades] => 958 ) Array ( [baseballbat] => 2000 [ingram] => 2000 [colt] => 2000 [knife] => 2000 [deserteagle] => 2000 [ump40] => 2000 [grenades] => 958 ) Array ( [deserteagle] => 2000 [ump40] => 2000 [baseballbat] => 2000 [knife] => 2000 [colt] => 2000 [ingram] => 2000 [grenades] => 958 ) Array ( [colt] => 2000 [ingram] => 2000 [deserteagle] => 2000 [knife] => 2000 [baseballbat] => 2000 [ump40] => 2000 [grenades] => 958 ) Array ( [baseballbat] => 2000 [ump40] => 2000 [colt] => 2000 [knife] => 2000 [deserteagle] => 2000 [ingram] => 2000 [grenades] => 958 ) Array ( [deserteagle] => 2000 [ingram] => 2000 [baseballbat] => 2000 [knife] => 2000 [colt] => 2000 [ump40] => 2000 [grenades] => 958 ) Array ( [ump40] => 2000 [pepperspray] => 2000 [colt] => 2000 [knife] => 2000 [ingram] => 2000 [baseballbat] => 2000 [deserteagle] => 2000 [grenades] => 958 ) Array ( [baseballbat] => 2000 [deserteagle] => 2000 [flashbangs] => 2000 [ump40] => 2000 [ingram] => 2000 [pepperspray] => 2000 [colt] => 2000 [knife] => 2000 [grenades] => 958 ) Array ( [pepperspray] => 2000 [colt] => 2000 [knife] => 2000 [baseballbat] => 2000 [ingram] => 2000 [ump40] => 2000 [deserteagle] => 2000 [flashbangs] => 2000 [teargas] => 1800 [grenades] => 958 ) Array ( [pepperspray] => 2000 [deserteagle] => 2000 [flashbangs] => 2000 [ingram] => 2000 [ump40] => 2000 [baseballbat] => 2000 [colt] => 2000 [knife] => 2000 [tasergun] => 1800 [teargas] => 1800 [grenades] => 958 ) Array ( [pepperspray] => 2000 [colt] => 2000 [knife] => 2000 [ump40] => 2000 [baseballbat] => 2000 [ingram] => 2000 [deserteagle] => 2000 [flashbangs] => 2000 [teargas] => 1800 [tasergun] => 1800 [combathelmet] => 1600 [grenades] => 958 ) Array ( [ingram] => 2000 [pepperspray] => 2000 [flashbangs] => 2000 [baseballbat] => 2000 [deserteagle] => 2000 [ump40] => 2000 [colt] => 2000 [knife] => 2000 [tasergun] => 1800 [teargas] => 1800 [combathelmet] => 1600 [grenades] => 958 [kevlarvest] => 271 ) Array ( [ump40] => 2000 [ingram] => 2000 [knife] => 2000 [deserteagle] => 2000 [colt] => 2000 [baseballbat] => 2000 [pepperspray] => 2000 [flashbangs] => 2000 [teargas] => 1800 [tasergun] => 1800 [combathelmet] => 1600 [grenades] => 958 [kevlarvest] => 271 ) Array ( [baseballbat] => 2000 [ump40] => 2000 [flashbangs] => 2000 [colt] => 2000 [pepperspray] => 2000 [deserteagle] => 2000 [ingram] => 2000 [knife] => 2000 [tasergun] => 1800 [teargas] => 1800 [combathelmet] => 1600 [grenades] => 958 [kevlarvest] => 271 ) Array ( [deserteagle] => 2000 [baseballbat] => 2000 [knife] => 2000 [pepperspray] => 2000 [ingram] => 2000 [colt] => 2000 [ump40] => 2000 [flashbangs] => 2000 [teargas] => 1800 [tasergun] => 1800 [combathelmet] => 1600 [grenades] => 958 [kevlarvest] => 271 ) Notice how the first array has one key/value, the second has the same value as the first plus an additional value. The third array has the same values as the second array plus an additional value. I'm confused as to whether my array is correct, and that print_t is just showing me how the array has changed everytime the while loop went through, or there is an error in my code and my array is not correct. I want to get this cleared before I continue. Here is my code so far: <? $user = $_GET['user']; $attacks = $_GET['attacks']; $quser = mysql_query("SELECT * FROM user WHERE username = '$user'"); $nuser = mysql_num_rows($quser); if ($nuser == 1) { $ruser = mysql_fetch_array($quser); $totalpower = $ruser[power] + $ruser[defense]; $sabpower = round ($totalpower * $sabdmg); $ramount = mysql_fetch_array(mysql_query("SELECT * FROM user_items WHERE username = '$user'")); $wa = array(); $qweps = mysql_query("SELECT * FROM weaponstore ORDER BY type ASC, price ASC"); while ($rweps = mysql_fetch_array($qweps)) { $wepname = $rweps[colname]; $wepamount = $ramount[$wepname]; if ($wepamount >= 1) { $wa[$wepname] = $wepamount; } arsort($wa); print_r($wa); } } ?> Basically the code should add the $wepname as the key and $wepamount as the value to an array $wa only if $wepamount is >= 1, but the way my print_r is showing it I'm just confused as to why I'm getting a bunch of arrays and not just one.
  3. I fixed my code, so that there is no error. But nothing happens, the page does not refresh when the video ends. :/ Here is what I currently have: <script type="text/javascript"> var params = { allowScriptAccess: "always", bgcolor: "#FFFFFF"}; var atts = { id: "myytplayer" }; swfobject.embedSWF("http://www.youtube.com/v/<?=$embedid?>&enablejsapi=1&playerapiid=myytplayer&autoplay=1&color1=0x000000&color2=0xB90000", "myContent", "480", "360", "9.0.0", "expressInstall.swf"); function onYouTubePlayerReady(playerId) { ytplayer = document.getElementById("myytplayer"); ytplayer.addEventListener("onStateChange", "onytplayerStateChange"); } function onytplayerStateChange(newState) { if (newstate = 0) { window.location.reload() } } </script> Although check the source on http://www.zwars.org/Vaduz/?p=shuffle because I may be changing the code around on there.
  4. I'm not sure how to define ytplayer. I have been using this as a guide: http://code.google.com/apis/youtube/js_api_reference.html Like I said, all I know about javascript is how to copy and paste. :/
  5. I changed it, and no, there was no alert. :/ Here is the link if you want to check it out: http://zwars.org/Vaduz/index.php?p=shuffle Could it be because my script is in between the body tags and not the head tags? I always read that it should be in the head tags but I've always put my javascripts in the body of my documents and never had any problems.
  6. I'm pretty new at javascript... this is really the first code I'm trying to make using javascript and I've come to a little trouble. <script type="text/javascript"> var params = { allowScriptAccess: "always", bgcolor: "#FFFFFF"}; var atts = { id: "ytplayer" }; swfobject.embedSWF("http://www.youtube.com/v/<?=$embedid?>&enablejsapi=1&playerapiid=ytplayer&autoplay=1&color1=0x000000&color2=0xB90000", "myContent", "480", "360", "9.0.0", "expressInstall.swf"); ytplayer.addEventListener("onStateChange", "onPlayerStateChange"); function onPlayerStateChange(newState) { ytState=newState; if(ytState==0) window.location.reload(); } function onYouTubePlayerReady(playerId) { ytplayer = document.getElementById("ytplayer"); ytplayer.addEventListener("onStateChange", "onPlayerStateChange"); } </script> <div id="myContent"> <p>Alternative content</p> </div> Now, if ytState == 0, that means the video has ended play. I'm trying to test this out, by having the page reload when the video ends, using window.location.reload(); but it is not working. Any help or advice is appreciated.
×
×
  • 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.