HowTo make a "Victim" function?
 

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

HowTo make a "Victim" function?

Started by Madman, 24 June, 2004, 21:16:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

i want to know how to make a vitim function...
like the !kick command...

Something like
if !cmd then
SendToAll (Bot, " "..curUser.sName.." comands "...victim.sName.." to go to hell!")

Hope i Explained good.....It is a little hard to explain...

*edit*
forgot something... If the nick of the user is not writen exactly right the bot wont say anything....
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

plop

check the howto section of the board.
specialy the lessons.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Troubadour

#2
if (cmd == "!victim" ) then
_,_,cmd,vicname = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
SendToAll (Botname, " "..user.sName.." commands "..vicname.." to go to hell!")
return 1

I did NOT check it (this is just an example)
Regards,

Troubadour

** Guardian Forum **

hubaddy:   nederfun.no-ip.com

[UK]Madman

GetIemByName(vicname)

Can check if username is currently online

NightLitch

--// call command
if cmd=="!anything" then
--// parse the data string to catch the "victim" nick
  local s,e,victim = strfind(data, "%b<>%s+%S+(%S+)")
--// if no victim nick entered then return syntax message
  if victim==nil then
    user:SendData(Bot, "Syntax: !anything ")
    return 1
  end
--// check if nick/user is online
  vUser = GetItemByName(victim)
  if not vUser then
    user:SendData(Bot, victim.." is not online or not wrong name...")
    return 1
  end
--// do the "warn" "kick" "ban" whatever code here...
  SendToAll(Bot, vUser.sName.." have benn banned by "..user.sName)
  vUser:SendData(Bot, You have been Banned!")
  vUser:Ban()
end

This should not be hard understanding...

/NL
//NL

Madman

First of all, thanks to NightLitch that gave me the code...
I have added some stuff to the code... Just thought i would share it... Maybe someone can find it usefull =)

--//User To send Text 2 (victim function)
-- 1=on / 0=off
SendTo = {
[0] = 0,   -- Masters
[1] = 1,   -- Operators
[2] = 1,   -- Vips
[3] = 1,   -- Regs
[4] = 0,   -- Moderator
[5] = 0,   -- NetFounder
[-1] = 1,  -- Users
}

	--//victim funtion
		--// call command
		if cmd == "!throw" then
		--// parse the data string to catch the "victim" nick
  		local s,e,victim = strfind(data, "%b<>%s+%S+%s+(%S+)")
		--// if no victim nick entered then return syntax message
  		if victim == nil then
		   curUser:SendData(Bot, "Syntax: !throw nick")
	    return 1
  		end
		--// check if nick/user is online
  		vUser = GetItemByName(victim)
  		if not vUser then
    		curUser:SendData(Bot, " *** " ..victim.." is not online or wrong name...")
    	return 1
  		end
  		--//Check if you is victim
  			if curUser.sName == vUser.sName then
  				curUser:SendData(Bot, "Why throw your self?")
  			return 1
  			end
  		--//Safe Function 4 Ops
		if vUser.bOperator then
		--//Send sendData To Users in Send To List (in the begining....)
			if (SendTo[curUser.iProfile]==1) then
				curUser:SendData(Bot, "You Are Not Allowd To Throw Ops!")
		--//But if master or higher, throw user and skip above text... Mohaha! Evil!
				elseif (curUser.iProfile == 0) and (vUser.bOperator) then
				--// do the "Throw" code here...
					SendToAll(Bot, vUser.sName.." has been thrown out of the hub by "..curUser.sName)
  					vUser:SendData(Bot, "You have been thrown out of the hub by "..curUser.sName.."!")
  					vUser:Disconnect()
  				end
  		--//End of Safe function
		else
		--// do the "Throw" code here...
			SendToAll(Bot, vUser.sName.." has been thrown out of the hub by "..curUser.sName)
  			vUser:SendData(Bot, "You have been thrown out of the hub by "..curUser.sName.."!")
  			vUser:Disconnect()
			end
		end
	--//End of vicim function
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk