Hey guys, I'm working on a small admin mod for fun, and I'm setting and checking for flags via SetNetworkedString, and GetNetworkedString. My question is, is this a bad idea? My buddy told me people could just do
lua_run_cl LocalPlayer():SetNetworkedString("flags", "O,N,J,B") and get whatever flags. But I ran:
[code]
] lua_run_cl LocalPlayer():SetNetworkedString("flags", "N")
] lua_run_cl print(LocalPlayer():GetNetworkedString("flags"))
N,T,D,M,A,O,J
[/Code]
And it looks like it didn't change my flags.. So.. Networked Vars.. Safe?
Edit: I know it says "Running this function clientside will only set it clientside - not serverside. You should set networked variables to their defaults in the initilization function of a scripted entity or SWEP. " on the wiki, but what's the chances of someone being able to exploit this? Also, is there a better way? :P
[QUOTE=Gbps;18388879][url="http://wiki.garrysmod.com/?title=Bitwise"]Learn, Love, Live[/url][/QUOTE]
I love how your replies are always so helpful and constructive.
Well actually, bitwise would be a better solution, but that's totally not related to his question. :v:
Also, networked variables should be completely safe, there is no way to set them from the client. Unless you have a clientside features which works only for admins, but then there is no real way to prevent that from being exploited, other than enabling scriptenforcer.
Yeah I do. :P Now I'm just looking for a better way, but bitwise is destroying my soul. Hopefully Gbps can help me out on steam. He's looking at my nasty code. :)
Well, my original intent was to prove to him that bitwise is a much efficent way to do flags,but I ended up showing the magic of usermessages and I think the problem was solved :buddy:
Usually my comments are more constructive than that, but I knew I would hear the ding of the steam message in a matter of minutes so I decided that I would see how much help he really needed :3
[editline]11:20PM[/editline]
As to the OP,
Don't assume a player has a flag on the clientside when an action has taken place, always check the serverside before the action. ;)
[QUOTE=_Kilburn;18388964]I love how your replies are always so helpful and constructive.
Well actually, bitwise would be a better solution, but that's totally not related to his question. :v:
Also, networked variables should be completely safe, there is no way to set them from the client. Unless you have a clientside features which works only for admins, but then there is no real way to prevent that from being exploited, other than enabling scriptenforcer.[/QUOTE]
scriptenforcer doesn't really help here. Even if we assume scriptenforcer cannot be broken, it can still be sniffed, especially when it's a string that can be easily identified.
on topic:
if you want to associate a value with a player/entity/whatever, there are two ways:
1. global/file-local table with key = player/entity/whatever. however, that needs to be cleaned up when an entity/player gets removed.
2. player/entity/whatever.field_name_that_should_be_reasonably_unique = value
I've got it figured out :) I decided I don't really need the clients to see the flags. So I just threw them into some server tables :) Thanks for the help guys
Sorry, you need to Log In to post a reply to this thread.