14.01.2017, 13:20
Hello it's me again with an odd bug;
This is the code, sorry if pawn tags ruined the indentation. Everything works fine, bki, boymetre and boycarpimi are acquired just like it should be acquired but obezite variable can't be changed regardless of what I've tried. So far I've tried;
- Commenting both if statements and just writing "obezite[playerid] = 1;"
- Renaming the variable to whole another variable to see if it was getting a standard value from somewhere in the script
- Printing out everything this function calculates to see if anything else was bugged.
It's the obezite variable that is bugged, I am certain of it at this point. No matter what I do, it's value is always 0, furthermore, it's not a standard zero as the code gives skins based on obezite variable and it doesn't work, but it works when I comment the obezite check. It's kind of odd. I've wasted an hour trying to figure out what was wrong, I hope it is not something easy that I've been missing for the past hour lol
Edit: This is the whole function;
pawn Код:
new Float:bki[MAX_PLAYERS];
new Float:boymetre[MAX_PLAYERS];
new Float:boycarpimi[MAX_PLAYERS];
boymetre[playerid] = pInfo[playerid][Boy] / 100;
boycarpimi[playerid] = boymetre[playerid] * boymetre[playerid];
bki[playerid] = pInfo[playerid][Kilo] / boycarpimi[playerid];
new obezite[MAX_PLAYERS];
if(bki[playerid] < 30.0) // obez degil
obezite[playerid] = 0;
else if(bki[playerid] >= 30.0) // obez
obezite[playerid] = 1;
- Commenting both if statements and just writing "obezite[playerid] = 1;"
- Renaming the variable to whole another variable to see if it was getting a standard value from somewhere in the script
- Printing out everything this function calculates to see if anything else was bugged.
It's the obezite variable that is bugged, I am certain of it at this point. No matter what I do, it's value is always 0, furthermore, it's not a standard zero as the code gives skins based on obezite variable and it doesn't work, but it works when I comment the obezite check. It's kind of odd. I've wasted an hour trying to figure out what was wrong, I hope it is not something easy that I've been missing for the past hour lol
Edit: This is the whole function;
pawn Код:
stock SkinAlgoritma(playerid)
{
new Float:bki[MAX_PLAYERS];
new Float:boymetre[MAX_PLAYERS];
new Float:boycarpimi[MAX_PLAYERS];
boymetre[playerid] = pInfo[playerid][Boy] / 100;
boycarpimi[playerid] = boymetre[playerid] * boymetre[playerid];
bki[playerid] = pInfo[playerid][Kilo] / boycarpimi[playerid];
new obezite[MAX_PLAYERS];
if(bki[playerid] < 30.0) // obez degil
obezite[playerid] = 0;
if(bki[playerid] >= 30.0) // obez
obezite[playerid] = 0;
if(obezite[playerid] = 0) // oyuncu obez degilse
{
if(pInfo[playerid][Cinsiyet] == 0) // oyuncu erkekse
{
if(pInfo[playerid][TenRengi] == 0) // oyuncu beyazsa
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 23);
else // oyuncu yasliysa
SetPlayerSkin(playerid, 235);
}
else if(pInfo[playerid][TenRengi] == 1) // oyuncu siyahiyse
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 7);
else
SetPlayerSkin(playerid, 6);
}
}
else if(pInfo[playerid][Cinsiyet] == 1) // oyuncu bayansa
{
if(pInfo[playerid][TenRengi] == 0) // oyuncu beyazsa
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 93);
else // oyuncu yasliysa
SetPlayerSkin(playerid, 224);
}
else if(pInfo[playerid][TenRengi] == 1) // oyuncu siyahiyse
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 190);
else
SetPlayerSkin(playerid, 76);
}
}
}
if(obezite[playerid] == 1) // oyuncu obezse
{
if(pInfo[playerid][Cinsiyet] == 0) // oyuncu erkekse
{
if(pInfo[playerid][TenRengi] == 0) // oyuncu beyazsa
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 242);
else // oyuncu yasliysa
SetPlayerSkin(playerid, 258);
}
else if(pInfo[playerid][TenRengi] == 1) // oyuncu siyahiyse
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 5);
else
SetPlayerSkin(playerid, 220);
}
}
else if(pInfo[playerid][Cinsiyet] == 1) // oyuncu bayansa
{
if(pInfo[playerid][TenRengi] == 0) // oyuncu beyazsa
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 151);
else // oyuncu yasliysa
SetPlayerSkin(playerid, 39);
}
else if(pInfo[playerid][TenRengi] == 1) // oyuncu siyahiyse
{
if(pInfo[playerid][Yas] < 50) // oyuncu genзse
SetPlayerSkin(playerid, 219);
else
SetPlayerSkin(playerid, 10);
}
}
}
ShowPlayerDialog(playerid, DIALOG_DOGRULAMA, DIALOG_STYLE_MSGBOX, "{0174DF}[T-RP]: {FFFFFF}Dogrulama", "{FFFFFF}Olusturdugunuz karakterle devam etmek istiyor musunuz?\nUnutmayin; istediginiz zaman karakterinizin goruntusunu degistirebilirsiniz, bu sadece gecici bir karakter!","Devam","Geri Don");
printf("%d",obezite[playerid]);
return 1;
}