General > Developers Corner
Advice
Tomzen:
On my ForceMic command, I use "timer.Create", and "timer.Destroy" (or Remove), however the problem with this is that the timer is recreated every time you join, change map, or restart server as you type !accept which runs timer.Remove( "fmmsg" ), any way to make this so if you type it once, you will never have to again?
Or perhaps I should use something other than a timer?
Timmy:
You can use PData to read from and to the server's (or clients) SQLite database. PData is kept across map changes and server restarts. Have a look at the Player:SetPData and Player:GetPData functions.
With PData, set some kind of key for each player that can be true of false. Do or don't do stuff depending on the value of that key.
Alternatively, you can use some kind of data file. Write the SteamID of all players that accept in there... Then read... In that case, you will need to make use of the file library.
Reading SQLite is (probably) a lot faster than reading flat files though. So you should go with PData. :)
Edit: added some details
Aaron113:
Just use a client convar... http://wiki.garrysmod.com/page/Global/CreateClientConVar
Less data and stress on your server (not that it would be much anyway).
Tomzen:
Ahaha, again with the convar, thanks Aaron113.
MrPresident:
The only problem with using a convar is that it would remember the decision cross server and then the client might not know a new server is using the addon.
You're better off remembering the decision at the server level.
Navigation
[0] Message Index
[#] Next page
Go to full version