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

Thread: E2: Few new functions

  1. #1
    Wire Sofaking d3cr1pt0r is on a distinguished road d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    566

    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.

    lua Code:
    1. AddCSLuaFile('custom.lua')
    2.  
    3. /******************************************************************************\
    4. Made by d3cr1pt0r
    5. \******************************************************************************/
    6.  
    7. registerFunction("setEyeAngle", "e:a", "", function(self,args)
    8. local op1, op2 = args[2], args[3]
    9. local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    10. if(!self.player) then return end
    11. rv1:SetEyeAngles(Angle(rv2[1],rv2[2],rv2[3]))
    12. end)
    13.  
    14. registerFunction("setPos", "e:v", "", function(self,args)
    15. local op1, op2 = args[2], args[3]
    16. local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    17. if(!validEntity(rv1)) then return end
    18. rv1:SetPos(Vector(rv2[1],rv2[2],rv2[3]))
    19. end)
    20.  
    21. registerFunction("setRunSpeed", "n", "", function(self,args)
    22. local op1 = args[2]
    23. local rv1 = op1[1](self,op1)
    24. if(!self.player) then return end
    25. self.player:SetRunSpeed(rv1)
    26. end)
    27.  
    28. registerFunction("setGravity", "n", "", function(self,args)
    29. local op1 = args[2]
    30. local rv1 = op1[1](self,op1)
    31. self.player:SetGravity(rv1)
    32. end)
    33.  
    34. registerFunction("chatPrint", "e:s", "", function(self,args)
    35. local op1, op2 = args[2], args[3]
    36. local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)
    37. rv1:ChatPrint(rv2)
    38. end)
    39.  
    40. registerFunction("createRagdoll", "", "", function(self,args)
    41. self.player:CreateRagdoll()
    42. end)
    43.  
    44. registerFunction("sendLua", "s", "", function(self,args)
    45. local op1 = args[2]
    46. local rv1 = op1[1](self,op1)
    47. if(!self.player or !self.player:IsAdmin()) then return end
    48. self.player:SendLua(rv1)
    49. end)
    50.  
    51. registerFunction("concmd", "e:s", "", function(self, args)
    52. local op1, op2 = args[2], args[3]
    53. local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)
    54. if(!self.player:IsValid() or !self.player:IsAdmin()) then return end
    55. rv1:ConCommand(rv2)
    56. end)

    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
    Last edited by d3cr1pt0r; 02-19-2009 at 10:47 AM.
    <3

  2. #2
    while(1){ printf("<3"); }
    IEF015 is a jewel in the rough IEF015 is a jewel in the rough IEF015 is a jewel in the rough IEF015's Avatar
    Join Date
    Feb 2008
    Location
    London, ON (Canada, eh?)
    Posts
    1,632

    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
    Wire Sofaking Donkie is on a distinguished road Donkie's Avatar
    Join Date
    May 2008
    Location
    Sweden
    Posts
    1,181

    Default Re: E2: Few new functions

    Me thinks its like the ULX ragdoll command?

  4. #4
    Wire Sofaking d3cr1pt0r is on a distinguished road d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    566

    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
    Inactive Eirath245 is on a distinguished road Eirath245's Avatar
    Join Date
    Feb 2008
    Location
    England
    Posts
    210

    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
    [URL="http://www.sloganizer.net/en/"][IMG]http://www.sloganizer.net/en/image,Wire,lblue,blue.png[/IMG][/URL]

  6. #6
    Arc
    Arc is offline
    Wirererer Arc is on a distinguished road Arc's Avatar
    Join Date
    Jan 2008
    Posts
    177

    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
    Newbie Programmer ZeikJT will become famous soon enough ZeikJT's Avatar
    Join Date
    Dec 2008
    Location
    California
    Posts
    1,394

    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 01: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 is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull is a splendid one to behold Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    4,702

    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

  9. #9
    E2 Optimizer
    chinoto is on a distinguished road chinoto's Avatar
    Join Date
    Apr 2008
    Location
    In the skybox, lost another contraption...
    Posts
    1,714

    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.

    (\__/) <- Put this bunny in your sig and help him to rule the world!
    (='.'=) PM me code and I'll send it back optimized if possible. (I find it fun dammit!)
    (")_(") Expression Gate 2 Wiki Help us update the wiki! Together we can make it more up to date than the SVN! ...

  10. #10
    Wire Sofaking d3cr1pt0r is on a distinguished road d3cr1pt0r's Avatar
    Join Date
    Jul 2008
    Posts
    566

    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:

    lua Code:
    1. registerFunction("setPos", "e:v", "", function(self,args)
    2. local op1, op2 = args&#91;2&#93;, args&#91;3&#93;
    3. local rv1, rv2 = op1&#91;1&#93;(self,op1), op2&#91;1&#93;(self,op2)
    4. if(!validEntity(rv1) or !self.player:IsAdmin()) then return end
    5. rv1:SetPos(Vector(rv2&#91;1&#93;,rv2&#91;2&#93;,rv2&#91;3&#93;))
    6. end)
    <3

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast

Similar Threads

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