Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint32_t accuracy = 0;
- uint32_t hit = player->getStats(STATS_SD_HIT);
- uint32_t miss = player->getStats(STATS_SD_MISS);
- if (hit != 0 && miss == 0) {
- accuracy = 100;
- } else if (hit == 0 && miss == 0) {
- accuracy = 0;
- } else if (hit == 0) {
- accuracy = 0;
- } else {
- float v = (float)hit / ((float)hit + (float)miss) * 100.00;
- accuracy = uint32_t(v);
- }
- function hitrate(cid, hit, miss)
- if hit ~= 0 and miss == 0 then
- return 100
- elseif hit == 0 and miss == 0 then
- return 0
- elseif hit == 0 then
- return 0
- else
- return roundNumber(hit / (hit + miss), 2) * 100
- end
- return 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement