• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=bran92don;46053352]How bad is it to use a user message inside of a think hook to constantly keep the players hud up to date? I was trying to avoid doing this because to me it seems like its gonna ddos someones screen to no tomorrow. If you wondering what I am doing I am trying to send the blood amount of the player to their screen. The thing is the players blood amount is constantly building up over time if it is below 100.[/QUOTE] don't do that you can trust the client to display it and add to it as long as you keep the actual value on the server, that way you only have to network it every once in a while
[QUOTE=PortalGod;46053400]don't do that you can trust the client to display it and add to it as long as you keep the actual value on the server, that way you only have to network it every once in a while[/QUOTE] I am confused by what you mean. If your talking about using network vars like this: [url]http://wiki.garrysmod.com/page/Entity/NetworkVar[/url] Anytime I tried to use them on the player entity they never worked. The variable is set on the server side like this as of right now though: [code] ply.blood = 100 [/code] I also changed it around to where it isn't on tick but based on seconds to update it.
[QUOTE=bran92don;46053450]I am confused by what you mean. If your talking about using network vars like this: [url]http://wiki.garrysmod.com/page/Entity/NetworkVar[/url] Anytime I tried to use them on the player entity they never worked. The variable is set on the server side like this as of right now though: [code] ply.blood = 100 [/code] I also changed it around to where it isn't on tick but based on seconds to update it.[/QUOTE] If NetworkVar isn't working, then chances are your [url]http://wiki.garrysmod.com/page/ENTITY/SetupDataTables[/url] function isn't being called properly, or at all. But, that would by far be your best way to go about networking something like that to the client.
The [B]Player:StripWeapon[/B] function is throwing up an error saying it doesn't exist for me. I'm running Trouble in Terrorist Town on my server. I could be using it wrong? I'm running it in the TTTBeginRound hook, and the way I'm using it is something like this: [code]for _, ply in pairs( player.GetAll( ) ) do if ply:CheckGroup( 'somegroup' ) and ply:Alive( ) then ply:StripWeapon( 'weapon_ttt_SomeWeapon' ) ply:Give( 'weapon_ttt_BetterWeapon' ) end end[/code]
[QUOTE=zeaga;46053704]The [B]Player:StripWeapon[/B] function is throwing up an error saying it doesn't exist for me. I'm running Trouble in Terrorist Town on my server. I could be using it wrong? I'm running it in the TTTBeginRound hook, and the way I'm using it is something like this: [code]for _, ply in pairs( player.GetAll( ) ) do if ply:CheckGroup( 'somegroup' ) and ply:Alive( ) then ply:StripWeapon( 'weapon_ttt_SomeWeapon' ) ply:Give( 'weapon_ttt_BetterWeapon' ) end end[/code][/QUOTE] I could be wrong but I think you need to check to see if the player has the weapon before you can strip it. [url]http://wiki.garrysmod.com/page/Player/HasWeapon[/url] Also I've never seen the CheckGroup function, unless its something you made custom its [URL="http://wiki.garrysmod.com/page/Player/IsUserGroup"]IsUserGroup[/URL]. [CODE]for _, ply in pairs( player.GetAll( ) ) do if ply:IsUserGroup( "somegroup" ) and ply:Alive( ) and ply:HasWeapon("weapon_ttt_SomeWeapon") then ply:StripWeapon( "weapon_ttt_SomeWeapon" ) ply:Give( "weapon_ttt_BetterWeapon" ) end end[/CODE]
[QUOTE=TheEmp;46053752]I could be wrong but I think you need to check to see if the player has the weapon before you can strip it. [URL]http://wiki.garrysmod.com/page/Player/HasWeapon[/URL] Also I've never seen the CheckGroup function, unless its something you made custom its [URL="http://wiki.garrysmod.com/page/Player/IsUserGroup"]IsUserGroup[/URL].[/QUOTE] It's ULib, but I actually should use IsUserGroup since I don't want inheritance.
Network vars are slow. They seem to re-query the server almost every time they were called. I used to use them for my vehicle system ( lights, audio, and other systems controlled ) and when I switched to my new data system which only updates them when the values have changed, it increased fps, etc, because it wasn't constantly requerying... If you do use NetworkVars, at least cache them: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_gm_specific_darkrp/darkrp_customcheck_isvip_via_list_or_group_or_admin_check.lua.html[/url]
[QUOTE=TheEmp;46053752]I could be wrong but I think you need to check to see if the player has the weapon before you can strip it. [url]http://wiki.garrysmod.com/page/Player/HasWeapon[/url] Also I've never seen the CheckGroup function, unless its something you made custom its [URL="http://wiki.garrysmod.com/page/Player/IsUserGroup"]IsUserGroup[/URL]. [CODE]for _, ply in pairs( player.GetAll( ) ) do if ply:IsUserGroup( "somegroup" ) and ply:Alive( ) and ply:HasWeapon("weapon_ttt_SomeWeapon") then ply:StripWeapon( "weapon_ttt_SomeWeapon" ) ply:Give( "weapon_ttt_BetterWeapon" ) end end[/CODE][/QUOTE] StripWeapon works regardless of whether you have it or not because all it does is destroy a weapon if the classname matches the argument. If not, nothing happens. His issue is that he forgot that the method is SERVER only.
[QUOTE=zeaga;46053704]The [B]Player:StripWeapon[/B] function is throwing up an error saying it doesn't exist for me. I'm running Trouble in Terrorist Town on my server. I could be using it wrong? I'm running it in the TTTBeginRound hook, and the way I'm using it is something like this: [code]for _, ply in pairs( player.GetAll( ) ) do if ply:CheckGroup( 'somegroup' ) and ply:Alive( ) then ply:StripWeapon( 'weapon_ttt_SomeWeapon' ) ply:Give( 'weapon_ttt_BetterWeapon' ) end end[/code][/QUOTE] Make sure it is called only on the SERVER; I believe TTTBeginRound is set up to be called on both the CLIENT and SERVER. Edit: Ninja'd.
[QUOTE=BFG9000;46054740]His issue is that he forgot that the method is SERVER only.[/QUOTE] [QUOTE=Acecool;46054743]Make sure it is called only on the SERVER; I believe TTTBeginRound is set up to be called on both the CLIENT and SERVER.[/QUOTE] Thanks, that's probably it. I thought it was a server hook. [editline]23rd September 2014 at 03:39 AM[/editline] Yep! Thanks!
Is it possible to hide the value of sv_downloadurl ?
[QUOTE=khalidafla;46056074]Is it possible to hide the value of sv_downloadurl ?[/QUOTE] No
[QUOTE=khalidafla;46056074]Is it possible to hide the value of sv_downloadurl ?[/QUOTE] You can restrict access to users that are on your server though... You would need to make a flat-file / database system so that on player_connect game-event it sends a message to the database and adds the users ip to the allowed list. Remove it on player_disconnect. Then, using htaccess, you'd direct all queries through a php file. The php file would then serve the file that is requested if on the authorized list; otherwise do nothing / return an error.
I need more advice rather than actual help here. Basically, I'm making a Last Request menu for jailbreak. The last prisoner alive will have a menu appear on their screen where they pick one option; i.e guards can only pick up secondaries next round. The round then ends and then on round start, it takes affect. What is the best way to do this? The main thing I'm wracking my brain on is making sure it applies on the round end, stays there on round start and then on the next round end, the effects then goes away. Like, should I grab the current round number and check if it's round number + 1 to stop the currently LR effect The gamemode has a hook for RoundEnd/RoundStart, as well as a round number. I'm trying to avoid editing the base gamemode itself aaaa
Why do you have Lr menu? Its not needed. NPIGamers jailbreak servers are awesome just because they keep things simple and lets the player say the lr to the warden and he can deny it or accept it. No need to have a system like a lr menu.
[QUOTE=Acecool;46056639]You can restrict access to users that are on your server though... You would need to make a flat-file / database system so that on player_connect game-event it sends a message to the database and adds the users ip to the allowed list. Remove it on player_disconnect. Then, using htaccess, you'd direct all queries through a php file. The php file would then serve the file that is requested if on the authorized list; otherwise do nothing / return an error.[/QUOTE] i think you can just restrict by referrer
[QUOTE=NiandraLades;46057376]I need more advice rather than actual help here. Basically, I'm making a Last Request menu for jailbreak. The last prisoner alive will have a menu appear on their screen where they pick one option; i.e guards can only pick up secondaries next round. The round then ends and then on round start, it takes affect. What is the best way to do this? The main thing I'm wracking my brain on is making sure it applies on the round end, stays there on round start and then on the next round end, the effects then goes away. Like, should I grab the current round number and check if it's round number + 1 to stop the currently LR effect The gamemode has a hook for RoundEnd/RoundStart, as well as a round number. I'm trying to avoid editing the base gamemode itself aaaa[/QUOTE] I'd suggest that you have a table of hook names (keys) and functions (values) for each LR that should be applied at the beginning of the round. When the LR is chosen, apply the table to the GAMEMODE object, something like: [lua]GAMEMODE.NextLRHooks = table[/lua] At the beginning of the round apply all of the hooks to a different variable and clear the old one. [lua] if not GAMEMODE.NextLRHooks then return end for name, func in pairs( GAMEMODE.NextLRHooks ) do hook.Add( name, "LRHook", func ) end GAMEMODE.LRHooks = GAMEMODE.NextLRHooks GAMEMODE.NextLRHooks = nil[/lua] At the end of the round clear all the hooks, and the process repeats itself [lua]for name, func in pairs( GAMEMODE.LRHooks ) do hook.Remove( name, "LRHook" ) end[/lua]
[QUOTE=NiandraLades;46057376]I need more advice rather than actual help here. Basically, I'm making a Last Request menu for jailbreak. The last prisoner alive will have a menu appear on their screen where they pick one option; i.e guards can only pick up secondaries next round. The round then ends and then on round start, it takes affect. What is the best way to do this? The main thing I'm wracking my brain on is making sure it applies on the round end, stays there on round start and then on the next round end, the effects then goes away. Like, should I grab the current round number and check if it's round number + 1 to stop the currently LR effect The gamemode has a hook for RoundEnd/RoundStart, as well as a round number. I'm trying to avoid editing the base gamemode itself aaaa[/QUOTE] Never seen the code for that game mode, but.. When does the menu trigger? When conditions trigger a round end? Does LR only work if it's a single prisoner alive? You could try to check for the last prisoner alive on each death and then show the menu If you're not editing any base game files, then your changes won't persist on a new round if your code doesn't run right?
Much appreciated! I hadn't thought of that solution and I may look into it further [QUOTE=Icejjfish;46057470]Why do you have Lr menu? Its not needed. NPIGamers jailbreak servers are awesome just because they keep things simple and lets the player say the lr to the warden and he can deny it or accept it. No need to have a system like a lr menu.[/QUOTE] I was going to have one button which is basically input your own custom one, that'll print to chat or whatever. My problem with JB is that people get distracted easily and often LRs would get forgotten. That and it allows me to implement lua behind the scenes to enhance them. Like, if a prisoner wanted guards to only be able to pick up secondaries, the guards would have to play correctly with for this to work, wheras with a menu, I can block it via PlayerCanPickupWeapon [editline]23rd September 2014[/editline] [QUOTE=Blasteh;46057631] When does the menu trigger? When conditions trigger a round end? Does LR only work if it's a single prisoner alive?[/QUOTE] Becomes available when there is one player left alive, basically when the second last one dies. Uhh, basically rounds end either when time is up or when only one team is alive Yes
[QUOTE=Kamshak;46057515]i think you can just restrict by referrer[/QUOTE] The referrer header can easily be spoofed.
[QUOTE=mcd1992;46057773]The referrer header can easily be spoofed.[/QUOTE] I'm aware of that, fully agree, and it is fairly irrelevant for fastdl servers. Since the reason to protect it would be to prevent traffic steal from other servers (with similar / same content) it would be fully sufficient. Noone will be able to access it directly without some effort (same effect as acecools fairly complex solution).
[lua]if ( input.IsKeyDown( KEY_E ) && IsValid( blah ) && !LocalPlayer:IsTyping() ) then[/lua] also tried [lua]if ( input.IsKeyDown( KEY_E ) && IsValid( blah ) && !LocalPlayer():IsTyping() ) then[/lua] It's in cl_init.lua. This is the error: [code]cl_init.lua:39: attempt to index global 'LocalPlayer' (a function value)[/code] (If it matters, it is inside a hook inside a derma function)
[QUOTE=RonanZer0;46058177][lua]if ( input.IsKeyDown( KEY_E ) && IsValid( blah ) && !LocalPlayer:IsTyping() ) then[/lua] also tried [lua]if ( input.IsKeyDown( KEY_E ) && IsValid( blah ) && !LocalPlayer():IsTyping() ) then[/lua] It's in cl_init.lua. This is the error: [code]cl_init.lua:39: attempt to index global 'LocalPlayer' (a function value)[/code] (If it matters, it is inside a hook inside a derma function)[/QUOTE] First code you've tried [lua]!LocalPlayer:IsTyping()[/lua] Forgot your parentheses. It's likely the file didn't refresh when you modified it so you still got the error.
[QUOTE=NiandraLades;46057643]Much appreciated! I hadn't thought of that solution and I may look into it further I was going to have one button which is basically input your own custom one, that'll print to chat or whatever. My problem with JB is that people get distracted easily and often LRs would get forgotten. That and it allows me to implement lua behind the scenes to enhance them. Like, if a prisoner wanted guards to only be able to pick up secondaries, the guards would have to play correctly with for this to work, wheras with a menu, I can block it via PlayerCanPickupWeapon [editline]23rd September 2014[/editline] Becomes available when there is one player left alive, basically when the second last one dies. Uhh, basically rounds end either when time is up or when only one team is alive Yes[/QUOTE] To add to what Internet1001 said: You could do it that way, but it would be best to have a "Setup" and "Remove" function set up for each of the LRs.. You could use a QUEUE data-structure for the system. OnRoundBegin Pop and Setup. OnRoundEnd, Remove ( and at some time the LR is picked and added to QUEUE.. Add a limit so it needs to be selected before round start or a random one is chose, or none at all ).. This may be the easiest solution because you won't have to worry about the current being overwritten allowing time to Setup and Remove effects ( GAMEMODE.CurrentLR or whatever could be the reference to the current one which is Pop'ed. GAMEMODE.CurrentLR = dataStruct:Pop( ); / GAMEMODE.CurrentLR:Setup( ); / GAMEMODE.CurrentLR:Remove( ); -- On select dataStruct:Push( "tag" ); )... If you store the data in a file at round end, you could have it load the file on map-change so that ALL rounds ( even first ) will honor the LR except the first ever round where it is installed. Crashes should be covered with LR in place as server comes back online because the file should only be updated at round end... Examples: How I do slay next round... only updates slay-count if player stays until end of round: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/simple_slay_next_round/sv_slaynr.lua.html[/url] Buy special rounds ( Although there may be a disconnect mid-round bug in this ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/simple_pointshop_make_traitordetective_system/sv_pointshop_special_rounds_system.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/simple_pointshop_make_traitordetective_system/item_buy_traitor.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/simple_pointshop_make_traitordetective_system/item_buy_detective.lua.html[/url]
[QUOTE=NiandraLades;46057643]Much appreciated! I hadn't thought of that solution and I may look into it further I was going to have one button which is basically input your own custom one, that'll print to chat or whatever. My problem with JB is that people get distracted easily and often LRs would get forgotten. That and it allows me to implement lua behind the scenes to enhance them. Like, if a prisoner wanted guards to only be able to pick up secondaries, the guards would have to play correctly with for this to work, wheras with a menu, I can block it via PlayerCanPickupWeapon [editline]23rd September 2014[/editline] Becomes available when there is one player left alive, basically when the second last one dies. Uhh, basically rounds end either when time is up or when only one team is alive Yes[/QUOTE] I was trying to think if there's any other ways to do it, but a timer would provide unpredictable results. Pretty much just check for player deaths then run the menu on the last prisoner in this case. You would also have to consider what happens if they don't pick an option, if they disconnect, or if the round ends before they are able to pick an option..
So seriously, is there a way to make the hands built into a view model invisible, through scripting? For instance, I have v_smg1 and i want to get rid of the HEV suit hands on it, but WITHOUT creating a new model. I want to do this with scripting. Is this possible? In a gist, basically I want to change a v_model into a c_model with lua. (without making a new .mdl file)
It may be worth it to see if the hands have bones; if they do then they can be moved way off screen. You shouldn't have any issue replacing the HEV hand textures with something nodraw: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/map_textures/replacing_textures_in_realtime.lua.html[/url]
[QUOTE=Acecool;46059001]It may be worth it to see if the hands have bones; if they do then they can be moved way off screen. You shouldn't have any issue replacing the HEV hand textures with something nodraw: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/map_textures/replacing_textures_in_realtime.lua.html[/url][/QUOTE] In source engine, everything that moves has bones. Hell, each prop technically has 1 bone. If I can figure out how to move bones (which I should figure out anyway, given other things I wanna do) then I'll try that. However, I do wonder. Will the C_Hands model's bones move with them? I have NO idea how the c_model system works. If I do manage to make my own c_ models however, I'll save the idea for future reference, just in case. Thank you! :smile:
While we're at it, is there any way to somewhat bonemerge GMod hands on HEV suit hands so you can make old viewmodels glorious?
[QUOTE=Tenrys;46059301]While we're at it, is there any way to somewhat bonemerge GMod hands on HEV suit hands so you can make old viewmodels glorious?[/QUOTE] ? Uh, they kinda are, if I'm reading you correctly? I've had sweps that used gmod hands, and had v_models before... and they just z-fight eachother. They follow the exact same animations, and their bones are positioned and moving at the exact same places at the exact same time. [editline]23rd September 2014[/editline] And that was my entire intent for getting rid of the HEV hands, to "make old viewmodels glorious" [editline]Cus I didn't wanna automerge[/editline] Didn't want an auto-merge post, so I'm placing this question here. I'm curious here, when an NPC is about 3 meters or less away, 1 headshot from my pistol kills them. I want this, but when they're more like 10 meters away it takes 3 shots. Why? My scout rifle always does 1 shot headshot kills, and I wish the same for my pistol, but I do not want to increase the pistols damage. Why is it my weapon stops killing combine soldiers with 1 headshot when they're farther away? P.S. I really don't want the need to use CallBack functions.
Sorry, you need to Log In to post a reply to this thread.