PtokaX forum

Development Section => Your Developing Problems => Topic started by: nErBoS on 23 February, 2004, 00:18:08

Title: Not Working... why ???
Post by: nErBoS on 23 February, 2004, 00:18:08
Hi all,

This is messing my head for example in the NewUserConnected i have this..

if (strfind(user.sMyInfoString, "O:")) then
user:SendData(Bot, "Settings do DC->Sharing , Open extra slot tem de estar em zero.")
user:SendData(Bot, "Desconectado...")
user:Disconnect()
end

But does'nt work.
The same happens to this..

if (strfind(user.sMyInfoString,"B:")) then
local _,b, llim = strfind(user.sMyInfoString,"B:(%x+)")
if (llim ~= nil) then
llim = tonumber(llim)
if (llim < limitador) then
user:SendData(Bot, "Est?s a usar limitador, deve estar no minimo em "..limitador.." KB/s.")
user:SendData(Bot, "Desconectado...")
user:Disconnect()
end
end
end

In the first case i want to disconnect the user which has the option OpenExtraSlot active, and i the other i want to disconect users which use upload limiter (in code limitador = 15)

Can anyone help me out where ??

Best regards, nErBoS
Title:
Post by: dvxjunkie on 23 February, 2004, 05:27:46
I thin you gotta use quotes around the commas within the messege...

like this

f (strfind(user.sMyInfoString, "O:")) then

user:SendData(Bot, "Settings do DC->Sharing " ," Open extra slot tem de estar em zero.")

user:SendData(Bot, "Desconectado...")

user:Disconnect()

end
Title:
Post by: kepp on 23 February, 2004, 07:08:15
local _,b, llim = strfind(user.sMyInfoString,"B:(%x+)")

To start with, After b you are suppose to catch a number am i right?

%d+
Title:
Post by: nErBoS on 23 February, 2004, 14:39:48
Hi,

dvxjunkie..

When i do this..

user:SendData(Bot, "Settings do DC->Sharing , Open extra slot tem de estar em zero.")

does'nt matter what i write in "" the bot will send everything.

keep..

You are right, always missing on that :P
But the problem stills hapen, this is a problem on The Connect function isn't checking the MyInfoString, because if i change to the DataArrival it will work when ever a user do something.

But i would like to know why doesn't check the MyInfoString :)

Best regards, nErBoS
Title:
Post by: kepp on 23 February, 2004, 16:56:54
i hvae no idea, probably somethign wrong somewhere else in the code!
Title:
Post by: NightLitch on 25 February, 2004, 01:18:18
Well my guess is that you get this problem:

you get a NIL value!!! on it some times RIGHT?

by step the nil the it will work...

if value==nil or value=="" then
--code
user:Disconnect()
end

and as Kepp say, use %d+ NOT %x+, it is number you are after not hex's.

/NL
Title:
Post by: nErBoS on 25 February, 2004, 01:40:46
Hi,

I founded the problem was something that i shouldn't be doing :)

Thanks to all.

Best regards, nErBoS
Title:
Post by: WooshMan on 25 February, 2004, 16:47:58
Tell us what you had done then... out of interest :-)
Title:
Post by: nErBoS on 25 February, 2004, 22:05:08
Hi,

The problem was...
eg.

if (X == "Active") then
--do code--
end
if (X == "Deactive") then
return  <-- I have removed this return and started to work ok :)
end

Best regrads, nErBoS
Title:
Post by: NightLitch on 26 February, 2004, 00:23:16
QuotenErBoS
   
Hi,

The problem was...
eg.

if (X == "Active") then
--do code--
end
if (X == "Deactive") then
return <-- I have removed this return and started to work ok :)
end

Best regrads, nErBoS
 


about this, why not doing it much simpler:

if (X=="Active") then
-- do code here
return 1
elseif (X=="Deactive") then
-- do that code here
return 1
else
-- if none found this code here
return 1
end

/NL
Title:
Post by: nErBoS on 26 February, 2004, 00:35:45
hehehe

if you see my bot you will get lost, i am a lit deorganized :))

i did this..

if (X=="Active") then
-- do code here
elseif (X=="Deactive") then
--do nothing
end

When i make a multi translator i will put on the forum, for now is only portuguese :P

Thanks to all one more time

Best regards, nErBoS