i need help making a new command

i want to make a command for dark rp so that you can make a player able to walk through props can i have some help a good tutorial etc.

[lua]concommand.Add(“rp_nocollide”,function(ply)
if ply:IsAdmin() then
for _,v in ipairs(player.GetAll()) do v:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER) end
end
end)[/lua]

I think that’s the closest thing you could get. Try that.

ok ill try it thank you

[editline]09:45PM[/editline]

wait for dark rp where would i find the commands list also how would i make it so i could use it on a non admin?

[editline]09:58PM[/editline]

You put this in a new lua file in your /garrysmod/lua/autorun/server folder. And this works on everyone; the whole IsAdmin() thing only lets admins run this command.

-retracted didnt read

yah and i need to be able to give it to a non admin player so that they can go through a prop block.

It does that. Just use the command.

and what look at the person?

Here’s something that might work, but I haven’t tested it. simply say the chat command with the player’s name (or part of it) to toggle the collisions on him. This will only work in DarkRP.

[lua]
function TogglePhase(ply, args)
if ply:HasPriv(ADMIN) then
target = FindPlayer(args)
if target.Phased == nil then target.Phased = false end

	if target.Phased == false then
		target:SetCollisionGroup(COLLISION_GROUP_DEBRIS_TRIGGER)
		target.Phased = true
	else
		target:SetCollisionGroup(COLLISION_GROUP_PLAYER)
		target.Phased = false
	end
	
end

return ""

end

AddChatCommand("/togglephase", TogglePhase)[/lua]

Just type it in the console.

He wants to enable it for only 1 player at a time, a player who’s name is specified by the admin. Your code works but it enables it for everyone.

edit : My bad about calling it your code Jamie932 :slight_smile:

no how does it know who im typing the console about

Well, I cant really understand him that well, and I just said it to give him a lowdown about how to use the snippet of code above. And its not my code, its Entoros’.

It doesnt, Entoros’ code does it for all the players on the server. If you want it for one player only, Use Crazy Quebec’s code.

ok thats what i ment thank you jamie

[editline]11:13PM[/editline]

also do any of you know of any good tutorials for lua about anything.

PiL (Click it)

ok im going to read that thanks any other SMALL ones?

Just read the functions in the Wiki, to get familiar with them.

the wiki one is very useful thank you.