I was wondering how to get the position(x/y) of the blue and orange portal of a player(id) or a list of position from all active portal on the grown.
- combinaison of attack hook and projectiles seem not working.
addhook("attack","leattackhook")
function leattackhook(id)
if player(id,"weapontype") == 88 then
for k,v in pairs (object(0,"table")) do
if v.type == 22 or v.type == 23 then
msg("orange or blue portal belongs to "..v.player.." and is located at "..v.tilex.."|"..v.tiley)
end
end
end
end
MyTable = {something = 8, anotherthing = 2}
MyTable[1]
MyTable.something
LUA ERROR: sys/lua/server.lua:113: attempt to index local 'v' (a number value)
-> sys/lua/server.lua:113: in function <sys/lua/server.lua:110>
-> in Lua hook 'attack', params: 1
addhook("attack","leattackhook")
addhook("attack2","leattackhook2")
function leattackhook(id)
if player(id,"weapontype") == 88 then
for k, v in pairs(object(0,"table")) do
if object(v,"type") == 22 then
msg(object(v,"typename").." belongs to "..player(object(v,"player"),"name").." and is located at "..object(v,"tilex").."|"..object(v,"tiley"))
end
end
end
end
function leattackhook2(id)
if player(id,"weapontype") == 88 then
for k, v in pairs(object(0,"table")) do
if object(v,"type") == 23 then
msg(object(v,"typename").." belongs to "..player(object(v,"player"),"name").." and is located at "..object(v,"tilex").."|"..object(v,"tiley"))
end
end
end
end
MyTable = {something = 8, anotherthing = 2}
print(MyTable.something, MyTable["something"])
print(MyTable[1])