PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: dada87 on 12 February, 2008, 19:32:12

Title: Don't know what's wrong
Post by: dada87 on 12 February, 2008, 19:32:12
I work with the All-in-One package of DixBot which include Ptokax 0.4.0.0 RC8 et DiXBoT V2.0
I try to make this script start at the user connection but hopelessly it don't, so please help.

The script:


--[[-------------------------------------------------------
  Physio Beta
  Deconnecte les utilisateurs n'ayant aucune description et qui ne sont pas a Caen
  Spray - 06/12/07
  dada87 - 12/01/08
-------------------------------------------------------]]--



function NewUserConnected (user)

if user.sMyInfoString then
local timeanddate = os.date("%d/%m/%y %H:%M:%S")
local tmp = os.clock()
local disp = "\r\n\r\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Bienvenue sur le Hub DisneyWorld ! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n"
local ip = string.sub(user.sIP,1,5)


disp = disp.."<< Hub Name : "..frmHub:GetHubName().."\r\n"
disp = disp.."<< Hub Address : "..frmHub:GetHubAddress()..":"..frmHub:GetHubPort().."\r\n"
disp = disp.."<< Hub Date & Time : "..timeanddate.."\r\n"

disp = disp.."<< Your IP : "..user.sIP.."\r\n"

if user.sDescription ~= nil then
disp = disp.."<< Your description is : "..user.sDescription.."\r\n"
end

if user.sEmail then
disp = disp.."<< Your email is : "..user.sEmail.."\r\n"
end

disp = disp.."<< Your client is : "..user.sClient.."\r\n"

if user.sClientVersion ~= nil then
disp = disp.."<< Your client version is : "..user.sClientVersion.."\r\n"
end


disp = disp.."<< Your open slots are : "..user.iSlots
disp = disp.."\r\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n"

if user.sDescription == "" then
disp = disp.."\r\n\r\n\r\n<< Description VIDE !!\r\n"
disp = disp.."\r\n<< Remplissez votre description en specifiant votre PROMO et votre LOCALISATION\r\n"
disp = disp.."<< Exemple: \"IS2 Paris\"\r\n"
end

if ip ~= "10.19" then
disp = disp.."<<<<<< Mauvaise IP >>>>>>\r\n"
disp = disp.."Vous devez etre a Caen pour pouvoir vous connecter a ce hub."
end


user:SendPM("Admins", disp)

if user.sDescription == "" then
user:Disconnect()
end

if ip ~= "10.19" then
user:Disconnect()
end

disp = nil
end
end


Maybe that came from a Bug ...???
Thanks for any answer
Title: Re: Don't know what's wrong
Post by: Snooze on 12 February, 2008, 20:51:08
That script is for the old API set and wont run on any of the new PtokaX builds..

Why don't you use the build in function in DiXBoT?


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DiXBoT][Beta-Team @ demo.dixbot.com:1212
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Your Nick                : Snooze
Your IP                  : 83.89.62.150
Your Client              : Apex DC++ V:1.0.0B5
Your Status              : Owner
Your Share                : 0 B
Total Share              : 3.87 TiB
Users Online              : 11 User(s)
Hub Uptime                : 3 Days, 38 Minutes, 57 Seconds
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DiXBoT][Beta-Team WebSite: www.dixbot.com
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Gives you more or less the same info ..

/Snooze


[EDIT]

Just noticed your IP check... That is not included in DiXBoT .. Sorry..
/Snooze
Title: Re: Don't know what's wrong
Post by: Snooze on 12 February, 2008, 21:23:32
This is a 'quick 'n dirty' conversion...


--[[-------------------------------------------------------
  Physio Beta
  Deconnecte les utilisateurs n'ayant aucune description et qui ne sont pas a Caen
  Spray - 06/12/07
  dada87 - 12/01/08
-------------------------------------------------------]]--



function UserConnected (user)

local timeanddate = os.date("%d/%m/%y %H:%M:%S")
local tmp = os.clock()
local disp = "\r\n\r\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Bienvenue sur le Hub DisneyWorld ! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n"
local ip = string.sub(user.sIP,1,5)


disp = disp.."<< Hub Name : "..SetMan.GetString(0).."\r\n"
disp = disp.."<< Hub Address : "..SetMan.GetString(2)..":"..SetMan.GetString(3).."\r\n"
disp = disp.."<< Hub Date & Time : "..timeanddate.."\r\n"

disp = disp.."<< Your IP : "..user.sIP.."\r\n"

if Core.GetUserValue(user,2) ~= nil then
disp = disp.."<< Your description is : "..Core.GetUserValue(user,2).."\r\n"
end

if Core.GetUserValue(user,5) then
disp = disp.."<< Your email is : "..Core.GetUserValue(user,5).."\r\n"
end

disp = disp.."<< Your client is : "..Core.GetUserValue(user,6).."\r\n"

if Core.GetUserValue(user,7) ~= nil then
disp = disp.."<< Your client version is : "..Core.GetUserValue(user,7).."\r\n"
end


disp = disp.."<< Your open slots are : "..Core.GetUserValue(user,21)
disp = disp.."\r\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n"

if Core.GetUserValue(user,2) == "" then
disp = disp.."\r\n\r\n\r\n<< Description VIDE !!\r\n"
disp = disp.."\r\n<< Remplissez votre description en specifiant votre PROMO et votre LOCALISATION\r\n"
disp = disp.."<< Exemple: \"IS2 Paris\"\r\n"
end

if ip ~= "10.19" then
disp = disp.."<<<<<< Mauvaise IP >>>>>>\r\n"
disp = disp.."Vous devez etre a Caen pour pouvoir vous connecter a ce hub."
end


Core.SendPmToNick(user.sNick,"Admins", disp)

if user.sDescription == "" or ip ~= "10.19" then
Core.Disconnect(user.sNick)
end

end



/Snooze
Title: Re: Don't know what's wrong
Post by: dada87 on 18 February, 2008, 16:52:31
Thank you very much !
I'm going to try and I will let you know if it works.
Thx


/Edit
It works thanks