• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=Examnes;52643132]Who knows how to create your weapon just a script? (My friend, the developer on lua, said that this is possible and in general if something needs to be tested, it's better to do it exactly)[/QUOTE] You mean a Scripted Weapon? Google "Garry's Mod SWEP Tutorial". [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8e50.html[/url] [editline]3rd September 2017[/editline] [QUOTE=escept;52643135]On my server prop limits are not working for some reason [CODE] function GAMEMODE:PlayerSpawnProp( ply, model ) if stopprops == 1 then ply:ChatPrint("Global prop limit reached! Delete your props or wait."); return false; end if removed > 0 then return false; else return ply:CheckLimit( "props" ) end end [/CODE][/QUOTE] Where do you define and change stopprops? Also, why is it a number rather than a boolean?
[QUOTE=MPan1;52643169]Where do you define and change stopprops? Also, why is it a number rather than a boolean?[/QUOTE] [CODE]timer.Create("globallimit", 10, 0, function() local L = ents.FindByClass( "prop_*" ); if #L > 1800 then stopprops = 1 else stopprops = 0 end end)[/CODE] The global limit works fine but the limit per client doesn't..
You probably don't even need to make your own way to limit the number of props spawned. Just use sbox_maxprops. To limit the prop count to 1800: [CODE] sbox_maxprops 1800 [/CODE]
1800 is for the global limit. The limit per player is 200 but you can place unlimited props until you hit the global limit. And i don't want that.
[QUOTE=escept;52643249]1800 is for the global limit. The limit per player is 200 but you can place unlimited props until you hit the global limit. And i don't want that.[/QUOTE] In reality that method is inefficient anyways. (Running a timer every 10 seconds without the guarantee of another prop being spawned within that time period) [code]hook.Add( 'PlayerSpawnProp', 'PlayerSpawnProp.IncrementTotal', function( _Player, _Model, _Entity ) g_PropIncrement = #ents.FindByClass( 'prop_*' ) if g_PropIncrement >= 1800 then return false end return _Player:CheckLimit( 'props' ) end)[/code] Also, should probably mention that this includes all map props (not just spawned ones)
hmm even if i set the maxprops to 1 it still allows up to 1800 for each player
what i mean is the limit for each player is not working, only the global i have set up.
[QUOTE=escept;52643936]hmm even if i set the maxprops to 1 it still allows up to 1800 for each player[/QUOTE] because you're overriding sandbox's proplimit. Use hook.add instead.
Yes i'm doing that as kpjVideo said. and its always returning true..
Don't return anything if you don't want to disallow. That's how the hook system works.
How do I do something like PrintTable(player.GetAll()) but for superadmins or a specific rank?
[QUOTE=Castiel789;52645250]How do I do something like PrintTable(player.GetAll()) but for superadmins or a specific rank?[/QUOTE] [CODE]superadmins = {} for _, ply in pairs(player.GetAll()) do if ply:IsSuperAdmin() then -- or (ply:GetUserGroup() == "superadmin") table.insert(superadmins, ply) end end PrintTable(superadmins)[/CODE]
[QUOTE=Castiel789;52645250]How do I do something like PrintTable(player.GetAll()) but for superadmins or a specific rank?[/QUOTE] Loop through all players and check if they are a certain rank. If so, add them to a new table and print the resulting table.
I know there is a HUD addon for this, I can't find it anywhere and I forgot what it's called, I need something in similar form to this: [IMG]https://i.imgur.com/sds7xwr.png[/IMG] could anyone point my in the right direction? cheers
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/DrawTexturedRectUV]surface.DrawTexturedRectUV[/url] for draw the partial texture, that's the base, use EyePos, substract target pos and use :Angle().y to get the angle between you and the target, and then some maths
:snip:
Is it possible to change the way dropped weapons are drawn in the world? If I'm not mistaken its possible to change how the weapon is drawn in the world when held but not when dropped on the ground.
I thought that was only called when the player was holding the weapon. I'll test it out thanks.
how can I turn functions into string? like the whole function as string
Is it possible to get the attacker before damage is taken?
[QUOTE=escept;52650281]Is it possible to get the attacker before damage is taken?[/QUOTE] How would the attacker be an attacker if it hasn't attacked anything?
Nvm got it. I was looking for :GetAttacker(). I'm getting an error [CODE]attempt to index global 'render' (a nil value)[/CODE]
[QUOTE=gmoddertr;52650021]how can I turn functions into string? like the whole function as string[/QUOTE] What do you mean?
[QUOTE=Kevlon;52651301]What do you mean?[/QUOTE] I assume he means directly what he's saying, I don't know how to do it in Lua, but this is for example how you do it in JavaScript just to show you what I think he means: [img]https://i.imgur.com/pwOMa1a.png[/img] And as you can see, the whole function gets turned into a string, for whatever reason you want to do that for. I don't know if there's a direct Lua equivalent for Garry's Mod, though
[QUOTE=djjkxbox;52651332]I assume he means directly what he's saying, I don't know how to do it in Lua, but this is for example how you do it in JavaScript just to show you what I think he means: [img]https://i.imgur.com/pwOMa1a.png[/img] And as you can see, the whole function gets turned into a string, for whatever reason you want to do that for. I don't know if there's a direct Lua equivalent for Garry's Mod, though[/QUOTE] Yeah no lol, that's not how lua works. Closest you can get is [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/string/dump]string.dump[/url] on the function.
[QUOTE=Kevlon;52651365]Yeah no lol, that's not how lua works. Closest you can get is [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/string/dump]string.dump[/url] on the function.[/QUOTE] And even then, you can't load bytecode in GMod -- whatever he's trying to do, there's probably a much better way of doing it
[QUOTE=Kevlon;52651301]What do you mean?[/QUOTE] He added me on Steam. I was in a good mood, helped him out. It was a classic XY problem scenario. His problem is fixed now, last I heard.
-snip-
[QUOTE=NeatNit;52651937]He added me on Steam. I was in a good mood, helped him out. It was a classic XY problem scenario. His problem is fixed now, last I heard.[/QUOTE] I was thinking that in my head. What the hell are the circumstances you would need to print an entire function?
Sorry if this is the wrong place to be asking this, but my servers (ran from a dedicated server) seem to be 50/50 on whether or not they connect to the steam servers when they boot: "Could not establish connection to Steam servers. (Result = 3)" Changing port etc seems to do nothing, and googled answers seem either irrelevant due to the person's server ALWAYS doing it, or it simply doesn't fix it. Any help is greatly appreciated.
Sorry, you need to Log In to post a reply to this thread.