What am i doing wrong?

I have a DarkRP server and i am trying to create a simple lua.

The thing that im trying to do is: when a hitman accepts the hit the hitman automaticly say “/ad Hit Accepted.”
But nothing happens when i execute the lua with “lua_openscript”

Here’s the code, what am i doing wrong?

function hitman( ply, text, team )	
	if onHitAccept then
		ply:ConCommand("say /ad Hit Accepted.")

hook.Add("ConCommand" , "hitserverside" , hitman)


I would take a look at http://wiki.garrysmod.com/page/Hook_Library_Usage

ConCommand isn’t a valid hook name and reading that will probably give you a better understanding of hooks

Falco made his own DarkRP wiki and it has all of the info you need to to do something like that, mainly this http://wiki.darkrp.com/index.php/Hooks/Shared/onHitAccepted

I tried this with;

function hitman( ply, text, public )	
	if onHitAccepted then
		ply:Say("/ad Hit Accepted.")

hook.Add("PlayerSay" , "hitman" , hitman)

and it didn’t worked again.

I know nothing about DarkRP, but this might work if you run it serverside:

hook.Add( "onHitAccepted", "HitServerSide", function( hitman, target, customer )
    hitman:Say( "/ad Hit Accepted." )
end )

At what point did anyone mention or give the slightest hint whatsoever about anything even mildly related to PlayerSay?
Why do you expect a PlayerSay hook to even have the slightest relevance to a hitman event?

PlayerSay is called when a player types a chat message. onHitAccepted is called when a hitman accepts a hit.

Sorry for getting triggered, but this should be very obvious by the names of the hooks alone.

I’ll try it later, i don’t have anybody to try it right now.
Thanks for your help.

[editline]15th October 2017[/editline]

Sorry for that too :slight_smile:
I forgot to say that i am new in Lua, so please forgive me.