Advertisement
Guest User

Untitled

a guest
Jul 27th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. --get winratio for each player
  2. --don't run this before you join a game or you'll flood
  3. add_hook("console","console", chat)
  4. add_hook("draw2d","draw2d", draw)
  5. add_hook("match_begin","new match", newmatch)
  6.  
  7. toriStatus=""
  8. tSent=0
  9. uSent=0
  10. toriWR=0
  11. ukeWR=0
  12. winRatio=0
  13. tori = "isaac"
  14. uke = "isaac"
  15.  
  16. --just shows the current variables at the top right. Mostly debugging right now
  17. function draw()
  18.     --echo("Tori and Uke: ")
  19.     --echo(tori)
  20.     --echo(uke)
  21.     set_color(1, 0, 0, 1);
  22.  
  23.     draw_right_text("tori: "..tori.." uke: "..uke.." TWR: "..toriWR.."UWR: "..ukeWR.." tSent: "..tSent.."uSent: "..uSent.."toriStatus: "..toriStatus, 250, 50);
  24.    
  25. end
  26. --set everything to 0 and get the names of the players
  27. function newmatch()
  28.     toriWR=0
  29.     ukeWR=0
  30.     winRatio=0
  31.     tSent=0
  32.     uSent=0
  33.     toriStatus=""
  34.     tori = get_player_info(0).name
  35.     uke = get_player_info(1).name
  36.     echo("Tori: "..tori.." Uke: "..uke)
  37. end
  38. function chat(text, type)
  39.     --if it finds Ratio in the chat
  40.     if string.find(text,"Ratio: ") then
  41.    
  42.         --get a sub string and convert it to a number
  43.         i, j = string.find(text, "Ratio: ")
  44.         winRatio = tonumber(string.sub(text,j+1,j+2))
  45.         --if the status was for tori or for uke
  46.         if toriStatus=="u" then
  47.             ukeWR=winRatio
  48.         elseif toriStatus=="t" then
  49.             toriWR=winRatio
  50.         end
  51.         echo("ToriWR: "..toriWR.."UkeWR: "..ukeWR)
  52.     else
  53.         --echo("not found")
  54.     end
  55.    
  56.     --if there's no tori or uke status then do /stats for them one at a time.
  57.     if tSent==0 then
  58.         tSent=1
  59.         toriStatus="t"
  60.         run_cmd("cp \nstats "..tori)
  61.     elseif uSent==0 and toriWR>0 then
  62.         uSent=1
  63.         toriStatus="u"
  64.         run_cmd("cp \nstats "..uke)
  65.     end
  66.  
  67.    
  68.     --echo("ToriWR: "..toriWR.."UkeWR: "..ukeWR)
  69.     --echo("Tsent: "..tSent.." uSent: "..uSent)
  70. end
  71.  
  72. echo("hello!!!?")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement