[QUOTE=Willox;47047615]Sidemove definitely works for vehicles. That's how xbox controllers do it. Make sure you are modifying the usercmd before the SetupMove hook is called using either CreateMove clientside or StartCommand shared.[/QUOTE]
Ah, I tried it in SetupMove. I'll go back and test on CreateMove in a bit then; thanks for clearing that up ( although I have a functioning system that doesn't require messing with binds at the moment, etc... )
[editline]31st January 2015[/editline]
[QUOTE=Wyozi;47047666]What's the equivalent of gui.EnableScreenClicker() for keyboard input? I don't want to use MakePopup in this particular case (unless there's a way to undo it).[/QUOTE]
Well, nothing quite as open-ended as that but there are a few keyboard functions:
[url]http://wiki.garrysmod.com/page/vgui/GetKeyboardFocus[/url]
[url]http://wiki.garrysmod.com/page/Panel/IsKeyboardInputEnabled[/url]
[url]http://wiki.garrysmod.com/page/Panel/SetKeyBoardInputEnabled[/url]
[url]http://wiki.garrysmod.com/page/Panel/SetKeyboardInputEnabled[/url]
Is there a way to add a callback function for entity outputs?
[url]https://developer.valvesoftware.com/wiki/Npc_metropolice#Outputs[/url]
What would be the most efficient way to save a lot of data for each player using MySQL?
Some ideas of what I need to save:
[code][Gender, Model, Inventory, Stats, Skills, Health (so if they leave, come back at same health), Equipped, Bank] and there'll be more, but what I think of off the top of my head.[/code]
I was thinking of grouping them up into columns based on how alike they are and turning them into a JSON string, but I realized that would be extremely slow and there's a much better way. Same goes for Inventory, where I could just have a variable saying if it's equipped or not, eliminating the need for one column.
I want to try and keep it as organized and quick as possible, so as the database grows I don't have issues. So how should I keep all the data set up?
[QUOTE=Nookyava;47048927]What would be the most efficient way to save a lot of data for each player using MySQL?
Some ideas of what I need to save:
[code][Gender, Model, Inventory, Stats, Skills, Health (so if they leave, come back at same health), Equipped, Bank] and there'll be more, but what I think of off the top of my head.[/code]
I was thinking of grouping them up into columns based on how alike they are and turning them into a JSON string, but I realized that would be extremely slow and there's a much better way. Same goes for Inventory, where I could just have a variable saying if it's equipped or not, eliminating the need for one column.
I want to try and keep it as organized and quick as possible, so as the database grows I don't have issues. So how should I keep all the data set up?[/QUOTE]
This has been answered so many times in different posts.
Pretty much things like SteamID, name, gender, model, health and skills (each skill has its own column) can all go in one table, with each attribute having its own column (again, note what I said about skills).
Inventory would be its own table with columns being something like SteamID, item, quantity.
Stats would be in its own table with columns being SteamID and each statistic being a column.
There's a few ways to do this, but that is one of the easiest/acceptable ways to do it without breaking too many "rules of databasing".
Feel free to add me on Steam and I will help you get a database setup specifically for what you need. (Cool diagram included)
[editline]31 Jan 2015[/editline]
Here's an example with skills as a part of the user table as mentioned above:
[t]http://puu.sh/fiFNP/5005bb608c.png[/t]
Here's an example with skills separated, in their own table:
[t]http://puu.sh/fiFWv/7f2b9539c4.png[/t]
The second give you a bit more flexibility than the first, but in a GMod environment, both will perform about the same. At this point, it is pretty much up to preference.
-snip- got it
I'm working with a [URL="http://wiki.garrysmod.com/page/Category:RichText"]RichText[/URL] element. Whenever I highlight some appended text and try to Ctrl+C copy it, nothing is copied.
Am I missing something?
[QUOTE=Revenge282;47048966]
Inventory would be its own table with columns being something like SteamID, item, quantity.
[/QUOTE]
So like, STEAM_0:0:42 buys 3 of item 47, database would look like:
[code]
SteamID | Item | Quantity
------------------------------------
STEAM_0:0:42 | 47 | 3
[/code]
and then they buy 5 of item 32, would it be like:
[code]
SteamID | Item | Quantity
------------------------------------
STEAM_0:0:42 | 47 | 3
STEAM_0:0:42 | 32 | 5
[/code]
?
[QUOTE=zerf;47049627]So like, STEAM_0:0:42 buys 3 of item 47, database would look like:
[code]
SteamID | Item | Quantity
------------------------------------
STEAM_0:0:42 | 47 | 3
[/code]
and then they buy 5 of item 32, would it be like:
[code]
SteamID | Item | Quantity
------------------------------------
STEAM_0:0:42 | 47 | 3
STEAM_0:0:42 | 32 | 5
[/code]
?[/QUOTE]
Pretty much. It gets more complicated as far as things such as foreign keys and primary keys go, but that is the proper structure. Like I told Nookyava, add me on Steam if you have anymore questions or need help structuring. It's one of those things I love to do.
[editline]31 Jan 2015[/editline]
See what I edited in the quoted post for some more info.
[editline]31st January 2015[/editline]
[QUOTE=Mista Tea;47049623]I'm working with a [URL="http://wiki.garrysmod.com/page/Category:RichText"]RichText[/URL] element. Whenever I highlight some appended text and try to Ctrl+C copy it, nothing is copied.
Am I missing something?[/QUOTE]
Does it need to be parented to an EditablePanel?
[QUOTE=Mista Tea;47049623]I'm working with a [URL="http://wiki.garrysmod.com/page/Category:RichText"]RichText[/URL] element. Whenever I highlight some appended text and try to Ctrl+C copy it, nothing is copied.
Am I missing something?[/QUOTE]
What is your code? My RichTexts work fine.
[QUOTE=bobbleheadbob;47049813]What is your code? My RichTexts work fine.[/QUOTE]
Here's just an example using an unmodified element:
[code]lua_run_cl text = vgui.Create("RichText") text:SetSize(200,200) text:SetPos(ScrW()/2-100,ScrH()/2-100) text:AppendText( "Here's some text\n\nAnd some more text")[/code]
I am unable to use ctrl+c to copy the highlighted text, though now I notice you can right click it and select 'Copy'. Is that what you're doing, or are you actually able to use the keyboard shortcut?
[QUOTE=Mista Tea;47049886]Here's just an example using an unmodified element:
[code]lua_run_cl text = vgui.Create("RichText") text:SetSize(200,200) text:SetPos(ScrW()/2-100,ScrH()/2-100) text:AppendText( "Here's some text\n\nAnd some more text")[/code]
I am unable to use ctrl+c to copy the highlighted text, though now I notice you can right click it and select 'Copy'. Is that what you're doing, or are you actually able to use the keyboard shortcut?[/QUOTE]
Its parent might need keyboard input to be enabled to capture the Ctrl+C.
[QUOTE=bobbleheadbob;47050113]Its parent might need keyboard input to be enabled to capture the Ctrl+C.[/QUOTE]
Unfortunately, I'm already doing [B]self:SetKeyboardInputEnabled( true )[/B] and [B]self:SetMouseInputEnabled( true )[/B] on both the parent (EditablePanel) and the RichText element, which doesn't appear to make any difference.
While on the subject, do you use [URL="http://wiki.garrysmod.com/page/Panel/InsertClickableTextStart"]RichText:InsertClickableTextStart()[/URL] and [URL="http://wiki.garrysmod.com/page/Panel/InsertClickableTextEnd"]RichText:InsertClickableTextEnd()[/URL]? I can't seem to change the [B]font [/B]of the text that is appended when creating a clickable text element.
[B]RichText:SetFont()[/B] apparently no longer exists so I've been using [B]RichText:SetFontInternal()[/B] which does fine for just straight up RichText:AppendText(), but not if the text is made clickable.
[QUOTE=Mista Tea;47050161]Unfortunately, I'm already doing [B]self:SetKeyboardInputEnabled( true )[/B] and [B]self:SetMouseInputEnabled( true )[/B] on both the parent (EditablePanel) and the RichText element, which doesn't appear to make any difference.
While on the subject, do you use [URL="http://wiki.garrysmod.com/page/Panel/InsertClickableTextStart"]RichText:InsertClickableTextStart()[/URL] and [URL="http://wiki.garrysmod.com/page/Panel/InsertClickableTextEnd"]RichText:InsertClickableTextEnd()[/URL]? I can't seem to change the [B]font [/B]of the text that is appended when creating a clickable text element.
[B]RichText:SetFont()[/B] apparently no longer exists so I've been using [B]RichText:SetFontInternal()[/B] which does fine for just straight up RichText:AppendText(), but not if the text is made clickable.[/QUOTE]
Perhaps override the InsertClickableTextStart function to change the font to the default before inserting, then override InsertClickableTextEnd to change the font back after ending.
[QUOTE=bobbleheadbob;47050343]Perhaps override the InsertClickableTextStart function to change the font to the default before inserting, then override InsertClickableTextEnd to change the font back after ending.[/QUOTE]
I'm grateful for the suggestions.
Unfortunately, I have no idea what InsertClickableText* is doing internally since it's not exposed to Lua, so I'd have to use the original, unmodified function inside of the modified one to make the text actually clickable. Meaning it wouldn't change anything:
[CODE]
self._InsertClickableTextStart = self.InsertClickableTextStart
function self:InsertClickableTextStart( ... )
self:SetFontInternal( "font" )
return self:_InsertClickableTextStart( ... )
end
[/CODE]
Doing that is essentially the same thing as just setting the font prior to the call, which doesn't appear to have any effect.
[CODE]
self:SetFontInternal( "font" )
self:InsertClickableTextStart( "test" )
[/CODE]
Unless you are proposing something else.
Yeah I'm stumped.
I'm using mysqloo to return some information from a MySQL table.
This is the value I get from the query: ( printed with PrintTable(tbl) )
[IMG]http://i.imgur.com/SmdDvVq.png[/IMG]
I have tried different things, but nothing works. I want to get that "9" isolated (the result) as an integer. How would I do that?
is storing data for tracking time using this method okay? okay as in it's not bad.
time is stored for each server individually in 1 table. there is id, steamid, server, time, lastjoin and it creates a new row for each player and the server they join.
so like there could be up to 10 rows per player in the table for each server.
this is using mysql.
someone asked how to make clients able to run serverside code via !sv codegoeshere
they figured it out while i was writing my response, and closed the thread without telling everyone else their solution
so here's my would-be post for whoever cares
[quote=bitches blitches]Use the PlayerSay hook to get new chat entries serverside. OnPlayerChat is for clients.
[lua]
hook.Add("PlayerSay","dicks",function(ply,text,team)
if ply:IsAdmin() && string.StartWith(string.lower(text),"!sv ") then
local codetext = string.sub(text,5)
RunString(codetext)
return false
end
end)
[/lua][/quote]
[QUOTE=DannyCore;47053779]is storing data for tracking time using this method okay? okay as in it's not bad.
time is stored for each server individually in 1 table. there is id, steamid, server, time, lastjoin and it creates a new row for each player and the server they join.
so like there could be up to 10 rows per player in the table for each server.
this is using mysql.[/QUOTE]
It is okay to use as long as you only update on an interval and NOT every second. It can become a huge overhead if you update your tables every second. I suggest every few minutes.
[QUOTE=Pandaman09;47053968]It is okay to use as long as you only update on an interval and NOT every second. It can become a huge overhead if you update your tables every second. I suggest every few minutes.[/QUOTE]
it updates every 5 minutes + updates on player disconnect.
fetchs data on player join.
time is in second format and lastjoin is in epoch time.
Hey guys. I'm trying to code a SENT that sets its owner's respawn position to itself. I have 2 questions:
1. Do I want to use [URL="http://wiki.garrysmod.com/page/GM/PlayerSelectSpawn"]GM:PlayerSelectSpawn[/URL], or is there a way better?
2. Can I override the function in the SENT lua file, or does it need to be included in init.lua?
**If you have a better way of doing this, please do let me know!**
Thanks a bunch! :)
[QUOTE=Fillipuster;47052302]I'm using mysqloo to return some information from a MySQL table.
This is the value I get from the query: ( printed with PrintTable(tbl) )
[IMG]http://i.imgur.com/SmdDvVq.png[/IMG]
I have tried different things, but nothing works. I want to get that "9" isolated (the result) as an integer. How would I do that?[/QUOTE]
I'd say tbl[1].id_group should get you your value.
The picture is kinda tiny, so I don't know if there's something I'm missing though.
[QUOTE=DannyCore;47053779]is storing data for tracking time using this method okay? okay as in it's not bad.
time is stored for each server individually in 1 table. there is id, steamid, server, time, lastjoin and it creates a new row for each player and the server they join.
so like there could be up to 10 rows per player in the table for each server.
this is using mysql.[/QUOTE]
How are you going to tell how long they play when the only thing you track is when they join?
Can anyone tell me where to find a list of available icons, such as the ones usable for [url]http://wiki.garrysmod.com/page/spawnmenu/AddPropCategory[/url] ? I found no evidence of it in gmod, and am now so desperate that I'm making a search for "icon16" inside all of C:/. No useful results so far.
[QUOTE=Neat-Nit;47054464]Can anyone tell me where to find a list of available icons, such as the ones usable for [URL]http://wiki.garrysmod.com/page/spawnmenu/AddPropCategory[/URL] ? I found no evidence of it in gmod, and am now so desperate that I'm making a search for "icon16" inside all of C:/. No useful results so far.[/QUOTE]
Things like the icon16 images are contained in the Garry's Mod .vpk files now. GFScape can open them. Once you have it, go to garrysmod_dir.vpk in garrysmod/garrysmod and open materials -> icon16
-snip- nookyava saves the day!
[QUOTE=Mista Tea;47054491]Things like the icon16 images are contained in the Garry's Mod .vpk files now. GFScape can open them. Once you have it, go to garrysmod_dir.vpk in garrysmod/garrysmod and open materials -> icon16[/QUOTE]
Thanks a ton! I just used vpk.exe found in common\GarrysMod\bin - that's a useful folder. A few days ago I almost posted a "where the hell can I download a compiled goddamn version of gmad and gmpublish" thread before coming across it!
[code]function SWEP:ShootBullet( prec )
local cdTr = util.TraceLine( {
start = self.Owner:EyePos( ),
endpos = self.Owner:EyePos( ),
mask = MASK_SHOT,
filter = self.Owner
} )
local i = 0
local targetLength = self.Primary.BulletDrop.Dist
local velocityFrac = math.Clamp( self.Owner:GetVelocity( ):Length( ) / 100, 1, 4 )
while !cdTr.Hit do
cdTr = util.TraceLine( {
start = cdTr.HitPos,
endpos = cdTr.HitPos + self.Owner:EyeAngles( ):Forward( ) * ( ( targetLength / 8 ) ) + Vector( 0, 0, ( i * ( 2 ) * -1 ) ) + self.Owner:EyeAngles( ):Up( ) * math.Rand( -1 * prec, prec ) + self.Owner:EyeAngles( ):Right( ) * math.Rand( -1 * prec * velocityFrac, prec * velocityFrac ),
mask = MASK_SHOT,
filter = self.Owner
} )
i = i + 1
end
util.Decal( "ExplosiveGunshot", cdTr.HitPos + cdTr.HitNormal, cdTr.HitPos - cdTr.HitNormal )
if SERVER and !cdTr.HitWorld then
local ent = cdTr.Entity
local dmgInfo = DamageInfo( )
dmgInfo:SetAttacker( self.Owner )
dmgInfo:SetInflictor( self )
dmgInfo:SetDamageForce( self:GetPos( ) )
dmgInfo:SetDamagePosition( cdTr.HitPos )
dmgInfo:SetDamage( 100 )
dmgInfo:SetDamageType( DMG_ALWAYSGIB )
SuppressHostEvents( NULL )
ent:TakeDamageInfo( dmgInfo )
SuppressHostEvents( self.Owner )
if ent:GetPhysicsObject( ):IsValid( ) then
ent:GetPhysicsObject( ):AddVelocity( self.Owner:EyeAngles( ):Forward( ) * dmgInfo:GetDamage( ) * 2 )
end
end
end[/code]
So, I have this continually do traces downwards to simulate bullet drop, and I have the hit entity take damage. How in the world do I make this break glass?
[QUOTE=bobbleheadbob;47054357]I'd say tbl[1].id_group should get you your value.
The picture is kinda tiny, so I don't know if there's something I'm missing though.[/QUOTE]
That did the trick. Thankyou so much :D
If the client has something in their materials /materials/fakepath/thing.png, would it be show up in a DFileTree of that folder? I ask because I want people to be able to just put their own phone backgrounds in the materials folder and I test in single player so I cant test this
Sorry, you need to Log In to post a reply to this thread.