Need help with DarkRP Custom Commands

I need help coding a new chat command similar to /ooc and /advert

Any help is needed, sorry for my poor English. Thank you

Can you code lua at all yet?

Have a look at these tutorials and start learning - it won’t take you long before you can make a simple chat command. Any help you need most here and we’ll answer questions.

In addition to Semajnad’s post, people on Facepunch normally won’t “spoon feed” you the code.

Look at

GM:PlayerSay


hook.Add("PlayerSay", "ChatCommand", function( ply )
    -- check chat command
    -- if matches, do your stuff
end

i can do some lua coding, for example i can do jobs and most darkrp things

That’s not lua coding. That’s configuration.

oh well, never mind then

That’s not to say you can’t learn. Lua isn’t as hard as you think to get started with, and once you know it, you can make a lot of stuff with basic knowledge. If you are gunna start learning then add me on Steam and I’ll help where I can.

Oh thank you for your support

[editline]23rd April 2016[/editline]

i added you so i can make sure if something is correct

Tell you what, if you seriously want to learn, here’s an example of how to use a chat command:



hook.Add( "PlayerSay", "AdjustMoney", function( ply, txt )
	local args = string.Explode( " ", txt )
	if args[1] == "!adjustmoney" then
		for _, pl in pairs( player.GetAll() ) do
			if pl:Nick() == args[2] then
				pl:addMoney( args[3] )
                                break
			end
		end
	end
end )


Some of that may be wrong, but hopefully you get the idea.

Well that won’t work if the player has any spaces in their name, for one. Still a good start for the OP though.

That’s true actually :stuck_out_tongue: Nice call.
Although the latest I gave him over steam used string.sub instead, so that issue is fixed. But thanks for pointing it out.