İşte benim sorunum. Eğer daha yüksek bir seviyeye ilerlemek deneyimi belirli bir miktarda ulaşmıştır zamanlar benim oyunda ben nerede bu tesviye sistemi uygulamak çalışıyorum. Ben php 5.0 ve son MySQL kullanıyorum. Benim sorunum benim komut düzgün yürütmek için alınamıyor olmasıdır.
SO İşte benim kod ardından bazı kukla istatistikler benim sorunları çözmeye yardımcı olacak her türlü bilgi büyük takdir vardır
$playerNAME = "Bozo";
$playerClASS = "Warrior";
$playerLEVEL = 13;
$playerSTR = 5;
$playerDEF = 2;
$playerDEX = 3;
$playerMAG = 2;
$playerEXPERIENCE = 99999;
Ben 13 istatistikler hiçbiri yeni bir değer ve seviye dosnt güncelleme ile güncellenen 14 ila LevelUp giderken ... DB sunucuya connect.php gelen Evet benim tüm bağlantıların düzgün çalışıyor ve evet ben doğru kullanıyorum benim kod tablo isimleri
function levelUPSTATS () {
global $playerNAME;
global $playerClASS;
global $playerLEVEL;
global $playerSTR;
global $playerDEF;
global $playerDEX;
global $playerMAG;
if ($playerCLASS === "Warrior") {
$playerSTR = $playerSTR + 3;
$playerDEF = $playerDEF + 2;
$playerDEX = $playerDEX + 3;
$playerMAG = $playerMAG + 2;
$playerBASE_DAMAGE = ceil($playerSTR*$playerDEX);
$playerSPELL_BASE_DAMAGE = ceil($playerMAG * $playerDEX);
$playerMAX_HEALTH_POINTS = ceil($playerSTR * $playerDEF * $playerDEX);
$playerMAX_MANA_POINTS = ceil($playerMAG * $playerDEF * $playerDEX / $playerSTR);
$statusplayerSTR = "update players set strength=strength+'$playerSTR' where username='$playerNAME'";
mysql_query($statusplayerSTR) or die("Could not update player");
$statusplayerDEF = "update players set defence=defence+'$playerDEF' where username='$playerNAME'";
mysql_query($statusplayerDEF) or die("Could not update player");
$statusplayerDEX = "update players set dexterity=dexterity+'$playerDEX' where username='$playerNAME'";
mysql_query($statusplayerDEX) or die("Could not update player");
$statusplayerMAG = "update players set magic=magic+'$playerMAG' where username='$playerNAME'";
mysql_query($statusplayerMAG) or die("Could not update player");
$statusplayerBASE_DAMAGE = "update players set basedamage=basedamage+'$playerBASE_DAMAGE' where username='$playerNAME'";
mysql_query($statusplayerBASE_DAMAGE) or die("Could not update player");
$statusplayerSPELL_BASE_DAMAGE = "update players set spellbasedamage=spellbasedamage+'$playerSPELL_BASE_DAMAGE' where username='$playerNAME'";
mysql_query($statusplayerSPELL_BASE_DAMAGE) or die("Could not update player");
$statusplayerHealthPOINTS = "update players set healthpoints='$playerMAX_HEALTH_POINTS' where username='$playerNAME'";
mysql_query($statusplayerHealthPOINTS) or die("Could not update player");
$statusplayerMaxHealthPOINTS = "update players set maxhealthpoints='$playerMAX_HEALTH_POINTS' where username='$playerNAME'";
mysql_query($statusplayerMaxHealthPOINTS) or die("Could not update player");
$statusplayerManaPOINTS = "update players set manapoints='$playerMAX_MANA_POINTS' where username='$playerNAME'";
mysql_query($statusplayerManaPOINTS) or die("Could not update player");
$statusplayerMaxManaPOINTS = "update players set maxmanapoints='$playerMAX_MANA_POINTS' where username='$playerNAME'";
mysql_query($statusplayerMaxManaPOINTS) or die("Could not update player");
} elseif ($playerCLASS === "Mage") {
$playerSTR = $playerSTR + 2;
$playerDEF = $playerDEF + 2;
$playerDEX = $playerDEX + 3;
$playerMAG = $playerMAG + 3;
$playerBASE_DAMAGE = ceil($playerSTR * $playerDEF);
$playerSPELL_BASE_DAMAGE = ceil($playerMAG * $playerDEX);
$playerMAX_HEALTH_POINTS = ceil($playerDEF * $playerDEX * $playerMAG);
$playerMAX_MANA_POINTS = ceil($playerMAG * $playerDEF * $playerDEX / $playerSTR);
} else {
}
}
if ($playerEXPERIENCE < 100) {
if (!$playerLEVEL ==1) {
$playerLEVEL = 1;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 100;
}
} elseif ($playerEXPERIENCE >= 100 && $playerEXPERIENCE <= 200) {
if (!$playerLEVEL ==2) {
levelUPSTATS ();
$playerLEVEL = 2;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 200;
}
} elseif ($playerEXPERIENCE >= 200 && $playerEXPERIENCE <= 400) {
if (!$playerLEVEL ==3) {
levelUPSTATS ();
$playerLEVEL = 3;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 400;
}
} elseif ($playerEXPERIENCE >= 400 && $playerEXPERIENCE <= 800) {
if (!$playerLEVEL ==4) {
levelUPSTATS ();
$playerLEVEL = 4;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 800;
}
} elseif ($playerEXPERIENCE >= 800 && $playerEXPERIENCE <= 1600) {
if (!$playerLEVEL ==5) {
levelUPSTATS ();
$playerLEVEL = 5;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 1600;
}
} elseif ($playerEXPERIENCE >= 1600 && $playerEXPERIENCE <= 3200) {
if (!$playerLEVEL ==6) {
levelUPSTATS ();
$playerLEVEL = 6;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 3200;
}
} elseif ($playerEXPERIENCE >= 3200 && $playerEXPERIENCE <= 6400) {
if (!$playerLEVEL ==7) {
levelUPSTATS ();
$playerLEVEL = 7;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 6400;
}
} elseif ($playerEXPERIENCE >= 6400 && $playerEXPERIENCE <= 12800) {
if (!$playerLEVEL ==8) {
levelUPSTATS ();
$playerLEVEL = 8;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 12800;
}
} elseif ($playerEXPERIENCE >= 12800 && $playerEXPERIENCE <= 25000) {
if (!$playerLEVEL ==9) {
levelUPSTATS ();
$playerLEVEL = 9;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 25000;
}
} elseif ($playerEXPERIENCE >= 25000 && $playerEXPERIENCE <= 35000) {
if (!$playerLEVEL ==10) {
levelUPSTATS ();
$playerLEVEL = 10;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 35000;
}
} elseif ($playerEXPERIENCE >= 35000 && $playerEXPERIENCE <= 50000) {
if (!$playerLEVEL ==11) {
levelUPSTATS ();
$playerLEVEL = 11;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 50000;
}
} elseif ($playerEXPERIENCE >= 50000 && $playerEXPERIENCE <= 75000) {
if (!$playerLEVEL ==12) {
levelUPSTATS ();
$playerLEVEL = 12;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 75000;
}
} elseif ($playerEXPERIENCE >= 75000 && $playerEXPERIENCE <= 100000) {
if (!$playerLEVEL ==13) {
levelUPSTATS ();
$playerLEVEL = 13;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 100000;
}
} elseif ($playerEXPERIENCE >= 100000 && $playerEXPERIENCE <= 135000) {
if (!$playerLEVEL == 14) {
levelUPSTATS ();
$playerLEVEL = 14;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 135000;
}
} elseif ($playerEXPERIENCE >= 135000 && $playerEXPERIENCE <= 200000) {
if (!$playerLEVEL ==15) {
levelUPSTATS ();
$playerLEVEL = 15;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 200000;
}
} elseif ($playerEXPERIENCE >= 200000 && $playerEXPERIENCE <= 300000) {
if (!$playerLEVEL ==16) {
levelUPSTATS ();
$playerLEVEL = 16;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 300000;
}
} elseif ($playerEXPERIENCE >= 300000 && $playerEXPERIENCE <= 420000) {
if (!$playerLEVEL ==17) {
levelUPSTATS ();
$playerLEVEL = 17;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 420000;
}
} elseif ($playerEXPERIENCE >= 420000 && $playerEXPERIENCE <= 600000) {
if (!$playerLEVEL ==18) {
levelUPSTATS ();
$playerLEVEL = 18;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 600000;
}
} elseif ($playerEXPERIENCE >= 600000 && $playerEXPERIENCE <= 800000) {
if (!$playerLEVEL ==19) {
levelUPSTATS ();
$playerLEVEL = 19;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 800000;
}
} elseif ($playerEXPERIENCE >= 800000 && $playerEXPERIENCE <= 1000000) {
if (!$playerLEVEL ==20) {
levelUPSTATS ();
$playerLEVEL = 20;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
} else {
$playerNEXT_LEVEL = 1000000;
}
} elseif ($playerEXPERIENCE >= 1000000) {
if (!$playerLEVEL ==21) {
levelUPSTATS ();
$playerLEVEL = 21;
$statusplayerLEVELUPDATE = "update players set level='$playerLEVEL' where username='$playerNAME'";
mysql_query($statusplayerLEVELUPDATE ) or die("Could not update player");
}
} else {
print "N/A";
}
Sorun şu ki, herhangi bir hata iletisi görüntüler olmasıdır.
Bu alışkanlık düzeyi güncelleme düzgün çalışmıyor istatistiklerini güncellemek.