savvito123's Forum Posts

  • Check that

  • > > Easy way

    > >

    > >

    > >

    > >

    > > But the number is always 5 digits?

    >

    > no. I want to add money feature. but it's hard to read

    It is very sad that there is nothing to do this automatically. It should definitely be in a program like Construct. I have looked at this issue but I cannot understand :( all I want to do is an easy to read money ...

    You want to read money.

    But how you want to read money?

    1.500 or 1.500.00 ? You want to include and cents?

    Or you want to add a dot to the last 3 digits?

  • Easy way

    But the number is always 5 digits?

  • Thank you oosyrag for your answers.

  • But Android can communicate with Ios?

    I want only to build it for Playstore and Appstore.

    Does the multiplayer object works with this 2 platforms?

    Or users with Android can connect only with Android users and ios with Ios.?

  • Hello.

    I just notice that players on pc can not connect with players with apk on mobile.

    I only found some old post so here i am to check If something change.

    Does multiplayer apk applications works on Android and ios?

  • You do not have permission to view this post

  • Sorry my fault.

    I thought was for a single issue.

    So a friend send me his C2 project and this error appear when i try to save the project to Dropbox.

    I open it using C3.

    I think is have to deal with the assets, it didnt find their urls.

    It let me save it as a single file but not to Dropbox.

  • first time i see that

  • Image point position maybe

  • You do not have permission to view this post

  • For a game with 4 players. When the host disconnect or leave the room, who is able to send to the other peers who is win or lose?

    Its a card game with 2 teams of 2 players in each team.

    If the host disconnect and is at team A then i have to send wins to the leaderboard for the 2 players in Team B.

  • A quick answer to you is, do you set the width of the array to the entries you want to load?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Update:

    On start of layout you have to set the "uniqe" string variable to the fb instant game uniqe id.

    Here is a way to fill your array

    Also when you retrieve images you have to URLdecode it.

    Good luck with that and remember, if you try to edit some php files search for MySQLi and not for MySQL.

  • Hello,

    I will try to make it as soon as i can.

    It means you have allready create a database somewhere (i use hostinger) it accept PHP 7.2.

    On start of layout check if that is the first run of the game (use a global variable "firstRun" = 0)

    and run this action.

    saveinfo.php must create it and save it to a folder to you site file manager.

    DOMAIN_SCORE variable is your filepath.

    We run this because we do not want every time the game end and return to menu to run the saveinfo.php

    This php file look if a player compared by his uniqe id (uniqe id is the fb instant game id or whatever platfor you want) allredy exist.If its not exist it create a row in your database with (uniqe,name,pics,wins and loses)

    Notice that i delete the first and last line (<php.....?>) because want let me insert it.

    saveinfo.php

    header('Access-Control-Allow-Origin: *');

    $servername = "localhost";

    $username = "***********";

    $password = "**************";

    $dbname = "*************";

    // Create connection

    $conn = new mysqli($servername, $username, $password, $dbname);

    $name = strip_tags(mysqli_real_escape_string($conn, $_GET['name']));

    $uniqe = strip_tags(mysqli_real_escape_string($conn, $_GET['uniqe']));

    $pics = strip_tags(mysqli_real_escape_string($conn, $_GET['pics']));

    $win = strip_tags(mysqli_real_escape_string($conn, $_GET['win']));

    $lose = strip_tags(mysqli_real_escape_string($conn, $_GET['lose']));

    // Check connection

    if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);

    }

    $sql = "SELECT id, name, uniqe, pics FROM scores WHERE uniqe='$uniqe'";

    $result = $conn->query($sql);

    if ($result->num_rows > 0) {

    // output data of each row

    while($row = $result->fetch_assoc()) {

    echo "id: " . $row["id"]. "uniqe: " . $row["uniqe"]. "pics: " . $row["pics"]. " - Name: " . $row["name"]. " " . "<br>";

    $sql =mysqli_query($conn, "UPDATE scores SET pics='$pics' WHERE uniqe='$uniqe'");

    }

    } else {

    echo "0 results";

    $sql = mysqli_query($conn, "INSERT INTO scores (name, uniqe, pics)

    VALUES ('$name','$uniqe','$pics');" );

    }

    $conn->close();

    On AJAX request "PostScore" complete we run this action

    This will retrieve a number of entries you want.

    getscores.php

    header('Access-Control-Allow-Origin: *');

    include 'login.php';

    // Connect to server and select database.

    $con = mysqli_connect($host, $db_username, $db_password, $db_name);

    // Retrieve data from database

    $sql = "SELECT *

    FROM scores

    ORDER BY score DESC

    LIMIT 100000000"; // The 'LIMIT 100000000' part will only read 100 scores. Feel free to change this value

    $result = mysqli_query($con, $sql);

    // Start looping rows in mysql database.

    while($rows = mysqli_fetch_array($result)){

    echo $rows['name'] ." ". $rows['score'] ." ". $rows['pics'] ." ". $rows['uniqe'] ." ". $rows['lose'] ." ". $rows['win'] . "|";

    }

    // close MySQL connection

    mysqli_close($con);

    You notice include 'login.php';

    Its a file that you create also in your file manager so no need every time to enter your informations.

    login.php

    header('Access-Control-Allow-Origin: *');

    $host = "localhost"; // Host name

    $db_username = "***********"; // Mysql username

    $db_password = "***********"; // Mysql password

    $db_name = "**************"; // Database name

    $db_table = "*********"; // Table name

    After you retreive the AJAX "getscores" request save the information to an array and run this action.

    ran.php file will retreive your inforamtion

    header('Access-Control-Allow-Origin: *');

    $servername = "localhost";

    $username = "***********";

    $password = "****************";

    $dbname = "****************";

    $mysqli = new mysqli($servername, $username, $password, $dbname);

    $uniqe = strip_tags(mysqli_real_escape_string($mysqli, $_GET['uniqe']));

    if( $result = $mysqli->query( "SELECT * FROM scores WHERE uniqe ='".$uniqe."'") )

    {

    while( $row = $result->fetch_assoc() ) {

    echo $row["name"]." ".$row["score"]." ".$row["win"]." ".$row["lose"]." ".$row["pics"]." ".$row["emo1"]." ".$row["emo2"]." ".$row["emo3"]." ".$row["spells"]." ". "<br>";

    }

    }

    After that you need to run this action

    This will run the rank1 php file and this file will rank all the players.

    header('Access-Control-Allow-Origin: *');

    $servername = "localhost";

    $username = "*************";

    $password = "*************";

    $dbname = "*************";

    $mysqli = new mysqli($servername, $username, $password, $dbname);

    $uniqe = strip_tags(mysqli_real_escape_string($mysqli, $_GET['uniqe']));

    $sql3 = $mysqli->query("SELECT * FROM scores ORDER BY score DESC") or die("Could not allocate information!");

    $rank = 0;

    while($row = mysqli_fetch_assoc($sql3)) {

    $rank++;

    if ($row['uniqe'] == $uniqe){

    echo $rank;

    }

    }

    The only think now is to send the score to the database.

    We run this action

    And the savewin php file is

    header('Access-Control-Allow-Origin: *');

    $servername = "localhost";

    $username = "*************";

    $password = "***************";

    $dbname = "***************";

    // Create connection

    $conn = new mysqli($servername, $username, $password, $dbname);

    $name = strip_tags(mysqli_real_escape_string($conn, $_GET['name']));

    $uniqe = strip_tags(mysqli_real_escape_string($conn, $_GET['uniqe']));

    $win = strip_tags(mysqli_real_escape_string($conn, $_GET['win']));

    $lose = strip_tags(mysqli_real_escape_string($conn, $_GET['lose']));

    // Check connection

    if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);

    }

    $sql = "SELECT id, name, score, uniqe FROM scores WHERE uniqe='$uniqe'";

    $result = $conn->query($sql);

    if ($result->num_rows > 0) {

    // output data of each row

    while($row = $result->fetch_assoc()) {

    echo "id: " . $row["id"]. "uniqe: " . $row["uniqe"]. " - Name: " . $row["name"]. " " . $row["win"]. " " . $row["lose"]. "<br>";

    $sql =mysqli_query($conn, "UPDATE scores SET win=win+'$win' WHERE uniqe='$uniqe'");

    $sql =mysqli_query($conn, "UPDATE scores SET lose='$lose'+lose WHERE uniqe='$uniqe'");

    $sql =mysqli_query($conn, "UPDATE scores SET score=(win/lose)*100 WHERE uniqe='$uniqe'");

    }

    } else {

    echo "0 results";

    $sql = mysqli_query($conn, "INSERT INTO scores (name, uniqe, win, lose)

    VALUES ('$name','$uniqe','$win','$lose');" );

    }

    $conn->close();

    Note that you maybe need to change the formula in the last php for sending the score.

    I forgot to mention , when is the first run , "firstrun = 0" run the actions and set the "firstrun to 1"

    When the players return to the menu and the firstrun = 1 just run the getscores php.