if not
 

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

if not

Started by ??Empie??, 16 December, 2003, 14:41:43

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

??Empie??

Im working on a script that check needs an if not statement:

I have experience with other programming languages but not Lua, and I am trying to get this work:

if !(strfind(description,"<++")) then
		curUser:SendPM(botname, "Hello "..curUser.sName..". Your client is too old or incorrect. Upgrade to the following: Windows 98: [URL]http://dcplusplus.sourceforge.net,[/URL] Windows 2K/XP: [URL]http://dcplusplus.sourceforge.net[/URL] or [URL]http://www.neo-modus.com,[/URL] MacOS: [URL]http://dc.ketelhot.de,[/URL] Linux: [URL]http://dc.ketelhot.de.[/URL]")
		curUser:Disconnect()
	end

the if !(blabla) doesn't seem to work, and even after searching this forum, lua.org and google I cant seem to get my hands on the right syntax.

Can anyone please help me with it (I feel kinda stupid becouse the problem seems so simple)?

p.s. the whole script contains a lot more code, but this part gives enough to see what I mean I think :)

kepp

if (strfind(description,"<++")) then
		curUser:SendPM(botname, "Hello "..curUser.sName..". Your client is too old or incorrect. Upgrade to the following: Windows 98: [URL]http://dcplusplus.sourceforge.net,[/URL] Windows 2K/XP: [URL]http://dcplusplus.sourceforge.net[/URL] or [URL]http://www.neo-modus.com,[/URL] MacOS: [URL]http://dc.ketelhot.de,[/URL] Linux: [URL]http://dc.ketelhot.de.[/URL]")
		curUser:Disconnect()
	end

First you don't need any "!"..
Then everything look just great, exept for one thing, depends if "description" is Equal to curUser.sMyInfoString that is...

I prefer this way:

CheckDCPP = { "<++" }

if not (strfind(user.sMyInfoString,CheckDCPP,1,1)) then
      curUser:SendPM(botname, "Hello "..curUser.sName..". Your client is too old or incorrect. Upgrade to the following: Windows 98: [URL]http://dcplusplus.sourceforge.net,[/URL] Windows 2K/XP: [URL]http://dcplusplus.sourceforge.net[/URL] or [URL]http://www.neo-modus.com,[/URL] MacOS: [URL]http://dc.ketelhot.de,[/URL] Linux: [URL]http://dc.ketelhot.de.[/URL]")
		curUser:Disconnect()
Guarding    

??Empie??

I got it working finally!

I did it like this:

function NewUserConnected(curUser)
	ClientOK=0
	if (strfind(curUser.sMyInfoString,"

thx for the example kepp!

everybody feel free to use this scriptpart, it disconnects users who don't have a neat nmdc v2.x, dc++, dcgui or oDC tag.

I've implemented this rule in my hub becouse I suspect a lot of tag-less users of being nmdc v1 fakers, which I cannot inspect, but since for every operating system now is a descent client with tag this solves it :)

tezlo

or..
function NewUserConnected(curUser)
	if strfind(curUser.sMyInfoString,"

kepp

Yep, oDC uses the same tag as dc++
Guarding    

SMF spam blocked by CleanTalk