14.01.2017, 12:08
As stupid as it may sound, is it possible to convert an integer to a double value? Here is the code;
What this code is supposed to do is to calculate the BMI according to the data the player has provided. The issue is, as you may already have guessed boymetre returns an integer value(mostly 1 or 2 depending on the height the player has provided in cm). I am actually a C programmer and I tried to do it the way C does it;
But then I got this warning;
965th line is this;
My question is, is it possible to convert an integer value to a double or a float value, if so, how? Thanks in advance.
pawn Код:
new bki[MAX_PLAYERS];
new boymetre[MAX_PLAYERS];
new boycarpimi[MAX_PLAYERS];
boymetre[playerid] = pInfo[playerid][Boy] / 100;
boycarpimi[playerid] = boymetre[playerid] * boymetre[playerid];
bki[playerid] = pInfo[playerid][Kilo] / boycarpimi[playerid];
new kiloluluk[MAX_PLAYERS];
printf("%d",boymetre[playerid]);
printf("%d",boycarpimi[playerid]);
printf("%d",bki[playerid]);
if(bki[playerid] > 0.0 && bki[playerid] < 30.0) // obez degil
kiloluluk[playerid] = 0;
else if(bki[playerid] >= 30) // obez
kiloluluk[playerid] = 1;
pawn Код:
new bki[MAX_PLAYERS];
new boymetre[MAX_PLAYERS];
new boycarpimi[MAX_PLAYERS];
boymetre[playerid] = pInfo[playerid][Boy] / 100.0;
boycarpimi[playerid] = boymetre[playerid] * boymetre[playerid];
bki[playerid] = pInfo[playerid][Kilo] / boycarpimi[playerid];
new kiloluluk[MAX_PLAYERS];
printf("%d",boymetre[playerid]);
printf("%d",boycarpimi[playerid]);
printf("%d",bki[playerid]);
if(bki[playerid] > 0.0 && bki[playerid] < 30.0) // obez degil
kiloluluk[playerid] = 0;
else if(bki[playerid] >= 30) // obez
kiloluluk[playerid] = 1;
Код:
C:\Users\Asus\Desktop\Yigit proje 1\gamemodes\Survival_MySQL.pwn(965) : warning 213: tag mismatch
pawn Код:
boymetre[playerid] = pInfo[playerid][Boy] / 100.0;