Garry's Mod

Garry's Mod

27 ratings
Some Cool Expression 2s
By NubTheFatMan
This guide gives you some e2s that I am willing to make public. Most I made, along with help of friends. If you have suggestions on what I should make, comment below.
   
Award
Favorite
Favorited
Unfavorite
Chat Logger
@name Chat Logger runOnChat(1) if(chatClk()) { entity():remoteSetCode(getCode()+"\n ["+time("month")+"/"+time("day")+"/"+time("year")+" "+time("hour")+":"+time("min")+":"+time("sec")+"] "+lastSpoke():name()+": "+lastSaid()) } # NOTE: Time will show in server's time, not your time #[[/code]
Distance tracker
@name player tracker @outputs Out @persist T:entity if(first()) { T = findPlayerByName("PLAYER NAME") } runOnTick(1) Mi = toUnit("mi",T:pos():distance(owner():pos())) Ft = toUnit("ft",T:pos():distance(owner():pos())) if(Mi >= 1) { Out = round(Mi,0) } else { Out = round(Ft,0) } # HOW TO USE: # # 1. Spawn e2 # 2. Spawn a screen with one value # 3. Wire value A on screen to Out on e2
Door Controller - FADE
@name Door Controller - FADE @inputs Key1 Key2 @outputs Open @persist Open if(first()) { propSpawnUndo(0) findIncludePlayer(owner()) findIncludePlayer("Name") findByClass("player") A = findToArray() foreach(X,Ply:entity = A) { runOnKeys(Ply,1) } Open = 0 } if((keyClkPressed()=="pad_0") & (keyClk():keyPressed("pad_0"))){ Open = 1 timer("close",5000) } if(clk("close")){ Open = 0 } if(Key1 == 1){ Open = 1 timer("close",5000) } if(Key2 == 1){ Open = 1 timer("close",5000) } #[ Inputs Key1 and Key2 are for keypads, if you want them ]#
E2 Door for you and your friends
@name Door Controler @persist E:entity E1:entity @inputs Open Open2 #################### # Made by that1nub # #################### if(first()) { propSpawnUndo(0) findIncludePlayer(owner()) findIncludePlayer("YOUR FRIEND'S NAME HERE") findIncludePlayer("YOUR FRIEND'S NAME HERE") findIncludePlayer("YOUR FRIEND'S NAME HERE") findIncludePlayer("YOUR FRIEND'S NAME HERE") findIncludePlayer("YOUR FRIEND'S NAME HERE") findIncludePlayer("YOUR FRIEND'S NAME HERE") findIncludePlayer("YOUR FRIEND'S NAME HERE") findByClass("player") A = findToArray() foreach(X,Ply:entity = A) { runOnKeys(Ply,1) } Open = 0 Open2 = 0 } if(first()|duped()){ E = propSpawn("models/hunter/blocks/cube2x2x05.mdl",entity():pos()+vec(-47.25,0,47),1) E:setAng(ang(90,0,90)) E1 = propSpawn("models/hunter/blocks/cube2x2x05.mdl",entity():pos()+vec(47.25,0,47),1) E1:setAng(ang(90,0,90)) } if((keyClkPressed() == "pad_0") & keyClk():keyPressed("pad_0")){ E:setPos(entity():pos()+vec(-94.5,0,47)) E1:setPos(entity():pos()+vec(94.5,0,47)) timer("Close",5000) } if(Open == 1){ E:setPos(entity():pos()+vec(-94.5,0,47)) E1:setPos(entity():pos()+vec(94.5,0,47)) timer("Close",5000) } if(Open2 == 1){ E:setPos(entity():pos()+vec(-94.5,0,47)) E1:setPos(entity():pos()+vec(94.5,0,47)) timer("Close",5000) } if(clk("Close")){ E:setPos(entity():pos()+vec(-47.25,0,47)) E1:setPos(entity():pos()+vec(47.25,0,47)) }
E2 Mine
@name Mine @persist On interval(1) entity():propNotSolid(1) entity():propDraw(0) findExcludePlayer(owner()) findExcludeEntities(owner():steamFriends()) if(first()|duped()){On = 0} if(first()|duped()){ timer("On",2500) holoCreate(1,entity():toWorld(vec(0,0,0)),vec(1.5,1.5,0.1),entity():toWorld(ang(0,0,0)),vec(255,255,255)) holoModel(1,"models/holograms/hq_cylinder.mdl") holoMaterial(1,"models/gibs/metalgibs/metal_gibs") holoCreate(2,entity():toWorld(vec(0,0,0.5)),vec(1,1,0.1),entity():toWorld(ang(0,0,0)),vec(255,0,0)) holoModel(2,"models/holograms/hq_cylinder.mdl") } if(On == 0){ holoColor(2,vec(255,0,0)) } if(clk("On")){ On = 1 } if(On == 1){ holoColor(2,vec(0,255,0)) findIncludeClass("player") findIncludeClass("npc") findInSphere(entity():pos(),50) if(findToArray():count() > 0) { propSpawn("models/props_c17/oildrum001_explosive.mdl",entity():pos(),1):propBreak() On = 0 timer("Reset",10000) } } if(clk("Reset")){ On = 1 }
E2 teleport (aim position and e2) (Nexus core needed)
@name Warp E2 # Say "/warp e2" to teleport your e2 # Say "/warp" to teleport to your aimpos (CAN GET STUCK IF DONE ON WALLS) runOnChat(1) if((owner():lastSaid()=="/warp e2")&chatClk(owner())){ hideChat(1) owner():teleport(entity():pos()+vec(0,0,0)) } if((owner():lastSaid()=="/warp")&chatClk(owner())){ hideChat(1) owner():teleport(owner():aimPos()+owner():aimNormal()*owner():height()) }
Follower
@name Follower @persist Target:entity Orbit ## ONLY CHANGE THESE OPTIONS CommandColor = vec(255,255,0) # Vector color of highlighted commands. ChatColor = vec(255,255,255) # Vector color of the defualt chat. YourNameColor = vec(0,150,255) # Vector color of your name in chat. RingColor = vec(255,0,150) # Vector color of the follower's ring ## HOW TO USE ## # /orbit <name> - Follows another player. If you do your name, it will follow you. # /e2 - Teleports you to e2 # /ptp <name> - Teleports you to player ## NOTHING PAST THIS ## runOnChat(1) runOnTick(1) if(first()|duped()){ holoCreate(1) holoParent(1,entity()) holoModel(1,"hq_icosphere") holoMaterial(1,"models/wireframe") holoCreate(2) holoParent(2,entity()) holoModel(2,"models/holograms/hq_torus.mdl") holoAng(1,ang(0,0,0)) holoAng(2,ang(0,0,0)) holoScale(2,vec(2,2,2)) holoColor(2,RingColor) } if((owner():lastSaid():explode(" ")[1,string] == "/orbit") & chatClk(owner())){ hideChat(1) Target = findPlayerByName(lastSaid():explode(" ")[2,string]) if(Target:name() == owner():name()){ printColor(CommandColor,"Orbiting ",YourNameColor,"you") } else{ printColor(CommandColor,"Orbiting ",YourNameColor,Target:name()) } Orbit = 1 } if(Orbit == 1){ entity():setPos(Target:pos()+vec(75,0,80):rotate(ang(0,curtime()*90,0))) } if((owner():lastSaid()=="/e2") & chatClk(owner())){ owner():teleport(entity():pos()) } if((owner():lastSaid():explode(" ")[1,string] == "/ptp") & chatClk(owner())){ hideChat(1) Ply = findPlayerByName(lastSaid():explode(" ")[2,string]) owner():teleport(Ply:pos()+vec(0,0,Ply:height()+5)) }
Noclip
@name Clipping for BUILDING @persist Clip Tp:entity runOnChat(1) runOnTick(1) runOnKeys(owner(),1) if(first()){hint("say /fun or !fun to get all commands (help).",5)} Toggle = "mouse_5" if(owner():keyPressed(Toggle) & (keyClkPressed() == Toggle)){ Clip = !Clip } if(Clip == 1){ owner():applyPlayerForce(owner():vel()*-1+vec(0,0,gravity()*tickInterval())) owner():teleport(owner():pos()+vec(owner():keyForward()-owner():keyBack(),owner():keyLeft()-owner():keyRight(),owner():keyJump()):rotate(owner():eyeAngles())*(40+40*owner():keySprint()-25*owner():keyDuck())) } if(lastSaid():find("/ptp ")+chatClk(owner()) == 2) { hideChat(1) UFS = lastSaid():sub(6,lastSaid():length()) Tp = findPlayerByName(UFS) owner():teleport(Tp:pos()+vec(0,0,Tp:height())) } if((owner():lastSaid()=="/atp")&chatClk(owner())){ hideChat(1) owner():teleport(owner():aimPos()+owner():aimNormal()*owner():height()) } if((owner():lastSaid()=="/e2")&chatClk(owner())){ hideChat(1) owner():teleport(entity():pos()) } if((owner():lastSaid()=="/fun")&chatClk(owner())){ hideChat(1) hint("COMMANDS: /ptp <player> - teleport to player, /atp - tp to aimpos, /e2 - return to e2.",30) } if(lastSaid():find("!ptp ")+chatClk(owner()) == 2) { hideChat(1) UFS = lastSaid():sub(6,lastSaid():length()) Tp = findPlayerByName(UFS) owner():teleport(Tp:pos()+vec(0,0,Tp:height())) } if((owner():lastSaid()=="!atp")&chatClk(owner())){ hideChat(1) owner():teleport(owner():aimPos()+owner():aimNormal()*owner():height()) } if((owner():lastSaid()=="!e2")&chatClk(owner())){ hideChat(1) owner():teleport(entity():pos()) } if((owner():lastSaid()=="!fun")&chatClk(owner())){ hideChat(1) hint("COMMANDS: !ptp <player> - teleport to player, !atp - tp to aimpos, !e2 - return to e2.",30) }
Rainbow
@name Rainbow @persist Rainbow if(first()){Rainbow = 1} interval(1) runOnChat(1) if(Rainbow == 1){ owner():setColor(hsv2rgb((curtime()*200)%360,1,1)) owner():setMaterial("models/debug/debugwhite") } else{ owner():setColor(vec(255)) owner():setMaterial("") } if((owner():lastSaid()=="/rainbow") & chatClk(owner())){ hideChat(1) Rainbow = 1 } if((owner():lastSaid()=="/normal") & chatClk(owner())){ hideChat(1) Rainbow = 0 }
Teleport (Nexus Core e2 functions needed)
@name Teleport - Personal - NEED NEXUS runOnChat(1) if(first()|duped()){ hint("To use, say /ptp <name>",10) } if((owner():lastSaid():explode(" ")[1,string] == "/ptp") & chatClk(owner())){ hideChat(1) PTP = findPlayerByName(lastSaid():explode(" ")[2,string]) owner():teleport(PTP:pos()+vec(0,0,PTP:height()+5)) } # NOTE: Nexus e2 functions are needed
Teleport (Propcore option needs to be on)
@name Teleport - Personal - NEED PROPCORE @persist [PTP E]:entity runOnChat(1) if(first()|duped()){ hint("To use, say /ptp <name>",10) } if((owner():lastSaid():explode(" ")[1,string] == "/ptp") & chatClk(owner())){ hideChat(1) E:propDelete() PTP = findPlayerByName(lastSaid():explode(" ")[2,string]) E = propSpawn("models/hunter/blocks/cube05x05x025.mdl",owner():pos()+vec(0,0,7.5),1) timer("tp",4000) } if(clk("tp")){ E:setPos(PTP:pos()+vec(0,0,PTP:height()+7.5)) timer("d",50) } if(clk("d")){ E:propDelete() } # NOTE: Propcore needs to be on
Teleport - Server (Nexus core needed) (Allows whole server to tp) (They need you on THEIR prop protection)
@name TP - Server runOnChat(1) if(first()|duped()){ hint("Tell players to add you on their prop protection, then they can use /ptp <name>",20) } if((lastSaid():explode(" ")[1,string] == "/ptp") & chatClk()){ TP = findPlayerByName(lastSaid():explode(" ")[2,string]) lastSpoke():teleport(TP:pos()+vec(0,0,TP:height()+5)) }
Tesla
@name Nubs Tesla @persist Num T:entity Can # Customizing options # Secondary = vec(255) Orbs = vec(0,150,255) Range = 200 # DO NOT CHANGE BELOW THIS # interval(1) function holo(Mod:string,Mat:string,Alph:number,Scl:vector,Col:vector,Pos:vector,Ang:angle){ Num++ holoCreate(Num) holoModel(Num,Mod) holoMaterial(Num,Mat) holoAlpha(Num,Alph) holoScale(Num,Scl) holoColor(Num,Col) holoPos(Num,entity():toWorld(Pos)) holoAng(Num,entity():toWorld(Ang)) holoParent(Num,entity()) } if(first()|duped()){Can = 1} findExcludePlayer(owner()) findExcludePlayer("name") if(first()|duped()){ propSpawnUndo(0) holo("models/holograms/hq_cubinder.mdl","models/shiny",255,vec(2),vec(50),vec(0,0,10),ang(0)) holo("","models/shiny",255,vec(2),vec(50),vec(0,15,7.25),ang(0,0,-15)) holo("","models/shiny",255,vec(2),vec(50),vec(0,-15,7.25),ang(0,0,15)) holo("","models/shiny",255,vec(2),vec(50),vec(15,0,7.25),ang(15,0,0)) holo("","models/shiny",255,vec(2),vec(50),vec(-15,0,7.25),ang(-15,0,0)) holo("models/holograms/hq_cubinder.mdl","models/shiny",255,vec(2.05,2.05,1.5),Secondary,vec(0,0,29),ang(0)) holo("models/holograms/hq_cylinder.mdl","models/shiny",50,vec(2.05),vec(50),vec(0,0,50),ang(0)) holo("models/holograms/icosphere2.mdl","models/shiny",255,vec(1.5),Orbs,vec(0,0,50),ang(0)) holo("models/holograms/hq_cylinder.mdl","models/shiny",255,vec(2.05),vec(50),vec(0,0,73),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,67.5),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),vec(50),vec(0,0,70),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,72.5),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),vec(50),vec(0,0,75),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,77.5),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),vec(50),vec(0,0,80),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,82.5),ang(0)) holo("models/holograms/icosphere2.mdl","models/shiny",255,vec(1.5),vec(255,50,0),vec(0,0,95),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,95),ang(0)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,95),ang(0,0,90)) holo("models/holograms/hq_torus_thin.mdl","models/shiny",255,vec(2.5),Secondary,vec(0,0,95),ang(0,90,90)) } if(Can == 1){ holoColor(17,vec(127,255,127)) if(findCanQuery()) { findIncludeClass("player") findInSphere(entity():pos()+vec(0,0,95),Range) if(findToArray():count() > 0) { T = findClosest(entity():pos()) propSpawn("models/props_c17/oildrum001_explosive.mdl",T:shootPos(),1):propBreak() timer("can",3000) Can = 0 } } } else{holoColor(17,vec(255,50,0))} if(clk("can")){ Can = 1 } holoAng(8,ang(curtime()*100)) holoAng(17,ang(curtime()*125))
--END-- (Info)
Thanks for looking at these e2s and trying them (if you did). I plan to add more in the future, just this is all i have that is worth sharing right now. Remember, if you want more e2s, I'll take suggestions. Just comment below, and I will read it whenever i can. Have fun!

NOTE
Keep in mind, an expression 2 won't appear on this list if it has an error. I fix all errors before I add. If you get an error, the server you're playing on doesn't have the e2 functions being from an addon (for example, Nexus Core), or the server has a function disabled. The e2 door will have an error if the propcore functions are disabled.

Trouble Shooting
If you are hosting your own server or playing with friends on a p2p (peer to peer) game (started with singleplayer but has slots for friends to join), this will show you how to get these working. First off, to get propcore and all other defualt functions on, open the spawn menu, and on the right, where you see "Tools", follow this path. Under Utilities, find "E2 Extensions". You can go ahead and check them all. It will enable functions so some e2s will work. You will also need Nexus core (for the teleporting e2s) which can be found here
9 Comments
NubTheFatMan  [author] Mar 14, 2023 @ 6:15pm 
To be expected when this is 5 years old
⁞龘龜鑰☭麤齉䨻⁞ Mar 14, 2023 @ 7:43am 
almost all of these don't work
G4rry Jun 29, 2021 @ 1:10pm 
hi nub (:
zane Apr 27, 2019 @ 7:45am 
You recon you can tell me how to get a rainbow /title?
This stuff '/title <color=0,255,0>colored text</color>' but rainbow
cralo Jun 26, 2017 @ 12:09pm 
ok thxbai
NubTheFatMan  [author] Jun 26, 2017 @ 11:27am 
Then you still have something disabled, or don't have a specific addon. I think it's just propcore that needs to be enabled. I'm remaking the door controller but it will control a fading door, not move props.
cralo Jun 26, 2017 @ 11:22am 
actually, i tried to use it on single player
NubTheFatMan  [author] Jun 26, 2017 @ 11:10am 
Please keep in note, If the expression 2 code has an error, it either doesnt have an addon with that specific function OR a function is disabled. Nome, there is no issue with it, just the server you're on doesn't have propcore enabled, which is needed. I have no error when I open it. I do have another one, but it controls a fading door. I will add it shortly
cralo Jun 20, 2017 @ 11:11am 
The door controller has an error on line 10, and i am just here for the code. Hope you fix it