Author Topic: Not Working... why ???  (Read 2783 times)

0 Members and 1 Guest are viewing this topic.

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
Not Working... why ???
« on: 23 February, 2004, 00:18:08 »
Hi all,

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

Code: [Select]
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..

Code: [Select]
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
--## nErBoS Spot ##--

PtokaX forum

Not Working... why ???
« on: 23 February, 2004, 00:18:08 »

Offline dvxjunkie

  • Fulll Member
  • ****
  • Posts: 56
  • Karma: +0/-0
(No subject)
« Reply #1 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

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #2 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+
Guarding    

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
(No subject)
« Reply #3 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
--## nErBoS Spot ##--

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #4 on: 23 February, 2004, 16:56:54 »
i hvae no idea, probably somethign wrong somewhere else in the code!
Guarding    

Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
(No subject)
« Reply #5 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
//NL

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
(No subject)
« Reply #6 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
--## nErBoS Spot ##--

Offline WooshMan

  • Fulll Member
  • ****
  • Posts: 53
  • Karma: +0/-0
(No subject)
« Reply #7 on: 25 February, 2004, 16:47:58 »
Tell us what you had done then... out of interest :-)
WooshMan

Creator of
originaltimebot.lua
www hubstats

Thanks to Plop, Kepp and NightLitch

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
(No subject)
« Reply #8 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
--## nErBoS Spot ##--

Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
(No subject)
« Reply #9 on: 26 February, 2004, 00:23:16 »
Quote
nErBoS
   
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:

Code: [Select]
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
//NL

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
(No subject)
« Reply #10 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
« Last Edit: 26 February, 2004, 00:37:23 by nErBoS »
--## nErBoS Spot ##--

PtokaX forum

(No subject)
« Reply #10 on: 26 February, 2004, 00:35:45 »