+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: E2: Few new functions

  1. #1
    Wire Sofaking d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    553

    Default E2: Few new functions

    Hello,

    I decided to start learning lua, so this is my first thing I made. Some usefull and not usefull E2 functions you can use.

    [highlight=lua]
    AddCSLuaFile('custom.lua')

    /************************************************** ****************************\
    Made by d3cr1pt0r
    \************************************************* *****************************/

    registerFunction("setEyeAngle", "e:a", "", function(self,args)
    local op1, op2 = args[2], args[3]
    local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    if(!self.player) then return end
    rv1:SetEyeAngles(Angle(rv2[1],rv2[2],rv2[3]))
    end)

    registerFunction("setPos", "e:v", "", function(self,args)
    local op1, op2 = args[2], args[3]
    local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    if(!validEntity(rv1)) then return end
    rv1:SetPos(Vector(rv2[1],rv2[2],rv2[3]))
    end)

    registerFunction("setRunSpeed", "n", "", function(self,args)
    local op1 = args[2]
    local rv1 = op1[1](self,op1)
    if(!self.player) then return end
    self.player:SetRunSpeed(rv1)
    end)

    registerFunction("setGravity", "n", "", function(self,args)
    local op1 = args[2]
    local rv1 = op1[1](self,op1)
    self.player:SetGravity(rv1)
    end)

    registerFunction("chatPrint", "e:s", "", function(self,args)
    local op1, op2 = args[2], args[3]
    local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    rv1:ChatPrint(rv2)
    end)

    registerFunction("createRagdoll", "", "", function(self,args)
    self.player:CreateRagdoll()
    end)

    registerFunction("sendLua", "s", "", function(self,args)
    local op1 = args[2]
    local rv1 = op1[1](self,op1)
    if(!self.player or !self.player:IsAdmin()) then return end
    self.player:SendLua(rv1)
    end)

    registerFunction("concmd", "e:s", "", function(self, args)
    local op1, op2 = args[2], args[3]
    local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
    if(!self.player:IsValid() or !self.player:IsAdmin()) then return end
    rv1:ConCommand(rv2)
    end)
    [/highlight]

    Code:
    E:setEyeAngle(A) - Sets the screen view to a desired angle
    E:setPos(V) - Will move a prop to a desired position (vector input)
    E:chatPrint(S) - Will print a string in the targets chat field
    E:concmd(S) - Just extended normal concmd. In this one, you can run a console command on someone else, but you need to be admin.
    setRunSpeed(N) - Will set your speed you rum/sprint
    setGravity(N) - Sets gravity that affects only the chip owner (default=1)
    createRagdoll() - Will drop a ragdoll from your position
    sendLua(S) - Sends a lua command to client
    Thanks to n00berific for help.
    Attached Files Attached Files
    Last edited by d3cr1pt0r; 02-19-2009 at 11:47 AM.
    <3

  2. #2
    Wire Sofaking IEF015's Avatar
    Join Date
    Feb 2008
    Location
    London, ON (Canada, eh?)
    Posts
    1,640

    Default Re: E2: Few new functions

    Nice codes, but I don't see the point in the createRagdoll function.
    "It's my favourite country song. And I hate it."

  3. #3
    Wiremod Helper Donkie's Avatar
    Join Date
    May 2008
    Location
    Sweden
    Posts
    1,659

    Default Re: E2: Few new functions

    Me thinks its like the ULX ragdoll command?

  4. #4
    Wire Sofaking d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    553

    Default Re: E2: Few new functions

    No it shoves a ragdoll from you. I made that just for fun. It looks epic if you put it under interval(10).
    <3

  5. #5
    Wirererer Eirath245's Avatar
    Join Date
    Feb 2008
    Location
    England
    Posts
    208

    Default Re: E2: Few new functions

    Epic and Laggy :P?

    Cool, though. I think we're going to reach a point where the whole functionality of lua is going to be exposed through E2 commands xD

  6. #6
    Arc
    Arc is offline
    Wirererer Arc's Avatar
    Join Date
    Jan 2008
    Posts
    178

    Default Re: E2: Few new functions

    setAngle would work for making a makeshift aimbot, no?
    Scott: You can gib a child with one stroke of the nanosword!
    Chris: That's because children have fewer hit points. They are inferior and weak.

  7. #7
    Wire Sofaking ZeikJT's Avatar
    Join Date
    Dec 2008
    Location
    California
    Posts
    1,391

    Default Re: E2: Few new functions

    You should check out the prop repositioning I put on the Unofficial expression function wiki:
    Expression 2 - Prop Repositioning - GMod Wiki

    It includes checks for frozen props to move them properly. If not you may have noticed it will look like it is in the same place but when you phys gun it it teleports to the new position.

    The other ones like look fun
    Last edited by ZeikJT; 02-15-2009 at 02:42 PM. Reason: like like > look like
    Against stupidity the Gods themselves contend in vain.
    -Friedrich Schiller

    The flame puts me in the mood to "Do it!".
    -Dart, Legend of Dragoon

  8. #8
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,002

    Default Re: E2: Few new functions

    He already did
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  9. #9
    Wire Tutor chinoto's Avatar
    Join Date
    Apr 2008
    Location
    Brooklyn Park, MN. Lost my thumbdrive yet again...
    Posts
    1,983

    Default Re: E2: Few new functions

    Damn, if I ever get my own server I'm gonna have setPos(), no more teleport noise and tiny, though I might learn some lua and restrict it to only me and my admins.
    (\__/) Expression 2 Resources: E2 Beginner's Guide | E2 Formatting Guide | E2 Function Reference | E2 Examples | Me
    (='.'=) PM me code and I'll send it back optimized if possible. (I find it fun dammit!)
    (")_(") Drunkie referring to an E2: "It's obvious that Chinoto made this, his coding style is all over it."

  10. #10
    Wire Sofaking d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    553

    Default Re: E2: Few new functions

    Quote Originally Posted by chinoto View Post
    Damn, if I ever get my own server I'm gonna have setPos(), no more teleport noise and tiny, though I might learn some lua and restrict it to only me and my admins.
    You can simply restrict it to admins only by just adding 1 more thing to 1 line:

    [highlight=lua]
    registerFunction("setPos", "e:v", "", function(self,args)
    local op1, op2 = args[2], args[3]
    local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    if(!validEntity(rv1) or !self.player:IsAdmin()) then return end
    rv1:SetPos(Vector(rv2[1],rv2[2],rv2[3]))
    end)
    [/highlight]
    <3

+ Reply to Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. NPC functions - Egate2
    By Bobsymalone in forum Wiremod Addons & Coding
    Replies: 50
    Last Post: 10-30-2009, 09:15 AM
  2. E2 seat functions!
    By Azrael in forum Wiremod Addons & Coding
    Replies: 18
    Last Post: 05-09-2009, 12:14 AM
  3. [E2] HUD-drawing functions
    By SatansSimon in forum Wiremod Addons & Coding
    Replies: 23
    Last Post: 03-22-2009, 03:15 PM
  4. E-2 some functions.
    By Whodunnit in forum Ideas & Suggestions
    Replies: 12
    Last Post: 03-11-2009, 05:31 AM
  5. Need ADVANCED help with functions!
    By scasbyte in forum Wiremod General Chat
    Replies: 4
    Last Post: 07-28-2007, 10:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots