
Forum




@report - May I Please Have Some Help?
26 replies
Since he also outputted the file to a .html and uses "ERROR: Correct Syntax is @report [ID] [reason]."
I could be wrong since I'm too lazy to check.
------
Another good anti-spam method could be setting a timeout.
but its not much use, cause I still get a ERROR
addhook("say", "startsay")
function startsay(id, message)
for i=1,table.getn(saycom) do
table.remove(saycom, i)
end
for key,value in pairs(split(message, " ")) do
saycom[key]=value
end
saycom[1]="@report" then
if rankid[id] < 1 then msg2(id, Color(255, 0, 0), "ERROR: You do not have enough power to execute that command.") ; return 1; end
if table.getn(saycom)==3 then
if isnumber(saycom[2]) then
saycom[2]=saycom[2]-1+1
if player(saycom[2], "exists") then
if saycom[2]==id then
msg2(id, Color(255, 0, 0), "ERROR: You may not report yourself.")
return 1
else
file2=io.open("/var/www/reported.html", "a+")
file2:write("<br>\n<br>\n"..os.date().."<br>\n"..player(id, "name").." ("..myname[id]..") IP: "..player(id, "ip").." USGN: "..myusgn[id].." REPORTED <br>\n"..player(saycom[2], "name").." IP: "..player(saycom[2], "ip").." USGN: "..myusgn[saycom[2]].."<br>\nReason: "..saycom[3])
file2:close()
msg(Color(255,255,255), player(id, "name").." used "..string.lower(message.."."))
return 1
end
msg2(id, Color(255, 0, 0), "ERROR: Player does not exist.")
return 1
end
else
msg2(id, Color(255, 0, 0), "ERROR: Correct Syntax is @report [ID] [reason].")
return 1
end
else
msg2(id, Color(255, 0, 0), "ERROR: Correct Syntax is @report [ID] [reason].")
return 1
end

I also want to remind you to use [ code ] [ /code ] tags when posting Lua script code.
NeedlerGamer has written
I have this:
but its not much use, cause I still get a ERROR
addhook("say", "startsay")
function startsay(id, message)
for i=1,table.getn(saycom) do
table.remove(saycom, i)
end
for key,value in pairs(split(message, " ")) do
saycom[key]=value
end
saycom[1]="@report" then
if rankid[id] < 1 then msg2(id, Color(255, 0, 0), "ERROR: You do not have enough power to execute that command.") ; return 1; end
if table.getn(saycom)==3 then
if isnumber(saycom[2]) then
saycom[2]=saycom[2]-1+1
if player(saycom[2], "exists") then
if saycom[2]==id then
msg2(id, Color(255, 0, 0), "ERROR: You may not report yourself.")
return 1
else
file2=io.open("/var/www/reported.html", "a+")
file2:write("<br>\n<br>\n"..os.date().."<br>\n"..player(id, "name").." ("..myname[id]..") IP: "..player(id, "ip").." USGN: "..myusgn[id].." REPORTED <br>\n"..player(saycom[2], "name").." IP: "..player(saycom[2], "ip").." USGN: "..myusgn[saycom[2]].."<br>\nReason: "..saycom[3])
file2:close()
msg(Color(255,255,255), player(id, "name").." used "..string.lower(message.."."))
return 1
end
msg2(id, Color(255, 0, 0), "ERROR: Player does not exist.")
return 1
end
else
msg2(id, Color(255, 0, 0), "ERROR: Correct Syntax is @report [ID] [reason].")
return 1
end
else
msg2(id, Color(255, 0, 0), "ERROR: Correct Syntax is @report [ID] [reason].")
return 1
end
but its not much use, cause I still get a ERROR
addhook("say", "startsay")
function startsay(id, message)
for i=1,table.getn(saycom) do
table.remove(saycom, i)
end
for key,value in pairs(split(message, " ")) do
saycom[key]=value
end
saycom[1]="@report" then
if rankid[id] < 1 then msg2(id, Color(255, 0, 0), "ERROR: You do not have enough power to execute that command.") ; return 1; end
if table.getn(saycom)==3 then
if isnumber(saycom[2]) then
saycom[2]=saycom[2]-1+1
if player(saycom[2], "exists") then
if saycom[2]==id then
msg2(id, Color(255, 0, 0), "ERROR: You may not report yourself.")
return 1
else
file2=io.open("/var/www/reported.html", "a+")
file2:write("<br>\n<br>\n"..os.date().."<br>\n"..player(id, "name").." ("..myname[id]..") IP: "..player(id, "ip").." USGN: "..myusgn[id].." REPORTED <br>\n"..player(saycom[2], "name").." IP: "..player(saycom[2], "ip").." USGN: "..myusgn[saycom[2]].."<br>\nReason: "..saycom[3])
file2:close()
msg(Color(255,255,255), player(id, "name").." used "..string.lower(message.."."))
return 1
end
msg2(id, Color(255, 0, 0), "ERROR: Player does not exist.")
return 1
end
else
msg2(id, Color(255, 0, 0), "ERROR: Correct Syntax is @report [ID] [reason].")
return 1
end
else
msg2(id, Color(255, 0, 0), "ERROR: Correct Syntax is @report [ID] [reason].")
return 1
end
wrong repair your end to like this
1
2
3
2
3
end end end
You will say:
@report 4 He is speedhacking
than by the admins will come:
Someone has reported [Here the name of ID 4]: He is speedhacking
Also i mean, that you can make your own reporttext and not a setted text
end
end
end
and it seems to work. but now i get a nil error
LUA ERROR: sys/lua/server.lua:1: attempt to index global 'saycom' (a nil value)
based on what i know it should work correctly??