TheBlackParrot

Untitled

Jan 2nd, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. function averageping(%t){
  2. schedule(0,0,$pinginuse = 1);
  3. schedule(0,0,$ping1 = %t.getPing());
  4. schedule(250,0,$ping2 = %t.getPing());
  5. schedule(500,0,$ping3 = %t.getPing());
  6. schedule(750,0,$ping4 = %t.getPing());
  7. schedule(1000,0,$ping5 = %t.getPing());
  8. schedule(1250,0,$ping6 = %t.getPing());
  9. schedule(1500,0,$ping7 = %t.getPing());
  10. schedule(1750,0,$ping8 = %t.getPing());
  11. schedule(2000,0,$ping9 = %t.getPing());
  12. schedule(2250,0,$ping10 = %t.getPing());
  13. schedule(2500,0,$ping11 = %t.getPing());
  14. schedule(2750,0,$ping12 = %t.getPing());
  15. $theping = $ping1 + $ping2 + $ping3 + $ping4 + $ping5 + $ping6 + $ping7 + $ping8 + $ping9 + $ping10 + $ping11 + $ping12 / 12;
  16. schedule(3000,0,$pinginuse = 0);
  17. }
  18.  
  19. function pingmessage(%c){
  20. messageClient(%c,'',"\c4" @ fcbn(%t).name @ "'s \c6ping is \c3about " @ $theping @ ".");
  21. }
  22.  
  23. Show's the player's ping.
  24. function servercmdping(%c,%t){
  25. if(isObject(fcbn(%t).player) && $pinginuse == 0){
  26. averageping(fcbn(%t));
  27. messageClient(%c,'',"Please wait, gathering ping average...");
  28. schedule(3000,0,pingmessage(%c));
  29. echo(%c.name @ " wanted to know what " @ fcbn(%t).name @ "'s ping was.");
  30. }
  31. if(!isObject(fcbn(%t).player)){
  32. messageClient(%c,'',"This player doesn't exist!");
  33. }
  34. if($pinginuse == 1){
  35. messageclient(%c,'',"Someone else is using /ping, please wait.");
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment