How do it?
 

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

How do it?

Started by Alone, 10 March, 2008, 14:42:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alone

Hello.. I have a question. I write little script
function ChatArrival(user,data)
Core.GetUserAllData(user)
local data = string.sub(data,1,-2)
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
if cmd == "!booring" then
name = user.sNick
tv = 0
return true
end
if tv == 0 and name == user.sNick then
Core.SendToAll("*booring "..data.."")
return true
end

But only one user at time can use them. I want, what more then one user can use this script. How to do it?

Madman

You need to add the user in to a table...

Just ask and i'll help...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Alone

Hello again, i'm write this script with using with table, but before i read Your post. Sorry for old code. All works good, but i don't now how to remove nick from table. This is my code
--Insert user nick in table by command (!booring)
local data = string.sub(data,1,-2)
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
if cmd == "!booring" then
table.insert (sSettings.uNick, user.sNick)
table.insert (sSettings.uMode, "1")
return true
end
if cmd == "!withoutint" then
table.insert (sSettings.uNick, user.sNick)
table.insert (sSettings.uMode, "0")
return true
end
--Find user nick and mode in table
local s,e,cmd =string.find(data, "%b<>%s+(%S+)")
	for i = 1,table.maxn(sSettings.uNick) do
	for i = 1,table.maxn(sSettings.uMode) do
        disp = sSettings.uNick[i]
	disp2 = sSettings.uMode[i]
	if user.sNick == disp and disp2 == "0"  then
	for j = 1,table.maxn(sSettings.uNick) do
	table.remove(sSettings.uNick, i)
	end
	end
	        if user.sNick == disp and disp2 == "1"  then
			Core.SendToAll("*booring "..data.."")
			return true
	end

I think, that problem with this happend because
if cmd == "!withoutint" then
table.insert (sSettings.uNick, user.sNick)
table.insert (sSettings.uMode, "0")
return true
end

After this command user.sNick and uMode writing in table how a new element.
How remove mode(*booring) from user? I don't find any information about search in table.

SMF spam blocked by CleanTalk