Spoiler function string:split(b)
local cmd = {}
if type(self) == "string" then
if not b then match = "[^%s]+" else match = "[^"..b.."]+" end
for word in string.gmatch(self,match) do
table.insert(cmd,word)
end
end
return cmd
end
addhook("parse","parser")
function parser(txt,id,ip,port)
local parses = txt:split()
if parses[1] == "ai_say" then
local id,text = tonumber(parses[2]),tostring(parses[3])
if id and text then
ai_say(id,text)
end
return 1
elseif parses[1] == "ai_sayteam" then
local id,text = tonumber(parses[2]),tostring(parses[3])
if id and text then
ai_sayteam(id,text)
end
return 1
elseif parses[1] == "ai_radio" then
local id,radioid = tonumber(parses[2]),tonumber(parses[3])
if id and radioid then
ai_radio(id,radioid)
end
return 1
elseif parses[1] == "ai_goto" then
local id,x,y,mode = tonumber(parses[2]),tonumber(parses[3]),tonumber(parses[4]),tonumber(parses[5])
if id and x and y and mode then
ai_goto(id,x,y,mode)
end
return 1
elseif parses[1] == "ai_move" then
local id,angle,mode = tonumber(parses[2]),tonumber(parses[3]),tonumber(parses[4])
if id and angle and mode then
ai_move(id,x,y,mode)
end
return 1
elseif parses[1] == "ai_respawn" then
local id = tonumber(parses[2])
if id then
ai_respawn(id)
end
return 1
elseif parses[1] == "ai_findtarget" then
local id = tonumber(parses[2])
if id then
ai_findtarget(id)
end
return 1
elseif parses[1] == "ai_freeline" then
local id,x,y = tonumber(parses[2]),tonumber(parses[3]),tonumber(parses[4])
if id and x and y then
ai_freeline(id,x,y)
end
return 1
elseif parses[1] == "ai_aim" then
local id,x,y = tonumber(parses[2]),tonumber(parses[3]),tonumber(parses[4])
if id and x and y then
ai_aim(id,x,y)
end
return 1
elseif parses[1] == "ai_iattack" then
local id = tonumber(parses[2])
if id then
ai_iattack(id)
end
return 1
elseif parses[1] == "ai_attack" then
local id,sec = tonumber(parses[2]),tonumber(parses[3])
if id and sec then
ai_attack(id,sec)
end
return 1
elseif parses[1] == "ai_buy" then
local id,item = tonumber(parses[2]),tonumber(parses[3])
if id and item then
ai_buy(id,item)
end
return 1
elseif parses[1] == "ai_use" then
local id = tonumber(parses[2])
if id then
ai_use(id)
end
return 1
elseif parses[1] == "ai_rotate" then
local id,angle = tonumber(parses[2]),tonumber(parses[3])
if id and angle then
ai_rotate(id,angle)
end
return 1
elseif parses[1] == "ai_selectweapon" then
local id,weapon = tonumber(parses[2]),tonumber(parses[3])
if id and weapon then
ai_selectweapon(id,weapon)
end
return 1
elseif parses[1] == "ai_reload" then
local id = tonumber(parses[2])
if id then
ai_reload(id)
end
return 1
elseif parses[1] == "ai_drop" then
local id = tonumber(parses[2])
if id then
ai_drop(id)
end
return 1
elseif parses[1] == "ai_spray" then
local id = tonumber(parses[2])
if id then
ai_spray(id)
end
return 1
elseif parses[1] == "ai_build" then
local id,building,x,y = tonumber(parses[2]),tonumber(parses[3]),tonumber(parses[4]),tonumber(parses[5])
if id and building and x and y then
ai_build(id,building,x,y)
end
return 1
end
end