Post by Java on May 10, 2014 12:47:37 GMT 5.5
I'm need help on my lua i'm make this for RR // FUN it will make F4 more FUN! This lua have vote map,vote kick,vote ban,vote mute.
It Some one khow how to make lua plz check this and fixed it for me i'm need to go to shool all day i'm busy so Pla help on
====Here Is The Lua Code====
function array(v,ez,mz)
local tbl = {}
if not v then v = 0 end
if not ez then ez = 32 end
if not mz then mz = 1 end
for i = mz,ez do
tbl = v
end
return tbl
end
sell = array()
num = num or {}
did = did or {}
for i = 1,4 do num = array() end
for i = 1,32 do
for is = 1,4 do
did[is] = did[is] or {}
did[is] = array(false)
end
end
mute = array(false)
mute_time = array(1)
pln = array("")
addhook([[join]],[[joiner]])
function joiner(id)
sell[id] = 0
mute_time[id] = 1
mute[id] = false
num[1][id] = 0
num[2][id] = 0
num[3][id] = 0
num[4][id] = 0
for i = 1,32 do for is = 1,4 do did[is][id] = false end end
end
addhook([[serveraction]],[[sa]])
function sa(id,a)
if a == 3 then
menu(id,[[Vote,Vote Mute,Vote Kill,Vote Kick,Vote Ban]])
end
end
function names()
for id = 1,32 do
if player(id,"exists") then
pln[id] = player(id,"name")
else
pln[id] = ""
end
end
end
function pl_1(id)
names()
menu(id,[[Players 1@b,]]..pln[1]..[[,]]..pln[2]..[[,]]..pln[3]..[[,]]..pln[4]..[[,]]..pln[5]..[[,]]..pln[6]..[[,]]..pln[7]..[[,,Next]])
end
function pl_2(id)
names()
menu(id,[[Players 2@b,]]..pln[8]..[[,]]..pln[9]..[[,]]..pln[10]..[[,]]..pln[11]..[[,]]..pln[12]..[[,]]..pln[13]..[[,]]..pln[14]..[[,Back,Next]])
end
function pl_3(id)
names()
menu(id,[[Players 3@b,]]..pln[15]..[[,]]..pln[16]..[[,]]..pln[17]..[[,]]..pln[18]..[[,]]..pln[19]..[[,]]..pln[20]..[[,]]..pln[21]..[[,Back,Next]])
end
function pl_4(id)
names()
menu(id,[[Players 4@b,]]..pln[22]..[[,]]..pln[23]..[[,]]..pln[24]..[[,]]..pln[25]..[[,]]..pln[26]..[[,]]..pln[27]..[[,]]..pln[28]..[[,Back,Next]])
end
function pl_5(id)
names()
menu(id,[[Players 5@b,]]..pln[29]..[[,]]..pln[30]..[[,]]..pln[31]..[[,]]..pln[32]..[[,,,,Back]])
end
function fun(n)
if n == 1 then
return 1,7,0
elseif n == 2 then
return 8,14,-7
elseif n == 3 then
return 15,21,-14
elseif n == 4 then
return 22,28,-21
elseif n == 5 then
return 29,32,-28
end
end
function pll(id,n)
if n == 1 then pl_1(id)
elseif n == 2 then pl_1(id)
elseif n == 3 then pl_2(id)
elseif n == 4 then pl_3(id)
elseif n == 5 then pl_4(id)
end
end
function pll2(id,n)
if n == 1 then pl_2(id)
elseif n == 2 then pl_3(id)
elseif n == 3 then pl_4(id)
elseif n == 4 then pl_5(id)
elseif n == 5 then pl_5(id)
end
end
function plrt()
if #player(0,"table")/3 >= 3 then
return math.ceil(#player(0,"table")/3)
else
return 3
end
end
addhook([[menu]],[[menuer]])
function menuer(id,men,sel)
if men == [[Vote]] then
for i = 1,4 do
if sel == i then
sell[id] = i
pl_1(id)
end
end
end
for plni = 1,5 do
if men == [[Players ]]..plni then
local bla,blu,bll,zu = fun(plni)
for pl = bla,blu do
if sel == pl - bll then
local sel = sell[id]
if sel == 1 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to mute ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
mute[pl] = true
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
mute[pl] = true
num[sel][pl] = 0
end
end
elseif sel == 2 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to kill ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
parse([[killplayer ]]..pl)
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
parse([[killplayer ]]..pl)
num[sel][pl] = 0
end
end
elseif sel == 3 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to kick ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
parse([[kick ]]..pl)
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
parse([[kick ]]..pl)
num[sel][pl] = 0
end
end
elseif sel == 4 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to ban ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
parse([[banname ]]..pl)
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
parse([[banname ]]..pl)
num[sel][pl] = 0
end
end
end
end
end
if sel == 8 then
pll(id,plni)
elseif sel == 9 then
pll2(id,plni)
end
end
end
end
addhook([[say]],[[sayer]])
function sayer(id,txt)
if mute[id] == true then
return 1
end
if txt == [[vote]] then
menu(id,[[Vote,Vote Mute,Vote Kill,Vote Kick,Vote Ban]])
return 1
elseif txt == [[votemute]] then
sell[id] = 1
pl_1(id)
return 1
elseif txt == [[votekill]] then
sell[id] = 2
pl_1(id)
return 1
elseif txt == [[votekick]] then
sell[id] = 3
pl_1(id)
return 1
elseif txt == [[voteban]] then
sell[id] = 4
pl_1(id)
return 1
end
end
addhook([[minute]],[[minuter]])
function minuter()
for _,id in pairs(player(0,"table")) do
if mute[id] = true then
if mute_time[id] = 3 then
mute[id] = false
mute_time[id] = 1
end
mute_time[id] = mute_time[id] + 1
end
end
end
====END of LUA code===
Plz help me!
All So i'm Got a Error like this: >LUA ERROR: sys/lua/vote1.lua:242: 'then' expected near '='<
It Some one khow how to make lua plz check this and fixed it for me i'm need to go to shool all day i'm busy so Pla help on
====Here Is The Lua Code====
function array(v,ez,mz)
local tbl = {}
if not v then v = 0 end
if not ez then ez = 32 end
if not mz then mz = 1 end
for i = mz,ez do
tbl = v
end
return tbl
end
sell = array()
num = num or {}
did = did or {}
for i = 1,4 do num = array() end
for i = 1,32 do
for is = 1,4 do
did[is] = did[is] or {}
did[is] = array(false)
end
end
mute = array(false)
mute_time = array(1)
pln = array("")
addhook([[join]],[[joiner]])
function joiner(id)
sell[id] = 0
mute_time[id] = 1
mute[id] = false
num[1][id] = 0
num[2][id] = 0
num[3][id] = 0
num[4][id] = 0
for i = 1,32 do for is = 1,4 do did[is][id] = false end end
end
addhook([[serveraction]],[[sa]])
function sa(id,a)
if a == 3 then
menu(id,[[Vote,Vote Mute,Vote Kill,Vote Kick,Vote Ban]])
end
end
function names()
for id = 1,32 do
if player(id,"exists") then
pln[id] = player(id,"name")
else
pln[id] = ""
end
end
end
function pl_1(id)
names()
menu(id,[[Players 1@b,]]..pln[1]..[[,]]..pln[2]..[[,]]..pln[3]..[[,]]..pln[4]..[[,]]..pln[5]..[[,]]..pln[6]..[[,]]..pln[7]..[[,,Next]])
end
function pl_2(id)
names()
menu(id,[[Players 2@b,]]..pln[8]..[[,]]..pln[9]..[[,]]..pln[10]..[[,]]..pln[11]..[[,]]..pln[12]..[[,]]..pln[13]..[[,]]..pln[14]..[[,Back,Next]])
end
function pl_3(id)
names()
menu(id,[[Players 3@b,]]..pln[15]..[[,]]..pln[16]..[[,]]..pln[17]..[[,]]..pln[18]..[[,]]..pln[19]..[[,]]..pln[20]..[[,]]..pln[21]..[[,Back,Next]])
end
function pl_4(id)
names()
menu(id,[[Players 4@b,]]..pln[22]..[[,]]..pln[23]..[[,]]..pln[24]..[[,]]..pln[25]..[[,]]..pln[26]..[[,]]..pln[27]..[[,]]..pln[28]..[[,Back,Next]])
end
function pl_5(id)
names()
menu(id,[[Players 5@b,]]..pln[29]..[[,]]..pln[30]..[[,]]..pln[31]..[[,]]..pln[32]..[[,,,,Back]])
end
function fun(n)
if n == 1 then
return 1,7,0
elseif n == 2 then
return 8,14,-7
elseif n == 3 then
return 15,21,-14
elseif n == 4 then
return 22,28,-21
elseif n == 5 then
return 29,32,-28
end
end
function pll(id,n)
if n == 1 then pl_1(id)
elseif n == 2 then pl_1(id)
elseif n == 3 then pl_2(id)
elseif n == 4 then pl_3(id)
elseif n == 5 then pl_4(id)
end
end
function pll2(id,n)
if n == 1 then pl_2(id)
elseif n == 2 then pl_3(id)
elseif n == 3 then pl_4(id)
elseif n == 4 then pl_5(id)
elseif n == 5 then pl_5(id)
end
end
function plrt()
if #player(0,"table")/3 >= 3 then
return math.ceil(#player(0,"table")/3)
else
return 3
end
end
addhook([[menu]],[[menuer]])
function menuer(id,men,sel)
if men == [[Vote]] then
for i = 1,4 do
if sel == i then
sell[id] = i
pl_1(id)
end
end
end
for plni = 1,5 do
if men == [[Players ]]..plni then
local bla,blu,bll,zu = fun(plni)
for pl = bla,blu do
if sel == pl - bll then
local sel = sell[id]
if sel == 1 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to mute ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
mute[pl] = true
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
mute[pl] = true
num[sel][pl] = 0
end
end
elseif sel == 2 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to kill ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
parse([[killplayer ]]..pl)
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
parse([[killplayer ]]..pl)
num[sel][pl] = 0
end
end
elseif sel == 3 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to kick ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
parse([[kick ]]..pl)
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
parse([[kick ]]..pl)
num[sel][pl] = 0
end
end
elseif sel == 4 then
if did[sel][pl][id] == false then
for i = 1,4 do if i ~= sel then did[sel][pl][id] = false end end
did[sel][pl][id] = true
if num[sel][pl] ~= plrt() then
num[sel][pl] = num[sel][pl] + 1
msg([[Player ]]..player(id,"name")..[[ voted to ban ]]..player(pl,"name")..[[, ]]..num[sel][pl]..[[/]]..plrt()..[[!]])
if num[sel][pl] == plrt() then
parse([[banname ]]..pl)
num[sel][pl] = 0
end
elseif num[sel][pl] == plrt() then
parse([[banname ]]..pl)
num[sel][pl] = 0
end
end
end
end
end
if sel == 8 then
pll(id,plni)
elseif sel == 9 then
pll2(id,plni)
end
end
end
end
addhook([[say]],[[sayer]])
function sayer(id,txt)
if mute[id] == true then
return 1
end
if txt == [[vote]] then
menu(id,[[Vote,Vote Mute,Vote Kill,Vote Kick,Vote Ban]])
return 1
elseif txt == [[votemute]] then
sell[id] = 1
pl_1(id)
return 1
elseif txt == [[votekill]] then
sell[id] = 2
pl_1(id)
return 1
elseif txt == [[votekick]] then
sell[id] = 3
pl_1(id)
return 1
elseif txt == [[voteban]] then
sell[id] = 4
pl_1(id)
return 1
end
end
addhook([[minute]],[[minuter]])
function minuter()
for _,id in pairs(player(0,"table")) do
if mute[id] = true then
if mute_time[id] = 3 then
mute[id] = false
mute_time[id] = 1
end
mute_time[id] = mute_time[id] + 1
end
end
end
====END of LUA code===
Plz help me!
All So i'm Got a Error like this: >LUA ERROR: sys/lua/vote1.lua:242: 'then' expected near '='<