Help with script (not working)
 

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

Help with script (not working)

Started by Exile, 09 January, 2005, 13:53:45

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Exile

I have started a Hub Bot and am having some problems...
I have no errors in the syntax, but when I try and do the !version command I don't get anything back in the hub...
Also when I enter as unregistered it is meant to show me a Download and Search disabled message, which it doesnt... :S:S:S

No errors, yet I dont see anything :S

-- Evil-Eye v1.00a by Exile?.
-- GUI built by Exile? (Current GUI Version is: Unreleased Beta Edition).
-- Email [EMAIL]btadiar@yahoo.co.uk[/EMAIL] to receive newest GUI version.

-- Script Variables (Soon to be Read From Settings.ini)
BotName = "Evil-Eye"
CurrentVersion = "Evil-Eye v1.00a"
NoUpload = "0"
NoDownload = "1"
NoSearch = "1"


--Register BotName
function Main()
frmHub:RegBot(BotName)
end

-- CurrentVersion Command (Displays Current Script Version in the Hub)
function DataArrvial (user, data)
if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(BotName))=="$To: "..BotName) then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd=="!version" then
	user:SendData(BotName, "This Hub is Running "..CurrentVersion.." by Exile?") -- Send User the Script Version
return 1
end


-- Block Unregistered User Uploads
if (strsub(data, 1, 12) == "$ConnectToMe") and user.iProfile== "-1" and NoUpload == "1" then
	user:SendData("\r\n*** Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
return 1
end

-- Block Unregistered User Downloads
if( strsub(data, 1, 12) == "$RevConnectToMe") and user.iProfile== "-1" and NoDownload == "1" then
	user:SendData("\r\n***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
return 1
end

-- Block Unregistered User Searches
if( strsub(data, 1, 12) == "$Search") and user.iProfile== "-1" and NoSearch == "1" then
	user:SendData("\r\n***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
return 1
end

end
end

Please help me :)

Truly,

Exile

Exile

Script Editor saying theres an end expected to close the function at line 19 in the one you wrote optimus....icant find where to out it though...must just be me. Could you take anuva look please ?

Truly,

Exile

Optimus

-- Evil-Eye v1.00a by Exile?.
-- GUI built by Exile? (Current GUI Version is: Unreleased Beta Edition).
-- Email [EMAIL]btadiar@yahoo.co.uk[/EMAIL] to receive newest GUI version.

-- Script Variables (Soon to be Read From Settings.ini)

BotName = "Evil-Eye"
CurrentVersion = "Evil-Eye v1.00a"
NoUpload = 1
NoDownload = 1
NoSearch = 1

--Register BotName
function Main()
	frmHub:RegBot(BotName)
	frmHub:EnableFullData(1)
end

function DataArrival(user, data)
	if (strsub(data, 1, 1) == "<" ) or (strsub(data,1,5+strlen(BotName))=="$To: "..BotName) then
		data=strsub(data,1,strlen(data)-1) 
		s,e,cmd=strfind(data, "%b<>%s+(%S+)")
		if (cmd=="!version") then
			-- Send User the Script Version
			user:SendData(BotName, "This Hub is Running "..CurrentVersion.." by Exile?")
			return 1
		end
	-- Block Unregistered User Uploads
	elseif (strsub(data, 1, 12) == "$ConnectToMe") then
		if user.iProfile == -1 and NoUpload == 1 then
			user:SendData(BotName, "*** Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
			return 1
		end
	-- Block Unregistered User Downloads
	elseif (strsub(data, 1, 15) == "$RevConnectToMe") then
		if user.iProfile == -1 and NoDownload == 1 then
			user:SendData(BotName, "***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
			return 1
		end
	-- Block Unregistered User Search
	elseif (strsub(data, 1, 7) == "$Search") then
		if user.iProfile == -1 and NoSearch == 1 then
			user:SendData(BotName, "***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
			return 1
		end
	end
end

Here ya go ;)

Exile

Right this is really annoyin me! The command !version works fine, but no unregistered users receive messages when they connect, which in theory they should, anyone help?

Using my script, modidfied by Opti, post before mine, can someone please take a look :)

Truly,

Exile

Optimus

DataArrival is for checking protocols and other stuff. That part has nothing todo with a message on connect, you need 1 extra function.

--// On-Connect
function NewUserConnected(user)
	if user.iProfile == -1 then
		user:SendData(BotName, "***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")
	end
end
Btw there are enough samples on the forum to learn these basic things. It isn't that hard

Greetingz Optimus

Optimus

Below is a common script skeleton, you can/may use as a good starting point.

--// PtokaX script skeleton START ----------------------------------------------------
-- if you need any global variable, define them outside any function
-- for example here, onthe top of the script


--// below are predefined functions which are called by the hub on a specific action


--// This function is fired at the serving start
function Main()
  -- TODO your code here
end


--// This function is fired when a new data arrives
function DataArrival(user, sData) 
  -- TODO your code here
end


--// This function is fired when a new user finishes the login
function NewUserConnected(user)
  -- TODO your code here
end


--// This function is fired when an operator enters the hub
function OpConnected(user)
  -- TODO your code here
end

--// This function is fired when an user disconnects
function UserDisconnected(user)
  -- TODO your code here
end

--// This function is fired when an operator disconnects
function OpDisconnected(user)
  -- TODO your code here
end


--// PtokaX script skeleton END ----------------------------------------------------
This is how it basicly work

??????Hawk??????

#6
hi m8  ..

Add this Function to the script..

function NewUserConnected(curUser) 
--  	curUser:SendPM(BotName,"***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")   	--// Send Pm To user on connect
	curUser:SendData(BotName,"***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")   	--// Send main chat message To user on connect
end


remove  and add the  --   to the line you Dont want to use.

Or  just remve the unwanted line

* * * EDIT  Removed a double quote from the code * * *

also noticed i must have had the Reply window open far too long  ..  Opti got there first   ;)


??????Hawk??????

Optimus

Quotefunction NewUserConnected(curUser)
--     curUser:SendPM(BotName,"***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")      --// Send Pm To user on connect
   curUser:SendData(BotName,"***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")      --// Send main chat message To user on connect
end
Shouldn't that be
function NewUserConnected(user) 
--  	user:SendPM(BotName,"***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")   	--// Send Pm To user on connect
	user:SendData(BotName,"***  Search & Download/Upload Disabled!!! You are not Registered. Search & Download/Upload are Disabled.\r\n")   	--// Send main chat message To user on connect
end

??????Hawk??????

hi  opti ..

am  i missing something  or is it because were  posting at the same time    lolol

SMF spam blocked by CleanTalk