/*************START SERVER 1*****************/
$hostpath[0] = "d:\\LFS_Y\\";
$lfsport[0] = "63333";
/*******************************************/
/*************START SERVER 2*****************/
//$hostpath[1] = "d:\\LFS\\";
//$lfsport[1] = "63392";
/*******************************************/
$serverCount = count($hostpath);
$c = 0;
while($c < $serverCount)
{
include setLanguage($showLanguage);
$filepath[$c] = $hostpath[$c] . "host" . $lfsport[$c] . ".txt";
if ((MCI.Info[0].X >= 46176313) && (MCI.Info[0].Y >= 15915129))
function inArea(x,y, x_,y_)
{
if ((x >= x_-0.5*65536) && (x <= x_+0.5*65536) && (y >= y_-0.5*65536) && (y <= y_+0.5*65536)) { return true;}
else { return false;}
}
x_ticket = 46176313;
y_ticket = 15915129;
if ( inArea(MCI.Info[0].X, MCI.Info[0].Y, x_ticket, y_ticket) )
{
}
function drag_init(imsg)
racer = {}
luaLFS:small(0, SMALL_NLI, 50)
luaLFS:tiny(1, TINY_NPL)
end
evt_bind(EVT_CONNECTED, drag_init)
function test(imsg)
local mci = luaLFS:mci(imsg)
luaLFS:bfn(0, 255, 50, 0)
luaLFS:bfn(0, 255, 51, 0)
luaLFS:btn(50, 255, 50, 0, 32, 0, 172, 25, 28, 10, "X1="..mci.compcar[plid].x)
luaLFS:btn(51, 255, 51, 0, 32, 0, 172, 35, 28, 10, "Y1="..mci.compcar[plid].y)
end
evt_bind(ISP_MCI, test)
function npl_loc(imsg)
local npl = luaLFS:npl(imsg)
plid = npl.plid
end
evt_bind(ISP_NPL, npl_loc)
-- x1,y1, x2,y2 - start and end points of line (edge of area)
-- xa,ya - coordinate of car
function across(x1,y1,x2,y2,xa,ya)
local ymax,ymin
if (y1 < y2) then
ymax = y2
ymin = y1
else
ymax = y1
ymin = y2
end
local y = (xa-x1)*(y2-y1)/(x2-x1) + y1
if ((xa == x1) and (ya == y1)) or ((xa == x2) and (ya == y2)) then
return 2
elseif ((x1 == x2) and (xa == x1) and (ya >= ymin) and (ya <= ymax)) then
return 2
elseif ((x1 < x2) and (xa >= x1) and (xa <= x2)) or ((x1 > x2) and (xa <= x1) and (xa >= x2)) then
if (ya >= y) and (ymin <= y) then
return 1
end
end
return 0
end
function in_area(points,x,y)
local trig = 0
local temp
-- #points - number of points
for i=2,#points/2 do
temp = across(points[i*2-3],points[i*2-2],points[i*2-1],points[i*2-0],x,y)
if (temp == 2) then
return true
elseif (temp == 1) then
trig = 1 - trig
end
end
temp = across(points[#points-1],points[#points-0],points[1],points[2],x,y)
if (temp == 2) then
return true
elseif (temp == 1) then
trig = 1 - trig
end
if (trig == 1) then return true else return false end
end
local area = {18379340,2221338, 17468965,1976709, 17309117,2608274, 18208925,2855925}
local into_area = in_area(area, mci.compcar[DRAG.PLIDS[i]].x,mci.compcar[DRAG.PLIDS[i]].y)
if (into_area) then
...
end
proc1 = coroutine.create(function ()
socket = require("socket")
client = socket.tcp()
client:settimeout(0)
res,err = client:connect("192.168.6.14", 6667)
print("connect",res,err)
function send(txt)
...
end
function recv()
...
end
function future()
...
end
-- Identify yourself
send("NICK Luabot")
send("USER Luabot 0 * :I am from the moon")
timer = future()
timer.register(5,function() send("JOIN #bot-tests") end)
repeat
res, err, timeout = recv()
if not err and not timeout then
if string.sub(res,1,4) == "PING" then
-- ping request
send(string.gsub(res,"PING","PONG",1))
elseif string.sub(res,1,1) ~= ":" then
...
end
end
timer.check()
coroutine.yield()
until err
client:close()
end)
function send_to_irc(imsg)
local t = luaLFS:mso(imsg)
local p = luaLFS:stripctrlchars(t.msg)
timer.register(1,function() send("PRIVMSG #bot-tests :"..string.char(3).."2From LFS: "..string.char(3)..p) end)
end
evt_bind(ISP_MSO, send_to_irc)
function tr()
coroutine.resume(proc1)
end
evt_bind(ISP_MCI, tr)
while 1 do
coroutine.resume(proc1)
end