• Simple OOC!
    36 replies, posted
Hello! Iv'e Made another lua thing. Please Comment on this thread saying what I should code next, first who comments will be chosen! so be quick!! ONLY WORKS ON SERVER LUA!!! ONLY WORKS ON SERVER LUA!!! ONLY WORKS ON SERVER LUA!!! [CODE] hook.Add( "PlayerSay", "ChatCommand1", function( ply, text, team ) if (string.sub( text, 1, 4 ) ) == "/ooc" then PrintMessage( HUD_PRINTTALK, "[Simple-OOC] " .. Entity( 1 ):GetName() .. ":" .. string.sub( text, 5) ) return false end end) [/CODE] [IMG]http://images.akamai.steamusercontent.com/ugc/493527550101994918/DBF450576F3921F426D87C871E4E3943F51BEE23/[/IMG]
So you made 6 lines of extremely simple code? Wow, good for you. Congratulations. I'm not sure that it's worth anyone's time here, though.
Sell it on scriptfodder, you deserve the money.
Hey, it's not a bad place to start if you're newer to Lua. The first thing I made was some simple 3D2D scoreboard that looked like ass.
return ""
Anyone else going to mention how it will always just print the name of whichever player has entity 1's slot, or error of there isn't anyone?
[QUOTE=typedef state;50844687]So you made 6 lines of extremely simple code? Wow, good for you. Congratulations. I'm not sure that it's worth anyone's time here, though.[/QUOTE] Wow. I'm sure you're AMAZING at what you do. You fuckin inbred [highlight](User was banned for this post ("Flaming" - Novangel))[/highlight]
[QUOTE=Tupac;50845312]Wow. I'm sure you're AMAZING at what you do. You fuckin inbred[/QUOTE] I Agree, its a good start. Better than 90% of us who started.
Well since no one has told this guy what do next, how about you use that same hook to do other things like setting your health or changing colors of entites, idk. Take it to the next level. See what you can do with it.
[QUOTE=Tupac;50845312]Wow. I'm sure you're AMAZING at what you do. You fuckin inbred[/QUOTE] I just fail to see the point of this thread. This isn't even WAYWO material. Writing six lines of (apparently broken) code does not validate the existence of this thread.
[QUOTE=typedef state;50845708]I just fail to see the point of this thread. This isn't even WAYWO material. Writing six lines of (apparently broken) code does not validate the existence of this thread.[/QUOTE] It's just how you make it seem like you know everything that **TRIGGERS** me. And the code actually does work, just shows how skilled you are :D Plus, this guy is most likely a beginner and is proud of what he did, even if you think it's small, it might be pretty big to him. [QUOTE=ItsArmiii;50844660]Hello! Iv'e Made another lua thing. Please Comment on this thread saying what I should code next, first who comments will be chosen! so be quick!![/QUOTE] Just wanna let you know, might wanna change Entity(1):Nick() to ply:Nick(). What you're using well return the first player's name instead of the actual player who sent the message
[QUOTE=typedef state;50845708]I just fail to see the point of this thread. This isn't even WAYWO material. Writing six lines of (apparently broken) code does not validate the existence of this thread.[/QUOTE] your a fucking funny cunt aye, 10x better than what my first script was
[QUOTE=Tupac;50846571]It's just how you make it seem like you know everything that **TRIGGERS** me. And the code actually does work, just shows how skilled you are :D Plus, this guy is most likely a beginner and is proud of what he did, even if you think it's small, it might be pretty big to him. Just wanna let you know, might wanna change Entity(1):Nick() to ply:Nick(). What you're using well return the first player's name instead of the actual player who sent the message[/QUOTE] why do you always shitpost when someone who's better than you at coding points out shit code
[QUOTE=nulls;50847087]why do you always shitpost when someone who's better than you at coding points out shit code[/QUOTE] who even are you? and what makes you think he's better than me? [URL="http://steamcommunity.com/id/mrmarooca/myworkshopfiles/"]wow nice you can make money printer boxes!1!11!1[/URL]
[QUOTE=nulls;50847087]why do you always shitpost when someone who's better than you at coding points out shit code[/QUOTE] The reason is because people who are better clearly already know this simple shit and don't need to shitpost about it people who might not know how to do it can maybe learn some new things but cancerous shit like "this is so simple to make congrats" is not what the author of the post intended people to comment about. If anything this author wanted people to say "it might be better if you added this" or "Damn man how did you do this?" with out being sarcastic or being a rude fuck you know it amazing if you really need to get attention from people online like this you really need to grow the fuck up.
Why are you using Entity(1) when there's a ply variable lying there just waiting to be used?
[QUOTE=typedef state;50844687]So you made 6 lines of extremely simple code? Wow, good for you. Congratulations. I'm not sure that it's worth anyone's time here, though.[/QUOTE] No one wanted to hear negativity from your mouth shut the fuck up if you "know" this already
[QUOTE=-Rebound-;50847458]No one wanted to hear negativity from your mouth shut the fuck up if you "know" this already[/QUOTE] "negativity"... "shut the fuck up"... :speechless: You're not helping the situation... Anyway, to the OP if you want to code something cool, how 'bout....... a music player entity?
[QUOTE=LegoGuy;50847492]"negativity"... "shut the fuck up"... :speechless: You're not helping the situation... Anyway, to the OP if you want to code something cool, how 'bout....... a music player entity?[/QUOTE] Oh sorry for using big boy words it appears to me that theres virgin ears here still? *No one wanted to hear negativity from your mouth shut up if you "know" this already
This is why I say not to learn Lua as your first language, and not to use GMod to learn programming. This doesn't even use any complex structures or abstractions, and op still managed to fuck it up. People do a system test in single player, and if it works, hey it must work for everyone! I know there's that saying about the cathedral and the bazaar, and GMod is certainly more of a bazaar, but it should be a bazaar, not a crack house with dribbling retards occasionally passing through.
[QUOTE=Apickx;50847519]This is why I say not to learn Lua as your first language, and not to use GMod to learn programming. This doesn't even use any complex structures or abstractions, and op still managed to fuck it up. People do a system test in single player, and if it works, hey it must work for everyone! I know there's that saying about the cathedral and the bazaar, and GMod is certainly more of a bazaar, but it should be a bazaar, not a crack house with dribbling retards occasionally passing through.[/QUOTE] He managed to fuck it up because he doesn't know what he's doing. Has nothing to do with what language he's using. You're also assuming he wants to learn other languages, or for that matter, even wants to learn lua at all. Not everyone who learns a bit of lua to make scripts in gmod wants to be a programmer.
Holy shit, what have I spawned. :excited:
[T][/T][QUOTE=0V3RR1D3]I Agree, its a good start. Better than 90% of us who started.[/QUOTE] Thanks Ov3rr1d3, i appreciate that you get what I'm doing. <3 [T][/T][QUOTE=VeXan]Hey, it's not a bad place to start if you're newer to Lua. The first thing I made was some simple 3D2D scoreboard that looked like ass. [/QUOTE] Thanks VeXan, I really hope I can make things for you, in the future. Contact me on skype: lokindabeast. [T][/T][QUOTE=Tupac] typedef state posted: I just fail to see the point of this thread. This isn't even WAYWO material. Writing six lines of (apparently broken) code does not validate the existence of this thread. It's just how you make it seem like you know everything that **TRIGGERS** me. And the code actually does work, just shows how skilled you are :D Plus, this guy is most likely a beginner and is proud of what he did, even if you think it's small, it might be pretty big to him. ItsArmiii posted: Hello! Iv'e Made another lua thing. Please Comment on this thread saying what I should code next, first who comments will be chosen! so be quick!! Just wanna let you know, might wanna change Entity(1):Nick() to ply:Nick(). What you're using well return the first player's name instead of the actual player who sent the message [/QUOTE] Thanks for the help! I will use it. [editline]8th August 2016[/editline] [QUOTE=0V3RR1D3;50844786]Sell it on scriptfodder, you deserve the money.[/QUOTE] I'm gonna be honest, I'm a 11 year old kid. I don't have a paypal or something. and ScriptFodder always gets leaked. so yeah.
[QUOTE=Tupac;50847327]who even are you? and what makes you think he's better than me? [/quote] because you think this is a good addon. [quote] [URL="http://steamcommunity.com/id/mrmarooca/myworkshopfiles/"]wow nice you can make money printer boxes!1!11!1[/URL][/QUOTE] hey there those are some nice money printer boxes, don't be making fun of them :v:
Yeah let's judge someone's programming skills because of their opinions. How did this thread go from someone trying to share something that they were proud of to people debating who's better at programming? Can't you guys just let someone be proud of their work? lol
Guys Please Stop With The Mean Comment's. Its Just A Start!
Alright here's a few criticisms to help you get better. 1. Don't use string.sub for such a simple application, you can use something like text:lower():find() and text:gsub() to achieve the same result. 2. Someone pointed it out already, but the player in a PlayerSay hook is passed as the first argument (hence the ply, which stands for player.) so you can use ply:Nick() or whatever, Entity(1) will be the first index in the entity list. 1 to game.MaxPlayers is reserved for players. 3. You are returning true/false (1/0) in a hook that expects a string to be returned in it, so you should return an empty string (or in this case, just return the text argument) instead if the requirements you're looking for aren't met. 4. You're not returning all paths, you would want to return every path, this keeps unexpected behavior from occurring somewhere in your code. Example: [code] function dosomething() if(something) then return "something"; end return ""; end [/code] Keep in mind this is pseudocode that I typed out on the fly, so it's not beautified or anything, it's just an example.
[QUOTE=Reyjr43;50859627]4. You're not returning all paths, you would want to return every path, this keeps unexpected behavior from occurring somewhere in your code. Example: [code] function dosomething() if(something) then return "something"; end return ""; end [/code] [/QUOTE] Should not be doing that in hook.Add. That'll fuck up the hook.
[QUOTE=sannys;50859750]Should not be doing that in hook.Add. That'll fuck up the hook.[/QUOTE] It can prevent other hooks from running if I remember correctly, but why you'd be running multiple PlayerSay hooks is beyond me.
[QUOTE=Reyjr43;50859761]It can prevent other hooks from running if I remember correctly, but why you'd be running multiple PlayerSay hooks is beyond me.[/QUOTE] PlayerSay is no different than any other hook. Different addons will use it for different things. Literally just today I had to work with a customer for an hour or so because it turns out [URL="https://github.com/AC2github/LC-FC-Deathrun/pull/1/files"]his gamemode was doing this exact thing[/URL] and was breaking our admin addon's chat commands.
Sorry, you need to Log In to post a reply to this thread.