Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEventHandler("doEAGetUmfragenAuswertungBack", getLocalPlayer(), function(result)
- -- AUSWERTUNG --
- -- Label[10]
- -- 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
- -- Label[11]
- -- 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
- local az = {}
- local stimmen = 0
- local teilnehmer = 0
- for i = 1, 14, 1 do
- az['A'..i] = 0
- end
- for index, row in pairs(result) do
- teilnehmer = teilnehmer+1
- for index2, wert in pairs(row) do
- if(index2 ~= "NAME") and (index2 ~= "UMFRAGENID") then
- az[index2] = az[index2]+wert
- end
- end
- end
- for i = 1, 14, 1 do
- stimmen = stimmen+az['A'..i]
- end
- 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")
- 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")
- guiSetText(Label[13], "Es wurden insgesammt "..teilnehmer.." Teilnehmer gezaehlt.")
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement