-
Posts
2,210 -
Joined
-
Last visited
-
Days Won
47
Content Type
Profiles
Forums
Events
Everything posted by sniko
-
I'm with H4x0r666 on this one, very good job!
-
$get = $db->query("SELECT users.userid,inventory.inv_itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE inventory.inv_itemid=622 AND inventory.inv_qty>0 AND users.cybermoneyba>0"); $fourperc = array(); #Create an array for later while($r = $db->fetch_row($get)) /* Populate the array */ { array_push($fourperc, $r['userid']); #Add to the array of people who have 4% increase } while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*4) WHERE userid IN ($fourperc) AND cybermoneyba>0 AND cybermoneyba<10000000"); #Add 4% interest $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*1) WHERE userid NOT IN ($fourperc) AND cybermoneyba >0 AND cybermoneyba<10000000"); #Add 1% interest } Try that
-
TEST: McCodes Crystal Market/Item market
sniko replied to BeastTheKidd's topic in Modification Support
If the forum software is messing with the script, upload to pastebin. -
@Biohazard, I don't believe there is a `exp_needed` field, thus causing the division by zero. I don't have a default header nor global_func to see what the variable is to hold the exp needed. So; Go to header Find the exp bar line Find the formula to work out how much is left (I.E 24%) Use what Biohazard posted
-
*Whisper* Password on login is spelt incorrectly Could you post more about the game, the daily user activity for example. (I'm not interested in purchasing, just for others, before they ask)
-
Insert a new row into `settings`, and call it game_demo and make the value of it 1 (TRUE) Now, put in globals (at the bottom, just above ?>); $demoAccount = 2; /* Demo account ID */ $demoPages = array('index.php', 'explore.php', 'gym.php'); /* Pages that the demo account can view */ if(!in_array(basename($_SERVER['PHP_SELF']), $demoPages) AND $userid == $demoAccount AND $set['game_demo'] == 1) { echo "You are on the demo account, meaning you cannot be here<br /> <a href='index.php'>Back</a>"; exit($h->endpage()); } Then, add to the array and change the value of $demoAccount to the demo accounts ID in the users table. I hope that helps.
-
If it's adding the 1% to it, make line 5 $db->query("UPDATE users SET cybermoneyba=cybermoneyba+((cybermoneyba/100)*3) WHERE userid={$r['userid']} AND cybermoneyba>0 AND cybermoneyba<10000000"); #Add 4% interest
-
Ah yea, thanks SRB Sorry for the typo
-
When testing my method, did you come across any errors visible on your screen? Or did it just not update? Try putting or die(mysql_error()); at the end of each query, just for testing purposes.
-
True, but I find that logical code is easier to read (as well as it being 3am (yes, I am using your excuse :p)) but I do see why you are saying what you are saying, plus we all have our methods
-
Simple, Select users who have the item 622, and a cyber account <?php $get = $db->query("SELECT users.userid,inventory.itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE inventory.inv_itemid=622 AND inventory.inv_qty>0 AND users.cybermoney>0"); ?> Now that you have the users you want, let's do the interest <?php $fourperc = array(); #Create an array for later while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoney=cybermoney*0.4 WHERE userid={$r['userid']}"); #Add 4% interest array_push($fourperc, $r['userid']); #Add to the array of people who have 4% increase } ?> Now that's done, let's do those who don't have the required things I've edited this query (edit #1) $get = $db->query("SELECT users.userid,inventory.itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE users.userid NOT IN({$fourperc}) AND users.cybermoney>0"); ?> Now let's add the 1% <?php while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoney=cybermoney*0.1 WHERE userid={$r['userid']}"); #Add 1% interest } ?> And for the full script <?php $get = $db->query("SELECT users.userid,inventory.itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE inventory.inv_itemid=622 AND inventory.inv_qty>0 AND users.cybermoney>0"); $fourperc = array(); #Create an array for later while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoney=cybermoney*0.4 WHERE userid={$r['userid']}"); #Add 4% interest array_push($fourperc, $r['userid']); #Add to the array of people who have 4% increase } $get = $db->query("SELECT users.userid,inventory.itemid FROM users LEFT JOIN inventory ON users.userid=inventory.inv_userid WHERE users.userid NOT IN({$fourperc}) AND users.cybermoney>0"); while($r = $db->fetch_row($get)) { $db->query("UPDATE users SET cybermoney=cybermoney*0.1 WHERE userid={$r['userid']}"); #Add 1% interest } ?> I hope that helps ~sniko Edits Added array_push
-
This guy shows you how it's done.... Admittedly, he lost me in some areas.
-
Have a look at the original post and look into these php functions, should help you get there; mysql_fetch_array mysql_num_rows Also make sure you check the php manual and think of the solution (the system) logically, and don't over-complicate it. Also, make use of primary keys and foreign keys. Once you have tried, even if you succeed or fail, post it here, and PM me, and I'll read through your programming and give you pointers, if I feel there needs to be any. -sniko
-
Following on from this, you need to ask yourself the question - Can they mine even if they don't have enough brave? If no <?php #remove tag if($ir['brave'] < 4) { echo "You need at least 4 brave to enter the mining shaft...<br /> ยป <a href='index.php'>Back home</a>"; exit($h->endpage()); } If yes <?php #remove tag $db->query("UPDATE `users` SET `brave`=`brave`-4 WHERE `userid`={$userid} AND `brave`>4"); ?> Also, you need to look at your game, and think - Is 4 brave too much? How much brave do they start with and get when they level? Can I make mining items to make, if they have bought, the required brave become less? Just an idea, and a few pointers.
-
Then how will they know you can do it? It's an example, isn't it? An example of your work, an example of your experience, an example of what you can do. Sure it may get stolen, but what's that, $20? and how much return will you make from putting a live demo of it, more than $20, surely....
-
Just a few pointers, I'm not flaming here, but; 1) Research into the switch control 2) In the database, you are creating columns with 54 bits, even if you are using 8 - at maximum - it will (not to the eye) fill in the rest with 0's, therefore wasting space. Think how many you can have when just using 8 bits. "xxxxxxxx" => "99999999" (Quite a lot) 3) What illusions said, create a new table with the foreign key 'userid' for mining Other than that, well done :)
-
Go to phpmyadmin > game database > settings > find "second_currency" in conf_name, if it's not in there, add it.
-
Hey, This isn't a request, or a "ahh, help me moment" but an idea someone could do, to try and get the community back as it was, to inspire young/old developers to open and develop games. Anyway, this is the idea; The Idea You mine for ore, and with that ore, you can upgrade your items. A simple concept, and potentially enjoyed by many players. SQL Tables upgrade_items, with the following columns; id int(4) PRIMARY KEY ore_needed varchar(50) item_from int(4) item_to int(4) ID For indexing ore_needed store an array of values, separated by a comma, explode the comma, to see what they need. Stores itemID's from the items table item_from this is the item that you are upgrading, a numerical value. item_to once you have all the "ore_needed", this is the item you get once upgraded. The How Credits This thread This post peterisgb illusions Anyone who makes this has full distributor rights. ~sniko
-
Although I agree with you on this, There has to be some point, a milestone, in your progress where you think "I've done it", but true, it is never truly finished.
-
Sure, you may argue that this is in the wrong section, but everyone who has dealt with a certain project, for instance, a text based game, their motivation begins to shrink, thus your once loved project begins to die, and fade away. So, let me get to my point here, looking at the chart below, you can see, typically, your motivation levels as the project proceeds. * Some may argue the placement, the values, the decrements and increments over time, but typically, this is how I see it. As you can see, your motivations levels will come back once you see your project be a success, be it an active user base, people talking about it, please donating, whatever. So I hope that gives you some motivation if you have lost it to get back on with your projects, and you need to look 'over the wall' to the future to see what you could be doing once the project has finished. I came across this 'footage/audio' yesterday whilst on YouTube, and my god, it has opened my eyes to what I can achieve, not by giving examples of people who have been in my position, but by giving a logical walk-through on life, success, and achievement. I was so excited by what's said on this 'footage/audio' I made it the soundtrack to my personal site and I have written a speech to say in a lower-school assembly to help inspire them, and open their eyes to achievement. Listen to the 'footage/audio' Thank you for your time. -sniko
-
I've read this topic, and this is what I have concluded. John, overseeing any embarrassment that may occur, being a close victim of scamming, came and told the community who tried scamming him. He isn't in the wrong, in fact, he is in the right, why? Because he is notifying others who may become a victim in the future, a saint you may call him, or the day hero, whatever you want to call it. BioHazard, the one who the claim is against, is, although admits the claims made against him, trying to defend his innocence where Danny's post put the same concept, but in a more known situation. Overall, although, concluding from the topic's content, the allegations are correct, and I am not defending anyone, just stating my view, the claim didn't proceed to a success, as in no money was handed over, we know both sides of the story, so let's save arguments, and lock the topic?
-
mccode-v2 Christmas Advent Calendar [ WORKING COPY }
sniko replied to Uridium's topic in Free Modifications
...I took a quick look at the code, and the forum software switch-over messed the code up too, for instance, a html image tag was converted into BB image tag. -
1. What is the difference between RPG and MMORPG games? RPG - Role playing game MMORPG - Massively Multiplayer Online Role Playing Game. For instance, Runescape (MMORPG) and Pokemon on the handheld device (RPG). 2. Where do I start to create my own game? (I got PHP and MYSQL skills). Use various software to help you; wamp to run php on your machine, includes database tools. bubblus to help you mind map your ideas 3. Is there any good "ready to run" mafia games to buy out there? If so, could you recommend me some? McCodes I suggest this, others may despise it, but there is a big community, and a vast selection of modifications. Although, it isn't a game as such, it can easily be made into one. 4. Is there any beginners guide/book on how i can create my own games? Not that I have come across, but the typical game features should come naturally; Story line Everything flows and interlinks
-
So, Can you crack it? - Site by GCHQ. Spy Recruitment. No Hoax.
-
No worries at all. Glad I could help.