Help Whit Commnad
 

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 Whit Commnad

Started by dragos_sto, 26 April, 2005, 09:48:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dragos_sto

some little question how to use this command
GetOnlineRegUsers() and what return
? a number and vor 0 value return nil ?
and this command for specify profile return the specify user profile online , GetOnlineUsers(ProfileNumber)   
 how to specify the profile number ?

this return a table and not a number ?
and i huve to number the user from the table ?

10x a lot for help

dragos_sto

I make some  excavations and ai meke next code  8)
--//Reg User Count
function OnlineRegUsers()
	local table, count = frmHub:GetOnlineUsers(), 0
	for i, User in table do
		if User.iProfile >=0 then
			count = count + 1
		end
	end
	return count
end


i hope some one to uset  :D

Dessamator

here u go:
QuoteGetOnlineUsers(ProfileNumber)      - Without number return table with all logged user objects, with number only users with given profile.
Ignorance is Bliss.

jiten

QuoteOriginally posted by dragos_sto
some little question how to use this command
GetOnlineRegUsers() and what return
? a number and vor 0 value return nil ?
and this command for specify profile return the specify user profile online , GetOnlineUsers(ProfileNumber)   
 how to specify the profile number ?

this return a table and not a number ?
and i huve to number the user from the table ?

10x a lot for help
When in doubt, check the "PtokaX\Scripting-Interface.txt" ;)

Cheers

dragos_sto

i'm not always understand what  they want from me :D
or how to work whit the command,
par example il try to use the command
GetOnlineUsers(ProfileNumber) and put a number between () ..and dont success whit tis command

jiten

Try using this:
GetOnlineUsers(GetProfileIdx(ProfileName)) -- where ProfileName is its name (reg,vip,op,master,etc)
Cheers

Dessamator

or this

for i,user in GetOnlineUsers(GetProfileIdx(ProfileName)) do -- where ProfileName is its name reg,vip,op,master,etc)
SendToAll(user)
end
Ignorance is Bliss.

dragos_sto

hi , i dont whant to make vizible to all , just whant to make my own statisitc :)

jiten

If you want to know the online reg users why don't u use:
frmHub:GetOnlineRegUsers()

Cheers

Dessamator

#9
well use let me explain it better then, the
frmHub:GetOnlineRegUsers()

is just a table of online users, for example if u have a hub with 3 users, namely , John , JJ and Joe.

What that api(frmHub:GetOnlineRegUsers()) does is simply, take those 3 users and put it in a table like so::

   
onlineusers ={[1]="John",
                       [2]="JJ",
                       [3]="Joe",}


and all u need to do is read from it(the table), and use it for ur purposes!
Ignorance is Bliss.

dragos_sto

true it a lite bate faster ,
one question less for each user
but to obtain a number the for remain :(

jiten

QuoteOriginally posted by dragos_sto
true it a lite bate faster ,
one question less for each user
but to obtain a number the for remain :(
Can you explain us what exactly u want to do? Maybe we can post a script that can help u understand.

Best regards.

Dessamator

QuoteOriginally posted by jiten
QuoteOriginally posted by dragos_sto
true it a lite bate faster ,
one question less for each user
but to obtain a number the for remain :(
Can you explain us what exactly u want to do? Maybe we can post a script that can help u understand.

Best regards.

indeed !!
Ignorance is Bliss.

dragos_sto

10x a lot for help whit the script,
i realy want to know the sintax  
exactly (whit one example ) for each command
to create my own script , in lua  4 brainmaster make a verry good script ho dont was compile ,
so i may change'it for my need ,
and understend some command from him ,
now i try to understeand how to use the new command ,
and whit some help i understend few command
shame for me :( , i dont have enough time to make
test and this it the reason i try to find more whit your help in little time i have

my own script will be public when i will finish him ..


i'm crazy whit statistics

jiten

Have a look at this then:
-- frmHub:GetOnlineUsers example : Send PM to all user of a certain profile (VIP in this one)

Bot = frmHub:GetHubBotName()

ChatArrival = function (user,data)
	data = string.sub(data, 1, -2)
	local s,e,cmd,args = string.find( data, "%b<>%s+(%S+)%s*(.*)")
	if cmd == "!msgvip" then
		if user.bOperator then
			if args then
				for i, nick in frmHub:GetOnlineUsers() do
					if nick.iProfile == 2 then
						nick:SendPM(Bot, user.sName.." sent this message: "..args)
					end
				end
			else
				user:SendData(Bot, "*** Syntax Error: Type !msgvip msg")
			end
		else
			user:SendData(Bot,"*** Error: You are not allowed to use this command.")
		end
		return 1
	end
end
-- frmHub:GetOnlineRegUsers example : Send PM to all REG Profile users

Bot = frmHub:GetHubBotName()

ChatArrival = function (user,data)
	data = string.sub(data, 1, -2)
	local s,e,cmd,args = string.find( data, "%b<>%s+(%S+)%s*(.*)")
	if cmd == "!msgreg" then
		if user.bOperator then
			if args then
				for i, nick in frmHub:GetOnlineRegUsers() do
					nick:SendPM(Bot, user.sName.." sent this message: "..args)
				end
			else
				user:SendData(Bot, "*** Syntax Error: Type !msgreg msg")
			end
		else
			user:SendData(Bot,"*** Error: You are not allowed to use this command.")
		end
		return 1
	end
end
Cheers

Stravides

I'm trying to write something similar - ie a per profile lister... but it wont work for the UNREGGED users

i've tried using profile -1 but doesnt work :(

can anyone please help ???

function GetUsers(user,data,arg)
	if arg==nil then
		arg1 = "Unregistered"
	else
		arg1 = GetProfileName(arg)
	end
	user:SendPM(BOTName ,"------ Users of type: "..arg1.." ----- ")
	for i,usr in frmHub:GetOnlineUsers() do 
		if arg == nil and usr.iProfile == nil then
			user:SendPM(BOTName,"Unregged\t - \t"..usr.sName)
		elseif usr.iProfile == tonumber(arg) then
			user:SendPM(BOTName,GetProfileName(usr.iProfile).."\t - \t"..usr.sName)
		end
		
	end
	return 1
end
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Dessamator

function GetUsers(user,data,arg)
	if arg==nil then
		arg1 = "Unregistered"
	else
		arg1 = GetProfileName(arg)
	end
	user:SendPM(BOTName ,"------ Users of type: "..arg1.." ----- ")
	for i,usr in frmHub:GetOnlineUsers() do 
		if arg == nil and not(usr.bRegistered) then
			user:SendPM(BOTName,"Unregged\t - \t"..usr.sName)
		elseif usr.iProfile == tonumber(arg) then
			user:SendPM(BOTName,GetProfileName(usr.iProfile).."\t - \t"..usr.sName)
		end
		
	end
	return 1
end
Done!!,

(Untested)
Ignorance is Bliss.

Stravides

Many thanks -- sorted now
didnt even think of that heheheheh
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Dessamator

QuoteOriginally posted by Stravides
Many thanks -- sorted now
didnt even think of that heheheheh

yw,  :))
Ignorance is Bliss.

SMF spam blocked by CleanTalk