• What do you need help with? V3
    6,419 replies, posted
Change line 4 and 5 to: [lua] steamids = glon.decode(file.Read("ids.txt", "DATA") or "") [/lua]
[QUOTE=JustSoFaded;37936750]Are you retarded or are you just acting like it? [lua]local function PlayDoubleSound(sound1, sound2) local dur = SoundDuration( sound1 ); surface.PlaySound( sound1 ); timer.Simple(dur, function() surface.PlaySound( sound2 ); end) return dur; end[/lua][/QUOTE] whats this someone who actually helps on facepunch this must be a dream
[QUOTE=RonanZer0;37973471]whats this someone who actually helps on facepunch this must be a dream[/QUOTE] This thread has 53 pages.
He meant to say, "What's this? Someone does the code for me? This must be a dream."
I have been searching for the right tmysql for GMod 13, but I can't find the proper one. Anyone who could provide me a link?
Any information about which things I have to modify? [editline]9th October 2012[/editline] Nvm, there is a lua file inside. [editline]9th October 2012[/editline] It says it's not found. [editline]9th October 2012[/editline] I need to learn to read. I had it in the wrong dir.
Well, i'm new to LUA, and couldn't find any tutorials on it, so... How would i create a class for my gamemode? Like, an object i can create instances of, like an item base? And then, how would i create an instance of it, like "gun = new Item" I'd post it on something like Yahoo answers, but i figured it may be diffrent for Gmod.
I need to create a line from point A to point B clientside, not only do I need to create it but could you give me an example on changing it's color and width also? I've never worked with effects before and I feel like I'm extremely overcomplicating things..
I have tried on another thread but I didn't get any response. This is the only place I have left. Guess it's not 100% Lua relevant but I hope it will do. Is there anyway to modify the order workshop addons are loaded or adding workshop addon dependencies (through Lua or perhaps other ways)? As far as I know there is no way to do this. If it isn't possible at the moment then we better do something about it now.
I am trying to fix a SSB Cam System made by some old gmod12 gamemode that was recently converted to gmod13, this piece of code was commented for some reason and found out why it was for. It works like a charm with 2 players, but as soon it starts growing up players. It becomes worse and uncentered each time it grows. If someone can find a fix for it or how does the SSB cam really works then I would be grateful for it. BONUS POINTS whoever does this fix too: The number clamping was made because it chases players who fall or go up at the sky (and the X cam positioning, acting as Y in gmod, still chases players when they are far away from each other) What I want is to only focus more on the ground level players and less the air player levels, like in SSB. If all players go up then the cam goes up, etc, etc, etc. [CODE] function GM:CalcView(pl, _origin, _angles, _fov) local avpos = nil local maxdist = 0 local lastpos = nil for _, ragdoll in pairs(ents.FindByClass("prop_ragdoll")) do local ragpos = ragdoll:GetPos() + Vector(0, 0, 32) avpos = avpos or ragpos avpos = (avpos + ragpos) / 2 lastpos = lastpos or avpos maxdist = math.max(maxdist, lastpos:Distance(ragdoll:GetPos())) lastpos = ragpos end if avpos then avpos.x = math.Clamp(maxdist, 250, 1300 - math.abs((avpos.y + avpos.z))/3) CURRENTCAMERAPOS.x = math.Approach(CURRENTCAMERAPOS.x, avpos.x, 100) CURRENTCAMERAPOS.y = math.Approach(CURRENTCAMERAPOS.y, avpos.y, 100) CURRENTCAMERAPOS.z = math.Approach(CURRENTCAMERAPOS.z, avpos.z, 100) CURRENTCAMERAPOS.z = math.Clamp(CURRENTCAMERAPOS.z, 1100, 1250) CURRENTCAMERAPOS = Vector(CURRENTCAMERAPOS.x, CURRENTCAMERAPOS.y, CURRENTCAMERAPOS.z) end return {origin = CURRENTCAMERAPOS, angles = Angle(0, 180, 0)} end [/CODE]
[QUOTE=Stiveno;37966231]I am attempting to make an entity that gives you 900 health faster running and walking, but slowly kills you when you are in water. [lua] function ENT:Use(activator,caller) caller:SetHealth(caller:Health() + 900) caller:SetWalkSpeed(450) caller:SetRunSpeed(700) if caller:WaterLevel() >= 1 then caller:SetHealth(caller:Health() - 50) end caller:EmitSound("vo/SandwichEat09.wav", 100, 100) self.Entity:Remove() end [/lua] Could somebody teach me how to make it so you lose 50 health a second in water, rather than if you use it in water you lose 50 once. I just started using lua and couldnt solve this problem.[/QUOTE] Anybody? I still cant figure out a fix.
Somewhat new to LUA with gmod... Trying to create a round system so that I can start new rounds and respawn the players, etc. Just not sure how to do this. I would use Fretta, but for some reason, I am having issues with that and gmod 13.
How do I set the spawn length in a gamemode? For example, in Antlion Survival, I want the player to spawn after 30-60 seconds (random?) Or how do I add a round system, so the map will reset to it's default state (all bodys will be removed, all trigger_onces will be reset etc) and have players respawn (they would have perma death until next round is called) Next round could be called when all npcs are dead once one of them has spawned, decluding npc_turret_floor. or a round system with an admin command to end round and also perma-death
[QUOTE=Duskling;37978657]Somewhat new to LUA with gmod... Trying to create a round system so that I can start new rounds and respawn the players, etc. Just not sure how to do this. I would use Fretta, but for some reason, I am having issues with that and gmod 13.[/QUOTE] I doubt it's the best way to do it, but you can look at the round system I made for a deathrun gamemode, it should give you the general idea: [url]http://pastebin.com/jV3PZE2V[/url] Also, fretta was removed in GM13.
[QUOTE=littleboyred1;37975534]Well, i'm new to LUA, and couldn't find any tutorials on it, so... How would i create a class for my gamemode? Like, an object i can create instances of, like an item base? And then, how would i create an instance of it, like "gun = new Item" I'd post it on something like Yahoo answers, but i figured it may be diffrent for Gmod.[/QUOTE] [url]http://facepunch.com/showthread.php?t=1160598&page=50#1967[/url] also, if your new to lua, I would recommend learning how to use [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index64f4.html"]hooks[/URL] . I have several for the round events listed. You can use those as a template and simply change the code to add respawning/rearming etc. You may need a little help with that but this should get you started. Good luck.
[QUOTE=Stiveno;37978074] [lua] function ENT:Use(activator,caller) caller:SetHealth(caller:Health() + 900) caller:SetWalkSpeed(450) caller:SetRunSpeed(700) if caller:WaterLevel() >= 1 then caller:SetHealth(caller:Health() - 50) end caller:EmitSound("vo/SandwichEat09.wav", 100, 100) self.Entity:Remove() end [/lua Anybody? I still cant figure out a fix.[/QUOTE] The water level thing would only run when the player uses the entity. What you need to do is create a function that is run every so often (maybe once a second) that sees if a player is in water, and deal with them accordingly. Like so: [lua] function ENT:Use(activator,caller) caller:SetHealth(caller:Health() + 900) caller:SetWalkSpeed(450) caller:SetRunSpeed(700) timer.Create("waterhurt", 1, 0, function() if caller:Alive() then if caller:WaterLevel() >= 1 then caller:SetHealth(caller:Health() - 50) end else timer.Destroy("waterhurt") end end) caller:EmitSound("vo/SandwichEat09.wav", 100, 100) self.Entity:Remove() end [/lua] This would create an ever-present timer that will check if the player is touching water once every second, and would terminate the timer if you die.
[QUOTE=Archemyde;37979817]The water level thing would only run when the player uses the entity. What you need to do is create a function that is run every so often (maybe once a second) that sees if a player is in water, and deal with them accordingly. Like so: function ENT:Use(activator,caller) caller:SetHealth(caller:Health() + 900) caller:SetWalkSpeed(450) caller:SetRunSpeed(700) timer.Create("waterhurt", 1, 0, function() if caller:Alive() then if caller:WaterLevel() >= 1 then caller:SetHealth(caller:Health() - 50) end else timer.Destroy("waterhurt") end end) caller:EmitSound("vo/SandwichEat09.wav", 100, 100) self.Entity:Remove() end This would create an ever-present timer that will check if the player is touching water once every second, and would terminate the timer if you die.[/QUOTE] Awesome, that's sort of what I thought it needed ill test it now. It worked! Thanks so much. I had to add this for it to actually kill the player, for whatever reason I just went into -health until i added it [lua] if caller:Health()<=0 then caller:Kill() end [/lua]
Does anyone know the hooks for RoundStart (After Preparing) in TTT?
[QUOTE=Genocode;37979968]Does anyone know the hooks for RoundStart (After Preparing) in TTT?[/QUOTE] [url]http://ttt.badking.net/guides/hooks[/url]
[QUOTE=Sakarias88;37975867] Is there anyway to modify the order workshop addons are loaded or adding workshop addon dependencies (through Lua or perhaps other ways)? As far as I know there is no way to do this. If it isn't possible at the moment then we better do something about it now.[/QUOTE] There is no way to do something like this. We should convince garry that we need a sort of dependency system, but I think he refused to do it last time when someone asked.
is Entity.TakeDamage or Entity.TakeDamageInfo broken? They work in singleplayer, but I can't get them to work in multiplayer.
[QUOTE=me-name-bob;37980514]is Entity.TakeDamage or Entity.TakeDamageInfo broken? They work in singleplayer, but I can't get them to work in multiplayer.[/QUOTE] check garry's googledoc. he changed it around.
[QUOTE=Archemyde;37980548]check garry's googledoc. he changed it around.[/QUOTE] I will, thanks. Linky, linky. Who's got a linky... I take it back, that didn't help. That looks like it's used with gamemodes, and i'm making a swep. in the mean time, it's not possible to make point_hurt credit kills to an owner, is it? final edit: fuck it, i'll use util.blastdamage!
It seems i cant talk to nigher of you, for help, so be it
Arghh dumb questions :/ Anyone knows the name of the model where Garry is drawn on the painting? I know i saw it somewhere here on FP, but i forgot where it was :/
I need help with a point shop of mine im trying to get the weapon to drop when buying a new one but just no luck. concommand.Add( "us_buy", function( ply, cmd, args ) local item = args[1] if not item then ply:US_Notify( "Failure." ) return end if not US.Items[item] then ply:US_Notify( item.." is not a valid item key." ) return end if US.CanAfford( item, ply ) then if ply._LimitRoles and ply._LimitRoles >= 2 and US.Items[item]["cat"] == "Roles" and string.find( string.lower(item), "traitor" ) then ply:US_Notify( "This item is limited, sorry!" ) return end if ply._LimitRoles2 and ply._LimitRoles2 >= 1 and US.Items[item]["cat"] == "Roles" and string.find( string.lower(item), "detective" ) then ply:US_Notify( "This item is limited, sorry!" ) return end if US.Items[item]["cat"] == "Guns" then if not ply:Alive() or ply:Team() == TEAM_SPECTATOR then ply:US_Notify( "You must be alive to buy weapons!" ) return end if US.Items[item]["class"] then if ply:HasWeapon( US.Items[item]["class"] ) then ply:US_Notify( "You already have this weapon!" ) return end end end ply:US_TakeCoins( US.Items[item]["cost"], "Bought the item \""..US.Items[item]["name"].."\"" ) hook.Call( "US_OnBuy", nil, ply, item ) return else ply:US_Notify( "You cannot afford "..US.Items[item]["name"] ) return end end ) ---------------------------------------mainpart if US.Items[item]["class"] then if ply:HasWeapon( US.Items[item]["class"] ) then ply:US_Notify( "You already have this weapon!" ) return end end end
if i try and set a model with my gamemode that forces the player upon spawn to set his model to models/player/combine_soldier.mdl and use util.precache models/player/combine_soldier.mdl it either does not work or just sets the player to a grey guy with no anims (the player model for half-life 2 games which you ain't supposed to see XD) y it no work XD
[QUOTE=RonanZer0;37984614]if i try and set a model with my gamemode that forces the player upon spawn to set his model to models/player/combine_soldier.mdl and use util.precache models/player/combine_soldier.mdl it either does not work or just sets the player to a grey guy with no anims (the player model for half-life 2 games which you ain't supposed to see XD) y it no work XD[/QUOTE] What?
Hey guys, i was wondering how to get my gundealer to sell guns separatley. someone told me to make the same shipment of the weapon but with the amount set to 1, but that didn't work out so well :/ and if i put the second statement true, the gun can get sold separatley, but by all jobs... and only the gundealer job needs to be able to sell guns seperatley so i did this, please help me! (don't go grammar nazi on my ass) [CODE] AddCustomShipment("357", "models/weapons/w_357.mdl", "weapon_mad_357", 400, 1, false, 400, false, {TEAM_GUN}) AddCustomShipment("P228", "models/weapons/w_pist_p228.mdl", "weapon_mad_p228", 210, 1, false, 210, false, {TEAM_GUN}) AddCustomShipment("USP", "models/weapons/w_pist_usp.mdl", "weapon_mad_usp", 210, 1, false, 210, false, {TEAM_GUN}) AddCustomShipment("Deagle", "models/weapons/w_pist_deagle.mdl", "weapon_mad_deagle", 300, 1, false, 300, false, {TEAM_GUN}) AddCustomShipment("C4 Explosive", "models/weapons/w_c4_planted.mdl", "weapon_mad_c4", 10000, 1, false, 10000, false, {TEAM_GUN}) AddCustomShipment("Shotgun", "models/weapons/w_shot_m3super90.mdl", "weapon_mad_m3", 900, 1, false, 900, false, {TEAM_GUN}) AddCustomShipment("AutoShotgun", "models/weapons/w_shot_xm1014.mdl", "weapon_mad_xm1014", 1300, 1, false, 1300, false, {TEAM_GUN}) AddCustomShipment("TMP", "models/weapons/w_smg_tmp.mdl", "weapon_mad_tmp", 500, 1, false, 500, false, {TEAM_GUN}) AddCustomShipment("P90", "models/weapons/w_smg_p90.mdl", "weapon_mad_p90", 600, 1, false, 600, false, {TEAM_GUN}) AddCustomShipment("M4A1", "models/weapons/w_rif_m4a1.mdl", "weapon_mad_m4", 950, 1, false, 950, false, {TEAM_GUN}) AddCustomShipment("Acid", "models/smile/smile.mdl", "durgz_lsd", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("Alcohol", "models/drug_mod/alcohol_can.mdl", "durgz_alcohol", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("asprin", "models/jaanus/aspbtl.mdl", "durgz_aspirin", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("cigarette", "models/boxopencigshib.mdl", "durgz_cigarette", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("cocaine", "models/cocn.mdl", "durgz_cocaine", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("heroine", "models/katharsmodels/syringe_out/syringe_out.mdl", "durgz_heroine", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("weed", "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl", "durgz_weed", 1200, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("shrooms", "models/ipha/mushroom_small.mdl", "durgz_mushroom", 2000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("water_bottle", "models/drug_mod/the_bottle_of_water.mdl", "durgz_water", 1000, 10, false, 0, false, {TEAM_DRUG}) AddCustomShipment("RPG", "models/weapons/w_rocket_launcher.mdl", "weapon_RPG", 140000, 10, false, 15000, false, {TEAM_GUN}) AddCustomShipment("LockPick", "models/weapons/w_crowbar.mdl", "lockpick", 4000, 10, false, 425, false, {TEAM_MOB}) AddCustomShipment("mid_kit", "models/weapons/w_c4.mdl", "med_kit", 1000, 10, false, 110, false, {TEAM_MEDIC}) AddCustomShipment("unarrest_stick", "models/weapons/w_stunbaton.mdl", "unarrest_stick", 750, 10, false, 80, false, {TEAM_GANG}) AddCustomShipment("keypad_cracker", "models/weapons/w_c4.mdl", "keypad_cracker", 0, 0, false, 600, true, {TEAM_MOB, TEAM_GANG}) AddCustomShipment("Tripmine", "models/weapons/w_c4.mdl", "weapon_slam", 3000, 10, false, 400, false, {TEAM_GUN}) AddCustomShipment("Grenade", "models/weapons/w_grenade.mdl", "weapon_frag", 48000, 10, false, 5000, false, {TEAM_GUN}) AddCustomShipment("M249", "models/weapons/w_mach_m249para.mdl", "weapon_mad_m249", 30000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Galil", "models/weapons/w_rif_galil.mdl", "weapon_mad_galil", 6200, 10, false, 470, false, {TEAM_GUN}) AddCustomShipment("AK47", "models/weapons/w_rif_ak47.mdl", "weapon_mad_ak47", 7500, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("M4A1", "models/weapons/w_rif_m4a1.mdl", "weapon_mad_m4", 7500, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Famas", "models/weapons/w_rif_famas.mdl", "weapon_mad_famas", 6500, 10, false, 450, false, {TEAM_GUN}) AddCustomShipment("AWP", "models/weapons/w_snip_awp.mdl", "weapon_mad_awp", 58000, 10, false, 12000, false, {TEAM_GUN}) AddCustomShipment("Scout", "models/weapons/w_snip_scout.mdl", "weapon_mad_scout", 12000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Steyr Aug", "models/weapons/w_rif_aug.mdl", "weapon_mad_aug", 11000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("SG552", "models/weapons/w_rif_sg552.mdl", "weapon_mad_sg552", 11000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("G3SG1", "models/weapons/w_snip_g3sg1.mdl", "weapon_mad_g3", 17000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("UMP45", "models/weapons/w_smg_ump45.mdl", "weapon_mad_ump", 5000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("P90", "models/weapons/w_smg_p90.mdl", "weapon_mad_p90", 6000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("TMP", "models/weapons/w_smg_tmp.mdl", "weapon_mad_tmp", 5000, 10, false, 380, false, {TEAM_GUN}) AddCustomShipment("MP5", "models/weapons/w_smg_mp5.mdl", "weapon_mad_mp5", 5000, 10, false, 350, false, {TEAM_GUN}) AddCustomShipment("Mac-10", "models/weapons/w_smg_mac10.mdl", "weapon_mad_mac10", 5000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("AutoShotgun", "models/weapons/w_shot_xm1014.mdl", "weapon_mad_xm1014", 13000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Shotgun", "models/weapons/w_shot_m3super90.mdl", "weapon_mad_m3", 9000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Frag Grenade", "models/weapons/w_eq_fraggrenade.mdl", "weapon_mad_grenade", 30000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Flash", "models/weapons/w_eq_flashbang_thrown.mdl", "weapon_mad_flash", 10000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Dual Elites", "models/weapons/w_pist_elite_dropped.mdl", "weapon_mad_dual", 2700, 10, false, 280, false, {TEAM_GUN}) AddCustomShipment("Deagle", "models/weapons/w_pist_deagle.mdl", "weapon_mad_deagle", 3000, 10, false, 280, false, {TEAM_GUN}) AddCustomShipment("USP", "models/weapons/w_pist_usp.mdl", "weapon_mad_usp", 2100, 10, false, 230, false, {TEAM_GUN}) AddCustomShipment("P228", "models/weapons/w_pist_p228.mdl", "weapon_mad_p228", 2100, 10, false, 220, false, {TEAM_GUN}) AddCustomShipment("Five-Seven", "models/weapons/w_pist_fiveseven.mdl", "weapon_mad_57", 1800, 10, false, 200, false, {TEAM_GUN}) AddCustomShipment("AR2", "models/weapons/w_irifle.mdl", "weapon_mad_ar2", 10000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("MP7", "models/weapons/w_smg1.mdl", "weapon_mad_mp7", 5000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Spas-12", "models/weapons/w_shotgun.mdl", "weapon_mad_spas", 10000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Spas-12", "models/weapons/w_shotgun.mdl", "weapon_mad_spas", 1000, 1, false, 1000, false, {TEAM_GUN}) AddCustomShipment("Medic kit", "models/items/w_medkit.mdl", "weapon_mad_medic", 2400, 10, false, 250, false, {TEAM_MEDIC}) AddCustomShipment("Grenade launcher", "models/weapons/w_shotgun.mdl", "weapon_mad_grenadelauncher", 25000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("Grenade launcher", "models/weapons/w_shotgun.mdl", "weapon_mad_grenadelauncher", 2500, 1, false, 2500, false, {TEAM_GUN}) AddCustomShipment("Mini-Nuke launcher", "models/weapons/w_rocket_launcher.mdl", "weapon_mad_rpg", 1000000, 10, false, 0, false, {TEAM_GUN}) AddCustomShipment("C4 Explosive", "models/weapons/w_c4_planted.mdl", "weapon_mad_c4", 200000, 5, false, 7000, false, {TEAM_GUN}) AddCustomShipment("Mine", "models/props_combine/combine_mine01.mdl", "weapon_mad_mine", 60000, 10, false, 7000, false, {TEAM_GUN}) AddCustomShipment("Incendiary", "models/weapons/w_eq_smokegrenade.mdl", "weapon_mad_incendiary", 50000, 10, false, 190, false, {TEAM_GUN}) AddCustomShipment("Knife", "models/weapons/w_knife_t.mdl", "weapon_mad_knife", 1600, 10, false, 180, false, {TEAM_GUN}) AddCustomShip
I'm probably missing something here but how do I send a bool via net lib?
Sorry, you need to Log In to post a reply to this thread.