Help With This Script
 

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

Help With This Script

Started by Devastator, 01 February, 2004, 21:44:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Devastator

Plz sum1 help me with this i want it so u can delete entries theres a .dat file with it........but can u do this so u can delete entries i knw theres Fresh Stuff around but i am already using that for something else and i wanna use this! but all i need is a +del 2 delete entries without having 2 go in 2 the .dat file and changin it which is hard if u r not hosting!


botname = "BotName" 

function Main() 
frmHub:RegBot(botname) 
end 


function DataArrival(user, data) 

-- PM cmds: 

if(strsub(data, 1, 4) == "$To:") then 
data=strsub(data,1,strlen(data)-1) 
s,e,whoTo = strfind(data,"$To:%s+(%S+)") 
if (whoTo == botname) then 
s,e,whoTo,from,cmd = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)") 
if user.bOperator then 
if (cmd=="addhiphop") then 

-- arg from PM 
arg= GetArgsPM(data) 

-- Check if arg from PM is not 'nil' (empty) 

if arg ~= nil then 
local handle=openfile("hiphop.dat","a") 
write(handle,""..date("<%d.%m.%Y> ")..arg.."     <"..user.sName..">?") 
user:SendPM(botname,"Saved ....") 
user:SendData(botname, "New entry in Hip Hop!") 
closefile(handle) 
else 
user:SendData(botname, "Wrong synthax: addhiphop ") 
end 
end 
end 

if (cmd=="+hiphop") then 
handle2=openfile("hiphop.dat","r") 
if (handle2==nil) then 
else 
line = read(handle2,"*a") 
line=strsub(line,1,strlen(line)-1) 
linearray=tokenize(line,"?") 
for i=1,linearray.n do 
user:SendPM(botname,linearray[i]) 
end 
closefile(handle2) 
end 
end 
end 
end 

-- Main Chat cmds: 

if (strsub(data, 1, 1) == "<") then 
data = strsub(data,1,strlen(data)-1) 
s,e,cmd,dataa = strfind( data, "%b<>%s+(%S+)%s+(%S+)" ) 

if user.bOperator then 
if (strfind(strlower(data), strlower("addhiphop"))) then 

-- arg from main 
arg= GetArgsML(data) 

-- Check if arg from main is not 'nil' (empty) 

if arg ~= nil then 
local handle=openfile("hiphop.dat","a") 
write(handle,""..date("<%d.%m.%Y> ")..arg.."     <"..user.sName..">?") 
user:SendPM(botname,"Saved ....") 
user:SendData(botname, "New entry in Hip Hop!") 
closefile(handle) 
else 
user:SendData(botname, "Wrong synthax: addhiphop ") 
end 
end 
end 

if (strfind(strlower(data), strlower("+hiphop"))) then 
handle2=openfile("hiphop.dat","r") 
if (handle2==nil) then 
else 
line = read(handle2,"*a") 
line=strsub(line,1,strlen(line)-1) 
linearray=tokenize(line,"?") 
for i=1,linearray.n do 
user:SendPM(botname,linearray[i]) 
end 
closefile(handle2) 
end 
end 
end 
end 

function tokenize (inString,token) 
_WORDS = {} 
local matcher = "([^?"..token.."]+)" 
gsub(inString, matcher, function (w) tinsert(_WORDS,w) end) 
return _WORDS 
end 

-- Get Args from PM: 
function GetArgsPM(data) 
s,e,whoTo,from,cmd,arg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(%S+)%s+(.*)") 
return arg 
end 

-- Get Args from the Main Chat: 
function GetArgsML(data) 
s,e,cmd,arg = strfind(data, "%b<>%s+(%S+)%s+(.*)") 
return arg 
end


Plz Help Me!!!

Thanx A LoT ppl

Devastator
(? ?.??.->PLOP DEFINATELY 4 MOD!!!<-.??.???)


plop

you can run 2 instances of freshstuff if you rename the commands in 1 of them.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk