How do I show on my sitesome stats from every player

Get help using Construct 2

Post » Sat Sep 24, 2016 11:41 am

Message: MisterAqua can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
For example : i want to show on my website how many time my game was ended, or how many times peoples die.

I have already made a page with false stats here (everything is in french but that doesn't matter if you don't understand anything, it's just to show an example) :http://afranchcoder.comuf.com/Randomizor%202/Randomizor.html

Can i simply use event or may i need a MySQL server ?

I do not put example because I just want to know how can it be done? I would make it by miself.
B
11
S
3
Posts: 25
Reputation: 1,115

Post » Sun Sep 25, 2016 7:54 am

Anyone ? Up pls
B
11
S
3
Posts: 25
Reputation: 1,115

Post » Sun Sep 25, 2016 11:44 am

MisterAqua wrote:Can i simply use event or may i need a MySQL server ?


you need Ajax(in C2) to send "signal -I die"..php to add 1 to count and some place to store data..
in this example I use text file to read & write data..but mysql database is better choice..

fancy website
http://korbaach.pixub.com/test/deathCounter.html
Image
php&txt file
Image

deathCounter.txt
Image
deathCounter.php
Code: Select all
<?php
 
$file = ('deathCounter.txt');
$death = file($file);
$death[0] ++;
 
$fp = fopen($file , "w");
fputs($fp , "$death[0]");
fclose($fp);
echo $death[0];
exit();
?>


in deathCounter.html
Code: Select all
<h2>Morts au total  =  <?php
echo file_get_contents("http://korbaach.pixub.com/test/counter/deathCounter.txt");
?></h2>


deathCounter.capx

open capx ..check death count on web page..kill player..refresh deathCounter.html page..
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sun Sep 25, 2016 1:47 pm

Ok thx :)
B
11
S
3
Posts: 25
Reputation: 1,115


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests