Jump to content
MakeWebGames

Recommended Posts

Posted

Ok, I'm sure I saw this somewhere last week but I cannot find it now...how would one add the decimal values for stats to the users homepage instead of it just rounding to a whole number?

Posted

Assuming you have CPanel, I went into phpmyadmin and changed the userstats variable type to Decimal. That seemed to work fine. Now I have stats like 12.78, 11.34, etc. Necessary in my game since training isn't set to be super fast.

Posted

They are already set to decimal (11, 4) in the database, so when training you see the decimal on the gains, it just does not show on the homepage.

Posted (edited)

If you mean in the userstats table, yes it shows.

For instance:

Strength Agility Guard Labour

4099.5098 1136.0560 915.0077 1984.4896

This is an example of a users stats in the userstats table.

I'm guessing its something in the index.php that is rounding off the numbers but I cannot find it, this is the only reference i see close.

$ir['strength']=number_format($ir['strength']);

Also in the gym, when you train it gives the decimal values, but only on the outcome message, before you train if you look at your current stats while in the gym it shows XXXX.0000

So it does show the decimal values but its been rounded off.

Correction, the gym does in fact show the correct decimal values, i was looking at my own stats which i do not train so it was .0000 by default, but after training it did show the decimal values, so I'm going to have a look at the gym.php and see if i can see why it is working correctly there but not on the index.php

Edited by Smokey
Posted

It seems removing this from index.php allows the .0000 to show on the homepage, but it stays all zero's and does not pull this from the database, so I'm guessing I need to change "number_format" but to what I do not know, "decimal_format" surely does not work lol.

 

$ir['strength']=number_format($ir['strength']);

$ir['agility']=number_format($ir['agility']);

$ir['guard']=number_format($ir['guard']);

$ir['labour']=number_format($ir['labour']);

$ir['IQ']=number_format($ir['IQ']);

$ts=number_format($ts);

Posted

If you had read my post I am already using number_format, and that is rounding it off, which is what I am trying to change, I do NOT want it rounded, I want the decimal to show. And please excuse the double post, this was only because I edited the post above several times and the "double" post was to show my final findings, I don't normally double post. I posted in the Support section because I have already checked php.net and did not find the information I am seeking.

Posted

ok noob question but where is that located as I cannot find it? I am currently using v2.0.3.

I am new to php coding so I'm not extremely familiar, I have checked global_func and globals but I do not see it.

Posted

Just because I'm new to php doesn't mean I'm an idiot :P, as I said thats what I assumed and was the first place I looked. And there is no number_format function there. Here is a list of every single function in global_func and as you see there is no number_format function, unless one of these doubles as the number formatter, and my global_func is default, I have not added any functions to it since I bought the codes last week.

function DateTime_Parse

function money_formatter

function itemtype_dropdown

function item_dropdown

function item2_dropdown

function location_dropdown

function shop_dropdown

function user_dropdown

function challengebot_dropdown

function fed_user_dropdown

function mailb_user_dropdown

function job_dropdown

function jobrank_dropdown

function house_dropdown

function house2_dropdown

function course_dropdown

function crime_dropdown

function crimegroup_dropdown

function event_add

function mysql_escape

function check_level

function get_rank

function item_add

function item_remove

function forum_dropdown

function forum2_dropdown

function make_bigint

function stafflog_add

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...