playMaker

Author Topic: Help script addScore  (Read 1516 times)

nabilfx

  • Full Member
  • ***
  • Posts: 186
Help script addScore
« on: November 17, 2015, 02:17:10 PM »
Im using this script with iphone, but sometimes it work and sometimes does not work.
The script is for add int score to my database in mysql. What could be the problem?

I put the Int value result of the game, in this way.
the score_GLOBAL is a float result then i convert into a Int, and insert in the java script, here the script.

Quote
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class AddScore : MonoBehaviour {
   
   void Start(){
      AddPScore (0);
   }
   void AddPScore(int storeResult){
      WWWForm form = new WWWForm ();
      form.AddField ("user", LoginSystem.userName);
      form.AddField ("score", storeResult);
      WWW w = new WWW ("http://nfx.comuv.com/AddScore.php",form);
      StartCoroutine (receive (w));
      Debug.Log("funcionou");
   }
   IEnumerator receive(WWW w){
      yield return w;
      if (w.error == null) {
      }
   }
   
}

I need to work everytime, not sometimes.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Help script addScore
« Reply #1 on: January 17, 2016, 06:54:57 PM »
Did you ever solve the problem? I am trying to post to php and having problems with WWW post mobile action.. Any feedback or recommendations?