Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. uint32_t accuracy = 0;
  2. uint32_t hit = player->getStats(STATS_SD_HIT);
  3. uint32_t miss = player->getStats(STATS_SD_MISS);
  4. if (hit != 0 && miss == 0) {
  5. accuracy = 100;
  6. } else if (hit == 0 && miss == 0) {
  7. accuracy = 0;
  8. } else if (hit == 0) {
  9. accuracy = 0;
  10. } else {
  11. float v = (float)hit / ((float)hit + (float)miss) * 100.00;
  12. accuracy = uint32_t(v);
  13. }
  14.  
  15. function hitrate(cid, hit, miss)
  16. if hit ~= 0 and miss == 0 then
  17. return 100
  18. elseif hit == 0 and miss == 0 then
  19. return 0
  20. elseif hit == 0 then
  21. return 0
  22. else
  23. return roundNumber(hit / (hit + miss), 2) * 100
  24. end
  25. return 0
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement