• i need help making a new command
    17 replies, posted
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]
[QUOTE=Zombiedance;16588095]and what look at the person?[/QUOTE] Just type it in the console.
[QUOTE=Jamie932;16588412]Just type it in the console.[/QUOTE] 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 :)
[QUOTE=Jamie932;16588412]Just type it in the console.[/QUOTE] 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'. [QUOTE=Zombiedance;16588506]no how does it know who im typing the console about[/QUOTE] 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.
[url=http://www.lua.org/pil/]PiL[/url] (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. [url]http://wiki.garrysmod.com/?title=Main_Page[/url]
the wiki one is very useful thank you.
Sorry, you need to Log In to post a reply to this thread.