Advertisement
Noneatme

Untitled

Sep 15th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. addEventHandler("doEAGetUmfragenAuswertungBack", getLocalPlayer(), function(result)
  2.     -- AUSWERTUNG --
  3.     -- Label[10]
  4.     -- 1: 0%(0 Stimmen)\n2: 0%(0 Stimmen)\n3: 0%(0 Stimmen)\n4: 0%(0 Stimmen)\n5: 0%(0 Stimmen)\n6: 0%(0 Stimmen)\n7: 0%(0 Stimmen)\n
  5.     -- Label[11]
  6.     -- 8: 0%(0 Stimmen)\n9: 0%(0 Stimmen)\n10: 0%(0 Stimmen)\n11: 0%(0 Stimmen)\n12: 0%(0 Stimmen)\n13: 0%(0 Stimmen)\n14: 0%(0 Stimmen)\n
  7.     local az = {}
  8.     local stimmen = 0
  9.     local teilnehmer = 0
  10.     for i = 1, 14, 1 do
  11.         az['A'..i] = 0
  12.     end
  13.     for index, row in pairs(result) do
  14.         teilnehmer = teilnehmer+1
  15.         for index2, wert in pairs(row) do
  16.             if(index2 ~= "NAME") and (index2 ~= "UMFRAGENID") then
  17.                 az[index2] = az[index2]+wert
  18.             end
  19.         end
  20.     end
  21.     for i = 1, 14, 1 do
  22.         stimmen = stimmen+az['A'..i]
  23.     end
  24.     guiSetText(Label[10], "1: "..math.floor((az['A1']*100)/(stimmen)).."%("..az['A1'].." Stimmen)\n2: "..math.floor((az['A2']*100)/(stimmen)).."%("..az['A2'].." Stimmen)\n3: "..math.floor((az['A3']*100)/(stimmen)).."%("..az['A3'].." Stimmen)\n4: "..math.floor((az['A4']*100)/(stimmen)).."%("..az['A4'].." Stimmen)\n5: "..math.floor((az['A5']*100)/(stimmen)).."%("..az['A5'].." Stimmen)\n6: "..math.floor((az['A6']*100)/(stimmen)).."%("..az['A6'].." Stimmen)\n7: "..math.floor((az['A7']*100)/(stimmen)).."%("..az['A7'].." Stimmen)\n")
  25.     guiSetText(Label[11], "8: "..math.floor((az['A8']*100)/(stimmen)).."%("..az['A8'].." Stimmen)\n9: "..math.floor((az['A9']*100)/(stimmen)).."%("..az['A9'].." Stimmen)\n10: "..math.floor((az['A10']*100)/(stimmen)).."%("..az['A10'].." Stimmen)\n11: "..math.floor((az['A11']*100)/(stimmen)).."%("..az['A11'].." Stimmen)\n12: "..math.floor((az['A12']*100)/(stimmen)).."%("..az['A12'].." Stimmen)\n13: "..math.floor((az['A13']*100)/(stimmen)).."%("..az['A13'].." Stimmen)\n14: "..math.floor((az['A14']*100)/(stimmen)).."%("..az['A14'].." Stimmen)\n")
  26.     guiSetText(Label[13], "Es wurden insgesammt "..teilnehmer.." Teilnehmer gezaehlt.")
  27. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement