• Ask me for a simple script
    7 replies, posted
Still relatively new to lua coding but i feel confident enough to offer my services for free to those of you who want something simple done, dont give me anything overly complicated with a whole lot of config options all i want is to practice. No guarantees, again this is just practice for me don't expect a perfect job. Things i have done [url]http://steamcommunity.com/id/kulcris/myworkshopfiles/?appid=4000[/url] TTT gas grenades ([url]http://steamcommunity.com/sharedfiles/filedetails/?id=259039395[/url]) Mapping Weapons (rarely) Removing head-crabs from zombies and stopping them from spawning on zombie kill ([url]http://steamcommunity.com/sharedfiles/filedetails/?id=357548918[/url]) Eye Dropper ([url]http://steamcommunity.com/sharedfiles/filedetails/?id=259692029[/url]) E2 like fairy (in lua) Deathmatch MINI Gamemode for 2 darkrp jobs
Make a script where if you say "Garry" in the chat. It will turn world upside down (and yell Garry). It could be a little complicated but not a lots. You should be able to make a quick script as a new to Gmod Lua :v:
[QUOTE=Gedo789;46996210]Make a script where if you say "Garry" in the chat. It will turn world upside down (and yell Garry). It could be a little complicated but not a lots. You should be able to make a quick script as a new to Gmod Lua :v:[/QUOTE] no testing done on this (at work ) not even sure if i did this right at all setting the view angle is something i have never done i will have to play with it when i get home [lua]hook.Add("PlayerSay", "garrysay", function(ply, say, team) local text = say:lower() if (text == "garry") and ply:IsValid() then // ply:EyeAngles(angles) // ply:SetEyeAngles() ply:Say("/y GARRY!") CalcView = function( self, view ) view.angles.roll = 90 end end end)[/lua] [editline]23rd January 2015[/editline] i could have gotten everything wrong with it (most likely) but i normally get it eventually. so many different ways to do things in lua and not a whole lot of documentation on the more obscure things (like flipping view angles)
[QUOTE=kulcris;46996514]no testing done on this (at work ) not even sure if i did this right at all setting the view angle is something i have never done i will have to play with it when i get home [lua]hook.Add("PlayerSay", "garrysay", function(ply, say, team) local text = say:lower() if (text == "garry") and ply:IsValid() then // ply:EyeAngles(angles) // ply:SetEyeAngles() ply:Say("/y GARRY!") CalcView = function( self, view ) view.angles.roll = 90 end end end)[/lua] [editline]23rd January 2015[/editline] i could have gotten everything wrong with it (most likely) but i normally get it eventually. so many different ways to do things in lua and not a whole lot of documentation on the more obscure things (like flipping view angles)[/QUOTE] I attempted to somethings like this but..: [CODE]function UPSIDEDOWN(ply,pos,angles,fov) local view = {} view.origin = pos-(angles:Forward()) view.angles = Angle(180,0,0) view.fov = fov return view end hook.Add("PlayerSay", "GARRYWORLD", function(ply,msg) if string.find(msg,"garry") then ply:EmitSound("garry.wav") hook.Add("CalcView","GarryDETECTED",UPSIDEDOWN) hook.Add("ShouldDrawLocalPlayer","RenderWORLD",function(ply) return true end) end end)[/CODE] Anyways, it's not very bad your code for a new in Gmod Lua, nice work!
Be careful with string.find... [lua]yo ya wanna play some garrysmod?[/lua] Would turn their world up side down :v:
lol author as intended :P [editline]23rd January 2015[/editline] [lua]hook.Add("PlayerSay", "garrysay", function(ply, say, team) local text = say:lower() if (text == "garry") and ply:IsValid() then ply:SetEyeAngles(Angle(0,0,180) ) ply:Say("/y GARRY!") end end) [/lua] Here you go :) fully working [lua] hook.Add("PlayerSay", "garrysay", function(ply, say, team) local text = say:lower() if (text == "garry") and ply:IsValid() then ply:SetEyeAngles(Angle(0,0,180) ) ply:Say("/y GARRY!") end if (text == "ungarry") and ply:IsValid() then ply:SetEyeAngles(Angle(0,0,0) ) end end) [/lua] Added a way to undo it without dieing [editline]23rd January 2015[/editline] Anyone else? that taught me something thank you Gedo Better yet Gedo [lua]hook.Add("PlayerSay", "garrysay", function(ply, say, team) local text = say:lower() if (text == "garry") and ply:IsValid() then ply:SetEyeAngles(Angle(0,0,180) + ply:EyeAngles() ) ply:Say("/y GARRY!") end end) [/lua] This will make "garry" flip from whatever position it is already (undoing it if its already flipped) as well as not changing what direction you are looking :)
ON REQUEST (from my roommate being a jackass trying to be funny ) zombies explode when they die! [lua]// Creeper Zombies local Zombies = { npc_zombie = true, npc_fastzombie = true, npc_zombine = true, npc_poisonzombie = true, } local function IsaZombie(class) return Zombies[class] or false end hook.Add ("EntityTakeDamage", "Creepzombies", function(ent,dmg) if IsValid(ent) and ent:IsaZombie() then local DAITA = ent:GetSaveTable() local ZH = ent:Health() local DZ = dmg:GetDamageType() if dmg:GetDamage()>=ZH then local explosive = ents.Create( "env_explosion" ) explosive:SetPos( ent:GetPos() ) explosive:SetOwner( dmg:GetAttacker( ) ) explosive:Spawn() explosive:SetKeyValue( "iMagnitude", "10" ) explosive:Fire( "Explode", 10, 0 ) explosive:EmitSound( "ambient/explosions/explode_4.wav", 500, 500 ) end end end) [/lua] Anyone else?
This script remember me a things that I do in the past when I was boring, burning zombies but now with script: (no longer need explosive prop :v:) [video=youtube;h7meuzQ4lRw]http://www.youtube.com/watch?v=h7meuzQ4lRw[/video] [CODE]function FunnyZombie_playerlook() for k,v in pairs(player.GetAll()) do if v:GetEyeTrace().Entity:GetClass() == "npc_zombie" then timer.Simple(3,function() if v:GetEyeTrace().Entity:GetClass() == "npc_zombie" and v:GetPos():Distance(v:GetEyeTrace().Entity:GetPos()) < 400 then if SERVER then v:GetEyeTrace().Entity:Ignite(10) end if SERVER then v:GetEyeTrace().Entity:SetArrivalSpeed(10000) end end end) end end end function FunnyZombie_check() timer.Create("FunnyZombie",4,0,function() FunnyZombie_playerlook() end) end function FunnyZombie_stop() timer.Destroy("FunnyZombie") FunnyZombie_check() end timer.Create("FunnyZombie",2,0,function() FunnyZombie_stop() end) [/CODE]
Sorry, you need to Log In to post a reply to this thread.