-
Posts
912 -
Joined
-
Last visited
-
Days Won
7
Content Type
Profiles
Forums
Events
Everything posted by Coly010
-
[MENTION=64684]Dayo[/MENTION] wow i feel slightly stupid now. It was actually quite simple, thanks :)
-
Quick question. I've implemented "Cronless Crons" into Chaos Era but I've hit a slight snag. I have a max energy (similar to mccodes). I have it add 10 energy per update to each user, but how can i limit their energy to their max energy? Is it a case of setting up a loop and going through each user, checking if their energy is greater than their max energy and then setting it to their max?
-
If its only a paragraph, I'll do it for free, well almost free, my cost will be recognition on your site that I wrote it, along with a contact detail. doesnt have to be plastered over the site, but maybe on a credits page or something similar. PM me
-
Without seeing the code I can only speculate. For one, your background image appears to one, be fixed and two, be using the background-size: cover; so that will create an illusion of just the elements shrinking in size. Another thing, and again i can only speculate without seeing the code, i would assume that you have a wrapper div which when you use CTRL + (-) is decreasing in size, therefore your image is actually still technically in the centre of the parent div. My suggestion is to give your image the following css : .img { position: absolute; (or fixed) margin: 0 auto; top: calc( 50% - *half_img_height*); } *half_img_height* - replace this with half of your image height. IF your images are added dynamically, part of an image gallery and it isnt practical to set half the height of each image then jquery will sort this out. You just need to add an onclick event to your galleries navigation arrows: function onGalleryNavClick(){ var t = $(document).height() - $("gallery img").height() / 2; $("#gallery img").css({top: t}); } not overly confident on that piece of jquery, but im pretty sure you can understand what I'm getting at.
-
was more expensive
-
I've ordered this for Xbox One, just waiting for it to come now, have had loads of people telling me its amazing though
-
From looking at the screenshot my only suggestions for where to put the player info, would be to add a third column or to get rid of the gun icons at one of the sides and replace it with a div for the info. You could even incorporate Accordion into that also.
-
hence why I asked you to post a more recent screenshot as this: does not have accordion as far as I can see. i know you were asking for aesthetic feedback, but that doesnt mean you arent gonna get other forms of feedback, all of which is helpful and useful. its like going to a shop and buying something, and they give you a bag, you might not have asked for a bag, but you get one anyway
-
[MENTION=64603]Sim[/MENTION] means the menu on the left i believe no, i didnt get this idea from mccodes, not solely anyway. I've gotten this from the vast number of text based games i have both played and games I have seen to be successful. they do what they can to be minimalistic and simplistic, instead of bombarding the user with tons of information. now I don't normally get annoyed with people on here, but you've posted a screenshot of something you have done, a few of us have offered criticisms and advice, and instead of listening to us and trying to see what you can do about it, your defending what you've done. I don't mind people defending their work if 1.) its up to scratch, 2.) its only one or two people saying there is something wrong. When a few people start saying that you have a certain problem, you don't defend what you've done, you take their criticism on board, as well as their advice and you improve what you have at the moment. Your coming across as extremely stubborn, there is nothing wrong with splitting a menu up, even if you just implement Accordion. You need to do something about that menu though
-
I think you should post a new screen shot, to show us what you have now at the moment, you definitely need to do something about that menu. Whilst it might mean you have a lot of features, it's daunting and off putting for a new member, they'll look at it and be like "how am I ever gonna find out what these are or how to play this game properly" Go through your menu and pick out the most important links. Put them into a menu. Take the ones you don't need and place them somewhere where they can be found easily enough but in a better lay out. So for example you could move some links to your town page, it's just a matter of maybe thinking up a name relevant or you could just leave it as it is. Your shopping for example can be moved to the town page
-
Just a quick update on the game: I have completed the bank, investment bank, shops, inventory, attack, blacksmith and countryside files. Bank - obviously a place to store your money so attackers can't take it. There's a 2% tax on deposits, free to withdraw, everyday your money in the bank earns a 2% interest. Investment Bank - put your money in the investment bank and let it earn a higher interest rate depending on the length of time you have it there. Once you choose a length of time for your money you can't access it until after that time. Shops - game owned shops, where you can get the everyday items and weapons/armour in the game. Inventory - place where you can see what items you have, you equip your weapon and armour here. You have one weapon equipped at one time but up to 4 pieces of armour - helm, chest piece, leggings , boots Attack - custom made attack script, uses users agility and strength to determine certain features of the battle, dodge, miss, critical hits and damage dealt. Blacksmith - here you can use gems you find in the game, along with your money, to upgrade your weapons/armours. Sapphires upgrade weapons minimum damage, emeralds upgrade weapons max damage, rubies upgrade armours defence. There are 5 sizes of gems : shards, normal, large, extra large, master. Each give a different upgrade. Eg shards +1 , normal +2, large +5, xlarge +10, master +15; it requires a lot of gems to be able to upgrade so it's mid game ish, not really something I'd expect people at the start to be able to do Countryside - a way to travel between the different towns. As there are 2 countries, if you are in one country when travelling through the countryside then you won't see towns from a different country. When travelling through the countryside you can find ores, mythril, nuggets, gems, money, or be attacked by an npc. It can be a generic npc or one specific to that country. Thought I should keep you all updated, it's currently being tested locally as I code the files so there isn't a live demo as of yet, but hopefully there should be one not too far down the line.
-
nope, you can't view php source code after the page has loaded because it's a server side language. Essentially when a user clicks a link to a page, if that page is a php file, the php code gets executed by the server, and then any html code in the file, be it from a php echo(); or if it's from html code outside of the php tags, is executed and produces the page the user sees. So by the time the page has loaded, if you were to use the view source feature on your web browser, there is no php code there to be shown. If there was then it would be a heck of a lot harder to secure your files, because a hacker could just see what your doing, and possibly even manipulate and change variables / database queries you have in your file.
-
[MENTION=69823]jcvenom[/MENTION] thanks for the praise, but just remember, the only way you (in a general sense, not just you particularly) can learn is to ask questions of stuff your aren't sure or are curious about :) Well for one, the only way a hacker is going to see a php comment is if they have the file, in which case they've accessed your server, in which case you have a lot more to worry about than them reading // user attacks first For example. I wouldn't leave a password for my database in a comment, there's no need for it be there. I only have comments when something is remotely messy or confusing to help me/someone else understand what is going on in the code. I hope I don't sound like an idiot now lol
-
I pride myself in thinking that if I was to give a developer a file I coded they would be able to understand everything in it, everything would be well laid out, there would be comments when it's appropiate to explain what/why I chose to do something. That might mean there's a bit of white space in the file, but as far as I'm aware white space hasn't killed anyone yet.
-
Honestly? For readability for myself. I don't want to be going through code if I have a bug and be trying to decipher a messy one line of code, it's just a common practice I have with all my code, a habit so to speak, so that its easily read. /:
-
If you have the time to go through each of your files for security I would set up functions based on what each input variable should be: function test_string_input($str){ global $db; $str = trim($str); $str = stripslashes($str); $str = $db->real_escape_string($str); return $str; } function test_int_input($int){ $int = abs((int) $int) + 0; return $int; } Then when you have an incoming variable: $num = test_int_input($_GET['int']); $str = test_string_input($_GET['str']); I know some people might criticise my methods for security but they've worked for me so far.
-
Personally I'd feel safer if I sanitise the variables, but I might add in the extra step of validating them also from now on.
-
so i was correct in my thinking lol, i wasn't too sure, was the first time I had ever seen that. if your $_GET['wepid'] is a number, and a positive number then you can use this to sanitise it: $wepid = abs((int) $_GET['wepid']) + 0; the abs() function makes sure the number is positive (it returns the absolute value of the number, or the magnitude/size, whatever you like to call it. the (int) casts the number to an integer, basically making sure there is no decimals the +0 is something i like to do, you can't add zero to a string variable type so its another way of forcing the input to a number :)
-
ok after reading it again i think your problem lies here: if($_GET['wepid'] == $ir['equip_primary'] || $ir['equip_secondary']){ } I'm not 100% sure but is this not simply asking the if statement: return true if ( $_GET['wepid'] == $ir['equip_primary'] ) or if ($ir['equip_secondary'] is true ) and if you have it in your database that $ir['equip_secondary'] has any sort of value even 0, it should return true ? im not sure though, i've never used if the way you have, i prefer to do: if($_GET['wepid'] == $ir['equip_primary'] || $_GET['wepid'] == $ir['equip_secondary']){ } otherwise im not sure how to actually help, everything else seems in order
-
nope, those values are coming from the users and the opponents agility stats, so it changes depending. i just subbed example values into the code i have the attack code finished now, thanks for all the help guys
-
I'd assume its either down to you not referencing the correct column name in the database for the spell name or the query is failing and you aren't being alerted to it :/ try this: //If you use spells case $ir['equip_spell1'] || $ir['equip_spell2']: $qq=$db->query("SELECT FROM spells WHERE spellid='{$_GET['wepid']}'"); $r2=$db->fetch_row($qq); $mydamage2=(int) (($r2['weapon']*$youdata['IQ']/($odata['IQ']/1.5))*(rand(8000,12000)/10000)); $hitratio=max(10,min(60*$ir['agility']/$odata['speed'],95)); if(rand(1,100) <= $hitratio ) { $q3=$db->query("SELECT i.armor FROM items i WHERE itmid={$odata['equip_armor']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } if($mydamage2 < -100000) { $mydamage2=abs($mydamage2); } else if($mydamage2 < 1) { $mydamage2=1; } $crit=rand(1,40); if($crit==17) { $mydamage2*=rand(20,40)/10; } else if($crit==25 or $crit == 8) { $mydamage2/=(rand(20,40)/10); } $mydamage2=round($mydamage2); $odata['hp']-=$mydamage2; if($odata['hp']==1) { $odata['hp']=0;$mydamage2+=1; } $db->query("UPDATE users SET hp=hp-$mydamage2 WHERE userid='{$_GET['ID']}'"); print "<font color=red>{$_GET['nextstep']}. Using your {$r2['spellname']} you hit {$odata['username']} doing $mydamage2 damage ({$odata['hp']})</font>\n"; $_SESSION['attackdmg']+=$mydamage2; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using {$myabbr} {$r2['spellname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font>\n"; if ($_GET['wepid'] == $ir['equip_spell1'] || $ir['equip_spell2'] and $ir['spell_use']>0){ $db->query("UPDATE users SET spell_use=spell_use-1 WHERE userid='$userid'"); } } break; all i have done is escape your variables but i've noticed that this can sometimes cause it to fail, also is the $db created using: $db = new Mysqli($host, $user, $pass, $dbname); ?
-
I've had a different idea built off the code snippet i posted. the idea came from kyle mentioning dodge in his post. $max_rand = floor((100*$user['agility'] )/ $opp['agility']); $chance = floor(($opp['agility'] / (0.2 * $user['agility']))); if(mt_rand(0, $max_rand) < $chance ) { // miss } right so basically, it works like this. the stronger your opponent is, the greater their agility is going to be, the bigger that agility, the smaller $chance is going to be. ill give a few example values EG $u['agility'] = 20; $o['agility'] = 15; $max_rand = 2000 / 20 = 100; $chance = floor(15 / (20*0.2) ) = 3; if(mt_rand(0, 100) < 3){ // opponent dodges } basically this means the higher the users agility, the greater chance they have of attacking (because their agility increases the range for the random while also decreasing the range for the dodge), whilst the greater agility the opponent has, the greater chance they have of dodging (because their agility increases their range for their chance to dodge). thank god i do maths and further maths at school...
-
i guess that would work, but i still need to incorporate agility, otherwise one of my only two stats only counts for making the user attack first