hello folks
i tried to make this script to work but ervrytime i start it up
it gives me the error [eof] expected in the lat line.
can someone explain why?
======================================
--test by [NL]trucker.
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function NewUserConnected(user)
Message(user)
end
function OpConnected(user)
Message(user)
end
function Message(user)
local disp = ""
doGetProfile = GetProfileName(user.iProfile) or "Not registerd"
return 1
end
disp = disp.." ==================================================================="
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] -\r\n"
disp = disp.." ?There are: "..ProfileCounter("Operator").." [OPERATOR] -\r\n"
disp = disp.." ?There are: "..ProfileCounter("Vip").." [VIP]- \r\n"
disp = disp.." ?There are: "..profilecounter("Reg").." [Registerd users]- online \r\n"
disp = disp.." \r\n\r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ==================================================================="
user:SendData(BotName, disp)
end
========================================
i want a bit of explanation cause it is driving me crazy.
All your disp = disp lines are not within a function.
Your last "end" doesn't end anything then ;)
so what you are saying is that i should replace
disp = disp
with something like this
SendToUser SendToAll(BotName,)
and then it should work?
oke i have come this far :
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--test by [NL]trucker.
function Main()
botname = "=[INFO]="
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function NewUserConnected(user)
Message(user)
end
function OpConnected(user)
Message(user)
end
function Message(user)
local disp = ""
doGetProfile = GetProfileName(user.iProfile) or "Not registerd"
return 1
end
SendToAll(BotName,"===================================================================")
SendToAll(BotName," ?There are: "..ProfileCounter("Master").." [MASTER] -\r\n")
SendToAll(BotName," ?There are: "..ProfileCounter("Operator").." [OPERATOR] -\r\n")
SendToAll(BotName," ?There are: "..ProfileCounter("Vip").." [VIP]- \r\n")
SendToAll(BotName," ?There are: "..profilecounter("Reg").." [Registerd users]- online \r\n")
SendToAll(BotName," \r\n\r\n")
SendToAll(BotName," ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n")
SendToAll(BotName,"===================================================================")
user:SendData(BotName, disp)
end
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Syntax error: attempt to call global `profilecounter' (a nil value)
stack traceback:
1: function `Main' at line 36 [file `D:\==PTOTAX==\trucker\scripts\usercount.lua']
there is no main in line 36
Here ya go ...
--test by [NL]trucker.
BotName = "-Info-"
function NewUserConnected(user)
Message(user)
end
function OpConnected(user)
Message(user)
end
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function Message(user)
local disp = ""
doGetProfile = GetProfileName(user.iProfile) or "Not registerd"
disp = disp.." \r\n===================================================================\r\n"
disp = disp.." ?There are: "..ProfileCounter("Master").." [MASTER] online\r\n"
disp = disp.." ?There are: "..ProfileCounter("Operator").." [OPERATOR] online\r\n"
disp = disp.." ?There are: "..ProfileCounter("Vip").." [VIP] online\r\n"
disp = disp.." ?There are: "..ProfileCounter("Reg").." [Registerd users] online \r\n"
disp = disp.." \r\n"
disp = disp.." ?There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.." ==================================================================="
user:SendData(BotName, disp)
end
Optimus
your my lifesaver [ugh ugh] :-))
works perfect
thnx a lot.
yah gekko uses same method :)