PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Punkie on 27 January, 2004, 17:46:09

Title: Share Checker for registered
Post by: Punkie on 27 January, 2004, 17:46:09
I need help, please
.
I have a Ptoka 0.3.3.0 15.25 and I need script, which will check share only of registered users. No of other users.

Is it possible?

Ptoka checks share of non-registered users...and I have in Profile manager: Reg-no share limit...but I need to check their share, but they should have other share then non-registered users.

Sorry for my english.
Title:
Post by: c h i l l a on 27 January, 2004, 18:32:45
a simple one also extendable if you know how ;)


--Number in Gigabytes

shareProfiles = {
[3] = "6",
}



function Main()
for i,v in shareProfiles do
shareProfiles[i] = v*1024*1024*1024
end
end


function NewUserConnected(curUser)
if shareProfiles[curUser.iProfile] then
local infostring = curUser.sMyInfoString
if not ( strsub(infostring,strlen(infostring),strlen(infostring)) == "|" ) then
infostring = infostring.."|"
end
local _,_,share = strfind(curUser.sMyInfoString,"%$(%d+)%$|$")
if tonumber(share) then
if tonumber(share) < shareProfiles[curUser.iProfile] then
curUser:Disconnect()
end
else
curUser:Disconnect()
end
end
end
Title:
Post by: Punkie on 27 January, 2004, 19:15:13
Thanks a lot...it works! :-)
Can I ask you for one another help...?

I would like to send to registered user...if he will be disconected...why he is disconected.

Something like:

SendToNick(curUser.sName," You don't met the share minimum x Gb")

If I put it into script...it doesnt work.
I am a beginner :-/.
Title:
Post by: c h i l l a on 28 January, 2004, 14:24:47
yepp I also made a little mistake inthe script, and it worked with you??

what ptokax are you using ??


--Number in Gigabytes

shareProfiles = {
[3] = "6",
}

function Main()
for i,v in shareProfiles do
shareProfiles[i] = v*1024*1024*1024
end
end

function NewUserConnected(curUser)
if shareProfiles[curUser.iProfile] then
local infostring = curUser.sMyInfoString
if not ( strsub(infostring,strlen(infostring),strlen(infostring)) == "|" ) then
infostring = infostring.."|"
end
local _,_,share = strfind(infostring,"%$(%d+)%$|$")
if tonumber(share) then
if tonumber(share) < shareProfiles[curUser.iProfile] then
curUser:SendData("You haven't met the minimum share of "..shareProfiles[curUser.iProfile].." Gb for your class.")
curUser:Disconnect()
end
else
curUser:Disconnect()
end
end
end
Title:
Post by: plop on 29 January, 2004, 00:04:07
QuoteOriginally posted by Punkie
Thanks a lot...it works! :-)
Can I ask you for one another help...?

I would like to send to registered user...if he will be disconected...why he is disconected.

Something like:

SendToNick(curUser.sName," You don't met the share minimum x Gb")

If I put it into script...it doesnt work.
I am a beginner :-/.
thats a problem which can happen on the beta's/some clients.
somehow the connection is lost before the text is recieved by the client.
seems 2 happen more on some modded clients.

plop
Title:
Post by: Punkie on 29 January, 2004, 01:44:14
Thanks a lot :-))