JEDi Script Project
 

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

JEDi Script Project

Started by -PT-B2S, 05 July, 2005, 15:25:48

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-PT-B2S

Hello

I'm doing a script "all in one" and i need help with one thing.

I need a part for this script that can manage the enabled and disabled commands for each profile.

For example:



Command !MyInfo :

Master = 1
Operator = 1
Vip = 1
Reg = 0
User = 0

o = disabled
1 = enabled


Please help me with this part. I will put this part in the script i am doing and when it's finished, i will put the script here. It's a real good "all in one" script. Very simple and not heavy (200KB in ptokax)

Thnks in advance,

Props

Corayzon

just use a table like so...

tCommandLevels.Command[sCommand][sProfile] = 1\0

so in ur example it would be

Command !MyInfo :

tCommandLevels.Command["MyInfo"]["Master"] = 1

tCommandLevels.Command["MyInfo"]["Operator"] = 1

tCommandLevels.Command["MyInfo"]["Vip"] = 1

tCommandLevels.Command["MyInfo"]["Reg"] = 0

tCommandLevels.Command["MyInfo"]["User"] = 0

or in cSlave u can simply  :O

function fFunction(User, sData, bInPm)

	-- Code here for command

end

cSlave.Commands.Register(sCommand, fFunction, iMinimumLevel, sUsage, sInformation)

-PT-B2S

Hello Corayzon

Command !MyInfo :

tCommandLevels.Command["MyInfo"]["Master"] = 1

tCommandLevels.Command["MyInfo"]["Operator"] = 1

tCommandLevels.Command["MyInfo"]["Vip"] = 1

tCommandLevels.Command["MyInfo"]["Reg"] = 0

tCommandLevels.Command["MyInfo"]["User"] = 0


So, how does the script knows that ...
tCommandLevels.Command["MyInfo"]["Reg"] = 0
...is for the profile number 3, for example?


i am really confused about this part.

What i want to do, is a part of the great robocop script, where you can manage what commands are enabled to each profile. Then i want to do this:

Command !userinfo

Operators can do !userinfo on "REG" "VIP" and "USER"
Operator can't do !userinfo on "OP" and "MASTER"

Command !kick

Operators can do !user info on "REG" and "USER"
Operator can't do !kick on "VIP" "OP" and "MASTER"


Do you know how to do that? can you explain with an exemple of 1 or 2 commands? Thnks

Dessamator

it isnt that hard, all hes saying is that u should use a table to store each command, and what profile can acess it
 "myinfo" <-- thats the command
"Master" <-- thats the profile
"1" <-- that means users with that profile can use the command
"0" <-- means the inverse of above
Ignorance is Bliss.


??????Hawk??????

#5
  
 
tAllow = { 
	[0] = 1, 	--// Master 
	[1] = 1, 	--// Operator 
	[2] = 1, 	--// Vip 
	[3] = 1, 	--// REG 
	[-1] = 0,	--// non-Reg Users 
	} 


if tAllow[CurUser.iProfile] == 1 then	
	[COLOR=green]--// Do Your Crap Here[/COLOR] 
end


Look Forward to seeing your script  :)  :)

-PT-B2S

#6
Thnks people... sorry but i am not understanding :S

Please specify a little bit more. I've already ask for optimus help in PM (Optimus, please see your PM), and i ask for help of others too.

Well, maybe i'm not explayning myself very well.
So, What i want is:

I want my script to do some funcions of robocop, like manage enabled and disabled commands to each profile, managed who can ban who (kick, warn, ban...) and who can PM who.

Thanks and specify a little bit more what i have do add to this script, please.

Props

TTB

#7
this should also work I think (just a thought):

tAllow = { 
	[0] = 5, 	--// Master 
	[1] = 4, 	--// Operator 
	[2] = 3, 	--// Vip 
	[3] = 2, 	--// REG 
	[-1] = 1,	--// non-Reg Users 
	} 

function ChatArrival

if cmd == "#rules" and tAllow[CurUser.iProfile] >= 1 then
	function showrules
	return 1
elseif cmd == "#ban" and tAllow[CurUser.iProfile] >= 4 then
	function ban
	return 1
end

end

I could be wrong, but I think it should be right...

Good luck
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Dessamator

yes it can work, but its more efficient to parse all the commands in a table, as it was done in zrightclicker .
Ignorance is Bliss.

-PT-B2S

Thnks Dessamator

Really good idea you gave me ;)

Props

-PT-B2S

#10
Hello Again people.

I have another help request.

In the user info part of the script, i will like to so a change, but i don't know how.

When i enter the hub, it shows this :

[18:56:15] <[BOT]Zeus> Hello your share is 400.26899126824 GB.
 

i would like to change this part (400.26899126824 GB) to this:

400.27 GB

Is the any way to do it?

Thnks

TTB

#11
Hi...

this is simple :-)  

I will give you an example... from the bot I build now...

ChatArrival:
elseif (string.lower(cmd) == (prefix.."share")) then
		SendToUser(curUser, "Your current sharesize is: "..string.format( "%.2f",curUser.iShareSize / gb).." Gb.")
		return 1
where gb is:
gb = 1024*1024*1024

This is the interesting part for you:
string.format( "%.2f",curUser.iShareSize / gb)

The  "%.2f"   will do the job!

Good luck!
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

Very simple :)

Thanks TTB

props

TTB

np...  :D

You're welcome
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

#14
hello.

i have another question. I want to notify only a single profile (in this case, profile master, profile number 0) when somebody enters the hub. Is that possible?

Thanks

Props

TTB

Here u have:

-- Hello bot by TTB
-- wrote in 1 minute

bot = "Hello"

function Main()
	frmHub:RegBot(bot)
end

function OpConnected(user,data)
	if user.iProfile == 0 then
		SendToAll(bot, "Hello Master "..user.sName..". Have a nice trip...")
		return 1
	end
end
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

-PT-B2S

Hello TTB

It's not like that. This is very simple. LOL

What i want is:

I want the script to send a PM to the founder of the hub, each time an user enters the hub. The message is only to the founder, and not to all OPs. The founder have the profile number 0.

Thnks

GeceBekcisi

-- Hello bot by TTB
-- wrote in 1 minute
-- Edited by GeceBekcisi to satisfy -PT-B2S's needs

sBot = "Hello"
sOwner = "Write here your nick"

function Main()
	frmHub:RegBot(sBot)
end

function NewUserConnected(curUser,data)
	SendPmToNick(sOwner, sBot, ""..curUser.sName.." entered hub.")
	return 1
end
Do you need an advanced user handling script? Download UserBekcisi today (Latest Edit)
Features: User + ISP + GeoIP database, user info + share checking and many more...

-PT-B2S

yeah :D

this is the way i have it already.

But this only sends the message to a specified nick. I really want it to send to a profile number, instead of nick :)

Thnks

Dessamator

tis simple, do an if statement, in the newuserconnnected

hint :
if user.iProfile == ? then ...
Ignorance is Bliss.

NightLitch

QuoteOriginally posted by Dessamator
tis simple, do an if statement, in the newuserconnnected

hint :
if user.iProfile == ? then ...

No you need to get online user from specific profile and send...

Table is required...

this should be helpfull not tested... done in 2 min

---------------------------------------------------------------------------------------------------
--## Annouce Users To Profile - Bot by: NightLitch
---------------------------------------------------------------------------------------------------
botName = "Reporter" -- Set Botname
sendMsgIn = "PM" -- Set ( MAIN ) or ( PM )
sendToProfile = "Master" -- Set ProfileName to send Msg to
sendMessage = " entered the hub" -- Set Msg to send (  ) is replaced with users Nickname
---------------------------------------------------------------------------------------------------
function Main()
	frmHub:RegBot(botName)
end
---------------------------------------------------------------------------------------------------
function NewUserConnected(sUser)
	local op =GetOnlineOperators() --- Return table with all logged user objects with operator status.
	for i = 1,table.getn(op) do
		if GetProfileName(op[i].iProfile) == sendToProfile then
			if sendMsgIn == "PM" then
				op[i].SendPM(botName, string.gsub(sendMessage, "", sUser.sName) )
			elseif sendMsgIn == "MAIN" then
				op[i].SendData(botName, string.gsub(sendMessage, "", sUser.sName) )
			end
		end
	end
end
---------------------------------------------------------------------------------------------------
--// NightLitch 2005-07-16

cheers
//NL

Dessamator

hmm, yap looks better,
 i misread the request :)
Ignorance is Bliss.

-PT-B2S

Thanks very much Dessamator and NightLitch


i have made it another way:


--PM TO A DEFINED PROFILE WHEN USER ENTER THE HUB--
--By -PT-B2S
--20-07-2005

---------------------------------------------------------------------------------------------------

iPmToProfile = "name of the profile who will receive the PM)

sBot = "name of the bot"

function NewUserConnected(oUser)
	pmto = GetUsersByProfile(iPmToProfile)	
	pmto:SendData(sbot, "new enter : "..oUser.sName.." . ")
end



Thnks and props

-PT-B2S

#23
Now i have another question.

I need a command to the script that the script will know if the user is online.
Something like this:

if oUser is online then


I know this is not the right way to do it, so...

function NewUserSeeing this(oUser)
	if (oUser knows how to do this) then
		SendTo-PT-B2S(oUser, "I know how to do it. It's this way: ......... ")
	end
end


ehehehe

Just kidding, but if you know it, tell me please.

Thnks and props

??????Hawk??????

#24
local Nick = GetItemByName(UserName)

  if Nick then

    User is online

SMF spam blocked by CleanTalk