Wave [New API]
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Wave [New API]

Started by Tw?sT?d-d?v, 04 November, 2007, 18:20:35

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tw?sT?d-d?v

-- lua5(by Dessamator)
-- Wave by DirtyFingers
-- on/off and more.. by Hawk 
--// Converted to NEW API by Tw?sT?d-d?v?l (28/10/07)
--// Added Rightclicker too   1=on/0=off

Wave = {
        [0] = 1,	-- Master
        [1] = 1,	-- Operator
}

wavepart = "??..??''???``''??..??_"
--          1234567890123456789012
pos = 1
wholewave = string.rep(wavepart,4)
active = 0
function OnStartup()

end


function OnTimer(tmr)
if pos > 1 then 
pos = pos-1
else 
pos = 22
end
local c = string.sub(wavepart,pos,pos)
wholewave = c..string.sub(wholewave,1,string.len(wholewave)-1)
--SendToAll("",c.."\t"..string.sub(wholewave,string.len(wholewave)-1,string.len(wholewave)-1))
Core.SendToAll("<".."*".."> "..wholewave.." <*>")
end


function ChatArrival(curUser,sData)
	Core.GetUserAllData(curUser)
		command=string.sub(sData,1,string.len(sData)-1)
		s,e,cmd = string.find(command,"%b<>%s+(%S+)")
			if curUser.bOperator then
				if cmd=="!waveon" then
					tmr = TmrMan.AddTimer(200)
					active = 1
				elseif cmd=="!waveoff" then
  					TmrMan.RemoveTimer(tmr)
					active = 0
				end
			end
				if active ~= 0 then
					local s,i
					_,i = (string.find(sData,"<"..curUser.sNick.."> "))
						if i ~= nil then
							s = string.sub(sData,i+1,string.len(sData)-1)
								if ( string.sub(sData, 1, 4) == "$To:" ) then
									s,e,g,h,j = string.find(sData,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
									j = string.sub(j,1,string.len(j)-1)
									Core.SendPmToNick(g,h,j)			
 								else	
									if string.len(s) < string.len(wholewave) then
										wholewave = s .. string.sub(wholewave,string.len(s))
									else
										wholewave = string.sub(s,string.len(wholewave))
									end
								end
						end
						return true
				end
end

OpConnected = function(user)
	Core.GetUserAllData(user)
             if (Wave[user.iProfile] == 1) then
		Core.SendToNick(user.sNick,"$UserCommand 1 3 Wave\\Start Wave$<%[mynick]> !waveon&#124;")
                Core.SendToNick(user.sNick,"$UserCommand 1 3 Wave\\Stop Wave$<%[mynick]> !waveoff&#124;")
	end
end

SMF spam blocked by CleanTalk