help please explanation needed.
 

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 please explanation needed.

Started by [NL]trucker, 05 March, 2004, 11:25:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[NL]trucker

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.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


VERMiN

All your disp = disp lines are not within a function.

Your last "end" doesn't end anything then ;)
The damned creator of [-MORBID-].  \" A damn fine security script \" [/COLOR]


HOMEPAGE
E-mail

[NL]trucker

so what you are saying is that i should replace
disp = disp

with something like this

SendToUser SendToAll(BotName,)

and then it should work?
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


[NL]trucker

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
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


Optimus

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

[NL]trucker

Optimus

your my lifesaver [ugh ugh] :-))


works perfect

thnx a lot.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


pHaTTy

yah gekko uses same method :)
Resistance is futile!

SMF spam blocked by CleanTalk