Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

Custom commands and killing spree displays

- - - - -

  • Please log in to reply
10 replies to this topic

#1
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

I am learning the basics of the silent mod and I have encountered a couple of problems. I would like to create a custom command called !spec - which would work in the same way as the !spec command on jaymod. This is a feature that has been requested and I think it is quicker than finding the slot number and using /follow. However, i can't seem to get this command to work. I have no idea if i am right but i tried this:

 

[command]

command = spec

exec = follow (name|slot#)

desc = spectates the player

syntax =

levels = 3 4 5

 

I doubt that 'follow' function or the 'name/slot' part is correct and this is where i'd like some assistance. What do i need to exec in order to spectate a player, if it's possible of course. Other random custom cmds have been fine so far.

 

Also, is there a way to incorporate say the jaymod style killing sprees (or something similiar). The (animation?) green-coloured killing spree was quite a nice feature which players seem to want on the server too, but i don't know what format the sprees are in but in particular whether i can edit the killing spree display. Here's a picture of what I mean: http://i70.servimg.c...90/94489211.jpg  It's default currently, just displaying the msgs in the console.

 

Forgot to add - could this be possible using lua?

 

Thanks.


Edited by Arcane, 01 March 2013 - 11:35 PM.


#2
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

The !spec command is not possible through regular commands that the server can execute. I'm not sure if editing the sess.spectatorClient with http://mygamingtalk....Lua#gentity_set will work. You can try but there are risks when editing these fields so proper testing should be done before adding the script to your public server. Also, the sess.spectatorState must be set to the value 2 at the same time.

 

The second question, it is partly possible with Lua. In Jaymod, the announcements are announced to all the players, which is different form silEnT announcements. However, the animation is not possible. Only options are the usual chat line, popup, center print and the top of the screen.



#3
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

Ok, thankyou very much for your reply, it's greatly appreciated!



#4
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

I'm not sure if editing the sess.spectatorClient with http://mygamingtalk....Lua#gentity_set will work. You can try but there are risks when editing these fields so proper testing should be done before adding the script to your public server. Also, the sess.spectatorState must be set to the value 2 at the same time.

 

Do you think you could explain a little bit more about sess.spectatorClient? I checked its function using the Lua wiki page but i'm still unsure of how I can edit this using gentity_set. I do understand that the value of sess.spectatorState has to be set to 2 but how does this coincide with the spectatorClient. Thanks



#5
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

You must move the player in the specator team (!putteam should work fine), then using Lua to set sess.spectatorClient to be the slot number of the player he wants to spec. In the same function, the sess.spectatorState must be set to the value 2. I don't know if it will work.

 

You can ignore (pass any value you want) the last parameter in the gentity_set function as both of the edited values are integers. The new value is passed in the arrayindex.



#6
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

Sorry to revive this but didn't see any point in creating a new topic. I have created a spec.lua that is a little rough around the edges currently but it is unfinished. It works fine but there are a couple of issues I would like help with.

Firstly, here is the code:

 

function et_ClientCommand(clientNum, command)
   if et.trap_Argv(0) == "spec" then
      if et.trap_Argc() == 2 then
         local targetClientNum = et.ClientNumberFromString(et.trap_Argv(1))
                         et.trap_SendConsoleCommand( et.EXEC_APPEND, "putteam" ..clientNum.. "s")
           et.gentity_set(clientNum, "sess.spectatorState", 2)   
                         et.gentity_set(clientNum, "sess.spectatorClient", targetClientNum)
                           
                else
         et.trap_SendServerCommand(clientNum, "print \"Error: Need two parameters!\"")
      end
      return 1
   end
   return 0
end
 

 

Line 5, Console command does not seem to be working. When I am a spectator I can spec anyone using name/slot, but when I join I team I can't spec anybody at all. I am not put into spec and it does nothing - where have I gone wrong in putting MYSELF (clientNum?) into spec. The following fields (spectatorState and spectatorClient) work fine from here.

 

The other issue is that the script does not return values for non-existent client numbers/names (11 slots listed eg, /spec 12 - this will spec the first available slot of the players on r/b). I was hoping to solve this by using the shortcut [1?] when I attempt to convert this to a custom command (!spec). Would this be sufficient or can I do this in the lua, if so, how?

 

Finally, I still do not understand how to get the spec.lua to run by executing a custom command. For example:

 

[command]

command = example

exec = ???? Can someone give an EXAMPLE of what I need to put here to run spec.lua - is it "lua spec [1?]" ?

desc = blablala

syntax =

levels = 5

 

Thanks.



#7
OFFLINE   gaoesa

gaoesa

    Advanced Member

  • Management
  • PipPipPipPip
  • 4391 posts
341
Will become famous
  • LocationFinland

In shrubbot.cfg

 

[command]
command  = spec
exec     = putteam [i] s; specplayer [i] "[1?]"
desc     = spec any player
syntax   = [name]
levels   = 0 1 2 3 4 5

 

In Lua:

function et_ConsoleCommand(command)
	if et.trap_Argv(0) == "specplayer" then
		if et.trap_Argc() == 3 then
			local clientNum = et.trap_Argv(1)
			local targetClientNum = et.ClientNumberFromString(et.trap_Argv(2))

			et.gentity_set(clientNum, "sess.spectatorState", 2)
			et.gentity_set(clientNum, "sess.spectatorClient", targetClientNum)
		end

		return 1
	end
	return 0
end

 

Notice that the Lua hook is now ConsoleCommand and not ClientCommand.


  • Geo likes this

#8
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

Thanks for the fast reply. I see where I have gone wrong and appreciate you improving and making my original script function. I look forward to testing it out :)



#9
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

I've made an updated version of this using the help you provided, also added in a couple of extra features. Would like to share the spec.lua with others but I don't know where to upload the file, for some reason couldn't upload the lua file on that downloads page



#10
OFFLINE   hellreturn

hellreturn

    Management

  • Management
  • PipPipPipPip
  • 2693 posts
158
On the road to fame

I've made an updated version of this using the help you provided, also added in a couple of extra features. Would like to share the spec.lua with others but I don't know where to upload the file, for some reason couldn't upload the lua file on that downloads page

 

Can you zip the file and upload it? 
 

Thanks



#11
OFFLINE   Geo

Geo

    Regular Member

  • Members
  • PipPipPip
  • 70 posts
12
A step in the right direction
  • LocationUnited Kingdom

Can you zip the file and upload it?
 

Thanks

 

It worked as a .zip file, thanks :) I tested it on 2 servers yesterday and it worked flawlessly, but you may want to test it first just in case.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users