Ogólnie to powinno to działać tak że skrpyt jsa prosi drugi skrypt jsa aby ładnie obliczył mu punkty na podstawie tagu i jsona, i owszem robi to dobrze ale potem nie wiem dlaczego tak jakby wykonuje ten skrypt jescze raz ten co liczy) i wtedy dane nie są już prawidłowe
console.log("sending request for: " + player.tag);
const pointscount = GetPointsCount(player.tag,data);
console.log("respond: " + pointscount + " for: " + player.tag);
console.log("");
function GetPointsCount(playerTag, clanJSON)
{
console.log("recived request for : " + playerTag);
clanJSON.members.forEach(playerLoop => {
if(playerLoop.tag == playerTag)
{
console.log("request succesfull found entery (" + playerLoop.trophies / 100 + ") for: " + playerTag);
return playerLoop.trophies / 100;
}
});
console.log("request unsuccesfull not found entery for: " + playerTag);
return -1;
}
sending request for: 8CCRUUGRU
recived request for : 8CCRUUGRU
request succesfull found entery (40.87) for: 8CCRUUGRU
request unsuccesfull not found entery for: 8CCRUUGRU
respond: -1 for: 8CCRUUGRU