Hi there,
I actualy don't understand what happens in the code...
I made some minor changes in Mandingo bot to attribute ranks to players. That way, a player who has killed 5 persons in a row is ranked as Trooper, 10 in a row as Captain ans so on...
This works perfectly for this part, but i also decided to remove the rank when the ranked player dies. So i made the second part with the following code:
| Code: |
# Buffer
$kiar = $urtodatabase->getPlayerValue($hitteduid, 'KillingsInARow');
$adviseType = 'none';
# General Rank
if(($kiar ge $urtodatabase->getIpcValue('numgen')) && ($urtodatabase->getIpcValue('numgen') ne 0))
{
# DEBUG
printf("%s was general with %s killings in a row when he died", $urtodatabase->get_coloredPlayerName($hitteduid), $kiar);
...
}
# Captain Rank
elsif(($kiar ge $urtodatabase->getIpcValue('numcap')) && ($urtodatabase->getIpcValue('numcap') ne 0))
{
# DEBUG
printf("%s was captain with %s killings in a row when he died", $urtodatabase->get_coloredPlayerName($hitteduid), $kiar);
...
}
# Trooper Rank
elsif(($kspree ge $urtodatabase->getIpcValue('numtro')) && ($urtodatabase->getIpcValue('numtro') ne 0))
{
# DEBUG
printf("%s was trooper with %s killings in a row when he died", $urtodatabase->get_coloredPlayerName($hitteduid), $kiar);
...
}
# Send To Server
if (($urtodatabase->getIpcValue('canitalk') eq "yes") && ($adviseType ne 'none'))
{
# DEBUG
printf(" (numtro = %s numcap = %s numgen = %s)\n", $urtodatabase->getIpcValue('numtro'), $urtodatabase->getIpcValue('numcap'), $urtodatabase->getIpcValue('numgen'));
...
}
|
I only left the "printf" commands here but there is a bit more of code in each conditions (the interaction with the serveur) but the "bug" cannot come from these lines...
Then i ran the bot and killed 5 guys in a row so i reached the Trooper rank as wanted. The result in the terminal was:
| Code: |
Slander is now trooper with 5 killings in a row (numtro = 5 numcap = 10 numgen = 15)
|
After that i let my character killed by another guy but this time the code doesn't worked ! The result in the terminal was:
| Code: |
Slander was general with 5 killings in a row when he died (numtro = 5 numcap = 10 numgen = 15)
|
As you can see, $kiar is 5 but the first condition is triggered !
It is impossible ! 5 cannot be greater or equal to 15 ! Does anyone have an idea ?
I ommit to precise that this code works perfectly for the others ranks (those greater than Trooper). If the killed guy was Captain the 2nd condition is triggered and for the other ranks after it works too... But the "bug" occurs only with the first rank...
I don't understand what happens... If someone have an idea...
Anyway, have a good day,
Slander