Script Help?

I need help on a script that can only be or one job, so basically you type !sit in chat and you teleport to a certian area on the map. Any help?

What do you need help with? The chat command or


Both and the teleport

Well, start by reading the chat command page. All you need to do is check the player’s team is whichever one you want and then just use

Entity:SetPos to teleport them.

[editline]30th July 2016[/editline]


-- serverside:
local function Teleport(ply, args)
	if ply:Team() == WHATEVER_TEAM_YOU_WANT_MATE then
		ply:SetPos( Vector( SOME_POSITION ) )
	return ""

DarkRP.defineChatCommand("sit", Teleport)

-- shared:
	command = "sit",
	description = "Teleport to somewhere",
	delay = 0

Note that I don’t have DarkRP so you might have to do something else to check the team

and that would be put in lua/autorun/ correct?

No, the code under “-- serverside:” would go in lua/autorun/server/sv_file.lua
the code under “-- shared:” would go in lua/autorun/file.lua

Thanks so much!

It does not have to go there. If it does not matter that a client can see the code in the cache, then

if SERVER then
:serverside code
:clientside code

would work fine.