[request] User Profile Upgrade/Downgrade
 

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

[request] User Profile Upgrade/Downgrade

Started by Psycho_Chihuahua, 26 May, 2005, 18:25:47

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Psycho_Chihuahua

What i'm looking for is a script with which one can up-/downgrade Userprofiles.....

Would be great if it would work with Profile numbers instead of Profile Names though (as a lot of ppl have custom profiles.

up-/Downgrade example:

reg to VIP/OP/Master
VIP to Reg/OP/Master
OP to Reg/VIP/Master
Master to Reg/Vip/OP and so on

Could someone be so kind  :D

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Markitos

QuoteOriginally posted by Psycho_Chihuahua
What i'm looking for is a script with which one can up-/downgrade Userprofiles.....

Would be great if it would work with Profile numbers instead of Profile Names though (as a lot of ppl have custom profiles.

up-/Downgrade example:

reg to VIP/OP/Master
VIP to Reg/OP/Master
OP to Reg/VIP/Master
Master to Reg/Vip/OP and so on

Could someone be so kind  :D



Use robocop...

Psycho_Chihuahua

well a standalone would be more appropriate because i have german Users and they dont understand english thats why i requested one  :D
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Madman

This should do it...

-- Up/Down-grade script
-- Made by Madman

Bot = "UpDownGrade"

function ChatArrival(curUser, data)
	local data = string.sub(data, 1, -2)
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+%?%#](%S+)")
	if cmd then
		local tCmds = {
		["upgrade"] = function(curUser, data)
			if curUser.bOperator then
				local s,e,Nick,pNr = string.find(data, "%b<>%s+%S+%s+(%S+)%s+(%d+)") -- Catch Nick and pNr
				if not Nick or not pNr then -- We didn't find them
					curUser:SendData(Bot, "I need a nick and a profile nr") return 1
				end
				if tonumber(pNr) >= 4 then -- If pNr higer then 4
					curUser:SendData(Bot, "Profile number to high!") return 1 -- Stop the upgrade
				end
				if curUser.sName == Nick then -- You can't upgrade yourself
					curUser:SendData(Bot, "You can't upgrade yourself")
				end
				if curUser.iProfile == 1 and tonumber(pNr) <= 1 then -- Block Ops from upgrade users to Op or higher
					curUser:SendData(Bot, "You can't upgrade user to profiles higher then youself") return 1
				end
				if frmHub:isNickRegged(Nick) then -- If Nick is regged
					if GetUserProfile(Nick) < curUser.iProfile then -- If Nick has higher profile then you
						curUser:SendData(Bot, Nick.. " has a higher profile then you") return 1 -- Cant upgrade
					end
					AddRegUser(Nick, frmHub:GetUserPassword(Nick), pNr) -- Upgrade nick
					SendToOps(Bot, curUser.sName.. " upgraded " ..Nick.. " to " ..GetProfileName(pNr)) return 1 --
				end
				curUser:SendData(Bot, "User ain't regged") return 1 -- User was not regged
			end
			curUser:SendData(Bot, "You are not allowed to use this command")
		end,
		}
		if tCmds[cmd] then
			return tCmds[cmd](curUser, data)
		end
	end
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Psycho_Chihuahua

thnx m8 i'll give it a try  :D
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

jiten

#5
Came too late :)
Anyway, here goes my attempt:
--/--------------------------------------------------------------------------------------------
-- Upgrade and Downgrade v1.0 by jiten
-- Small optimization in the error msgs
--/--------------------------------------------------------------------------------------------

sBot = frmHub:GetHubBotName()

-- Profiles allowed to use !upgrade command ([x] = 1 (allowed) or 0 (not))
AllowedProfiles = { [-1] = 0, [1] = 1, [2] = 0, [3] = 0, [4] = 1, [5] = 1, [0] = 1, }

-- Profile order (higher value means has more powerful)
Levels = { [-1] = 1, [3] = 2, [2] = 3, [1] = 4, [4] = 5, [0] = 6, [5] = 7, }

ChatArrival = function(user,data)
	local data = string.sub(data, 1, -2)
	local s,e,cmd = string.find(data,"%b<>%s+[%!%?%+%#](%S+)")
	if cmd then
		local tCmds = {
		["upgrade"]	= function(user,data)
			s,e,nick,number = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%d+)") 
			if nick == nil or number == nil then
				user:SendData(sBot,"*** Syntax Error: Type !upgrade  ")
			elseif nick == user.sName then
				user:SendData(sBot,"*** Error: You can't upgrade yourself.")
			else
				for i, profile in GetProfiles() do
					if Levels[user.iProfile] >= Levels[GetItemByName(nick).iProfile] then cUp = 1
						if string.lower(number) == string.lower(GetProfileIdx(profile)) then pExists = 1 
							if frmHub:isNickRegged(nick) then
								AddRegUser(nick, frmHub:GetUserPassword(nick), number) isRegged = 1
								user:SendData(sBot,nick.." was successfully upgraded by "..user.sName.." to "..GetProfileName(number).." status.")
								SendPmToNick(nick,sBot,user.sName.." upgraded your status to "..GetProfileName(number).." profile!");
								break
							end
						end
					end
				end
				if cUp == nil then
					user:SendData(sBot,"*** Error: You can't upgrade profiles higher than yours.")
				elseif pExists == nil then
					user:SendData(sBot,"*** Error: That profile doesn't exist.")
				elseif isRegged == nil then
					user:SendData(sBot,"*** Error: You can't upgrade unreg users.")
				end
			end
		end,
		}
		if tCmds[cmd] and AllowedProfiles[user.iProfile] == 1 then
			return tCmds[cmd](user,data), 1
		else
			return user:SendData(sBot,"*** Error: You are not allowed to use this command."), 1
		end
	end
end
-----------------------------------------------------------------------------------------------

Best regards,

jiten

Psycho_Chihuahua

QuoteOriginally posted by jiten
Came too late :)
Anyway, here goes my attempt:

 :D  thnx to you to Jiten, rather late then never *g well i'll give this one a try as well and then i shall see wich is better  ;)
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

jiten


SMF spam blocked by CleanTalk