What have i done wrong here?
 

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

What have i done wrong here?

Started by Psycho_Chihuahua, 23 September, 2004, 16:04:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Psycho_Chihuahua

hmm this is an Anti Open Hub Standalone Script but i get this


Syntax error: attempt to index global `user' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 2 [file `C:\hub\PtoKaX_new\scripts\antiopenhub.lua']


I'm using this

function DataArrival( sUser , sData )
	if strsub( sData , 1 , 7 ) == "$MyINFO" and user.sName ~= "bobby" then
		local _,_,openhubs = strfind( data , ".+H:(%d+)" );
		if ( openhubs ~= "0" ) then
			SendToNick( user.sName , "Du bist in einen oder mehreren Open Hubs. Dies verst?sst gegen unsere Regeln. Deshalb wird die Verbindung zur?ckgesetzt!")
			user:Disconnect()
		end
	end
end
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

Infact it is in three points ... or one :) any how u see it it is noted below ( both ways :)
function DataArrival( sUser , sData )
	if strsub( sData , 1 , 7 ) == "$MyINFO" and [b]sUser[/b].sName ~= "bobby" then
		local _,_,openhubs = strfind( data , ".+H:(%d+)" );
		if ( openhubs ~= "0" ) then
			SendToNick( [b]sUser[/b].sName , "Du bist in einen oder mehreren Open Hubs. Dies verst?sst gegen unsere Regeln. Deshalb wird die Verbindung zur?ckgesetzt!")
			[b]sUser[/b]:Disconnect()
		end
	end
end

and the second is ..
function DataArrival( [b]user[/b] , sData )
	if strsub( sData , 1 , 7 ) == "$MyINFO" and user.sName ~= "bobby" then
		local _,_,openhubs = strfind( data , ".+H:(%d+)" );
		if ( openhubs ~= "0" ) then
			SendToNick( user.sName , "Du bist in einen oder mehreren Open Hubs. Dies verst?sst gegen unsere Regeln. Deshalb wird die Verbindung zur?ckgesetzt!")
			user:Disconnect()
		end
	end
end

this is the first error to check if u are copy/paste'ing,...
 just keep it in mind :)

Psycho_Chihuahua

#2
thnx herodes, i had it hooked up in Black_Pearl and couldn't find the original anymore lol.

hmm but it doesnt kick Users that r in Open Hubs :(
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

check what u get from the strfind ...

local s,e,openhubs = strfind(data, ",H:(%d+)")
SendToAll("User :"..user.sName.." is in "..openhubs.." open hubs ")

Psycho_Chihuahua

hmm funny, cause in Black_Pearl it worked fine the way i had it....

but as Standalone i had to change _,_,openhubs to s,e,openhubs

but how come it works one way in a bot and stand alone not? This i dont understand
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Herodes

from what I know using .. s,s,somevar = strfind(...) is the same with _,_,somevar = strfind(...) I always go with s,e any ways ...

but that should be a question for someone who really knows the languages inner-working :)

Psycho_Chihuahua

hmm well, maybe someone will tell me why its so *g*

guess i'll just have to wait
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

SMF spam blocked by CleanTalk