Here is a simple Slot checker script I made = -- Simple Slot checker by blackwings LUA 5
-- Thanx to bastya_elvtars for helping me :)
-- version 2.0
-- Changed: Optimized the slot detecting - thanx bastya_elvtars
-- Changed: Made the slot detecting more secure - thanx Optimus
-- Changed: Optimized the slot detecting - thanx PPK
Bot = "#slot-checker"
-- ["Profile"] = {minSlot,maxSlot},
tlSlots = {
[2] = {5,30},
[3] = {4,30},
[-1] = {2,30},
}
function MyINFOArrival(user,slots)
if tlSlots[user.iProfile] then
local minSlot = tlSlots[user.iProfile][1]
local maxSlot = tlSlots[user.iProfile][2]
if user.iSlots < minSlot then
user:SendData(Bot, "Minimum "..minSlot.." slots!!!")
user:Disconnect()
elseif user.iSlots > maxSlot then
user:SendData(Bot, "Maximum "..maxSlot.." slots!!!")
user:Disconnect()
end
end
end
IMHO it's useless to do a separate pattern matching on the tag. Preferably there is only 1 S: in the user's myinfo, but for safety, I'd use strfind(user.sMyInfoString,"<.+S:(%d+).*>")
No offences, just a suggestion.
QuoteOriginally posted by bastya_elvtars
IMHO it's useless to do a separate pattern matching on the tag. Preferably there is only 1 S: in the user's myinfo, but for safety, I'd use strfind(user.sMyInfoString,"<.+S:(%d+).*>")
No offences, just a suggestion.
no offense taken ;)
Done, thanx for the suggestion bastya_elvtars :D
(The script above has been updated)
i think this 1 is even better lets say more secure
strfind(user.sMyInfoString,"<.+S:(%d+).*>%$")
QuoteOriginally posted by Optimus
i think this 1 is even better lets say more secure
strfind(user.sMyInfoString,"<.+S:(%d+).*>%$")
thank you, I will make the change :)
(The script above has been updated)
Here is no reason to get slots from myinfo, use PtokaX lua interface ;)
Quotereturn slotchecking(user, user.iSlots)
and if you want to know if user have tag
Quoteuser.bHasTag
is your friend :))
Thank you PPK :D
That does really improve my script :)
(The script above has been updated)