Nicks In Table - Help
 

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

Nicks In Table - Help

Started by Madman, 13 December, 2004, 18:16:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

JointUserTable = {}
JointUsers = 0
Bot = "FunScript"

function DataArrival(curUser,data)
	if strsub(data, 1, 1) == "<" then
	data=strsub(data,1,strlen(data)-1)
	s,e,cmd = strfind(data,"%b<>%s+(%S+)")
-------------------------------Ask For Joint And For Joint(curUser)
	--==NewCommand==--
		if cmd == "!askj" then
			SendToAll(Bot, curUser.sName.. " asks if someone gould give him/her a joint")
			Joint(curUser)
			JointUsers = 1
		return 1
		end
-------------------------------
	--==NewVictimCommand==--
		if cmd == "!givej" then
		local s,e,victim = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if victim == nil then
				curUser:SendData(Bot, "Syntax: "..cmd.." nick")
				return 1
			end
		vUser = GetItemByName(victim)
			if not vUser then
				curUser:SendData(Bot, " *** " ..victim.." is not online or wrong name...")
				return 1
			end
				if JointUsers==1 then
				local s,e,JointUserVic = strfind(data, "%b<>%s+%S+%s+(%S+)")
						if JointUserTable[Jointed.sName] == 1 then
							JointUserTable[Jointed.sName] = nil; --//Remove User From Table
							SendToAll(Bot, curUser.sName.." passes the joint to " ..Jointed.sName.." 1")
						elseif JointUserTable[Jointed.sName] == nil then
							JointUser = GetItemByName(JointUserVic)
							SendToAll(Bot, curUser.sName.." passes the joint to " ..JointUser.sName.." 3")
						end
				elseif JointUsers==0 then
					vUser = GetItemByName(victim)
					SendToAll(Bot, curUser.sName.." passes the joint to "..vUser.sName.." 2")
				end
		return 1
		end
-------------------------------Show Jointed Users Table
if cmd == "!showj" then ShowJointed(curUser) return 1 end
-------------------------------
	end
end

function ShowJointed(curUser)
	local names = ""
		for index, value in JointUserTable do
	local line = index
		names = names.." "..line.."\r\n"
	end
	curUser:SendData(Bot,"\r\n\r\nJointUser User..\r\n\r\n"..names)
end
-------------------------------Save Users In Table
function Joint(curUser)
Jointed = GetItemByName(curUser.sName) --//Jointed Is CurUser
	if JointUserTable[Jointed.sName] == nil then --//If Not User Is In Table
		JointUserTable[Jointed.sName] = 1 --//Then Add User
	end
end

Need some help here...

Users = A,B,C,D

A uses cmd !askj and get added to JointUserTable
B uses cmd !askj to, and gets added to

C tries to give D a joint
--But beacue of table
C gives B a joint
--B is removed from table
--A is still in Table
--D is ignored

C tries to give D a joint again
--And Here is the problem!
C gives D a joint
--A is ignored and remains in table

It Should be
C tries to give D a joint again
--But becuse of table
C gives A a joint
--A is removed from table
--D is ignored

Why does the table only give B a joint?
I have checked A is in the table
What do i need to do, to make the script understand that it is more nicks in the table?
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Madman

Can somebody please 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

bastya_elvtars

function Joint(curUser)
	if not JointUserTable[curUser.sName] then --//If Not User Is In Table

		JointUserTable[curUser.sName] = 1 --//Then Add User

	end

end

do not overcomplicate a script. Will have more time evening, then ill check.
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk