[url=http://drakehawke-gmod.googlecode.com/svn/trunk/AndyVincentGMod/RELEASE]MySQLOO[/url] is working, there's a working version of tmysql out there too, I don't have a link for it though sorry.
[QUOTE=Splambob;37630310]I have a mirror-plane defined by a normal vector and a center position. I want to get [i]any[/i] angle which points along the plane, and respects the normal direction.
[/QUOTE]
Ok perhaps I'm being stupid but, it looks to me like I'm misunderstanding again.
You have a plane, defined by the vector normal to it and a central point on the plane. Any angle which points [i]along[/i] the plane would be normal to the normal of the plane ... (I.E 90 degrees with respect to the normal as per your specifications)
Perhaps a diagram would help :v:
So i've tried to start from scratch, this code doesn't work and I no longer know what to do to fix it, the DLabel doesn't popup and I've gotten this error: [lua\autorun\client\rules_menu.lua:26] unexpected symbol near '-'
[code]
function RulesMenu()
local DermaPanel = vgui.Create( "DFrame" ) -- Creates the frame itself
DermaPanel:SetPos( (ScrW()/2)-DermaPanel:GetWide(),(ScrH()/2)-DermaPanel:GetTall() )
DermaPanel:SetSize( 500, 900 ) -- Size of the frame
DermaPanel:SetTitle( "RulesMenu" ) -- Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) -- Draggable by mouse?
DermaPanel:ShowCloseButton( true ) -- Show the close button?
DermaPanel:MakePopup() -- Show the frame
local SomeCollapsibleCategory = vgui.Create("DCollapsibleCategory", DermaPanel)
SomeCollapsibleCategory:SetPos( (ScrW()/2)-DermaPanel:GetWide(),(ScrH()/2)-DermaPanel:GetTall() )
SomeCollapsibleCategory:SetSize( 450, 850 ) -- Keep the second number at 50
SomeCollapsibleCategory:SetExpanded( 0 ) -- Expanded when popped up
SomeCollapsibleCategory:SetLabel( "Our Collapsible Category" )
local DermaList = vgui.Create( "DPanelList", SomeCollapsibleCategory )
DermaList:SetPos( (ScrW()/2)-DermaPanel:GetWide(),(ScrH()/2)-DermaPanel:GetTall() )
DermaList:SetSize( 400, 800 )
DermaList:SetSpacing( 5 ) -- Spacing between items
DermaList:EnableHorizontal( false ) -- Only vertical items
DermaList:EnableVerticalScrollbar( true ) -- Allow scrollbar if you exceed the Y axis
SomeCollapsibleCategory:SetContents( CategoryList )
local myLabel = vgui.Create("DLabel")
myLabel:SetPos( ScrW()/2)-DermaPanel:GetWide(),(ScrH()/2)-DermaPanel:GetTall() ) // Position
myLabel:SetColor(Color(255,255,255,255)) // Color
myLabel:SetFont("default")
myLabel:SetText( "1. Don't random death-match")
--[[-Definition of RDM follows-
Killing someone on random impulse, if someone
isn't threatening your or is tresspassing, you
may not kill them. If someone is constantly harassing
you, attack them at your discretion.
2. Obey NLR, the NLR wait time is 2 minutes
3. Do not minge around with props, you know what that is, this includes propclimb.
4. Do not use hacks, or addons that give you an unfair advantage.
5. Respect others despite their age, affiliation, race, gender, or sexual oriantation.
6. Do not spam props, or entities.)]]-- // Text
myLabel:SizeToContents() // make the control the same size as the text.
CategoryList:AddItem( CategoryContentOne ) -- Add the above item to our list
end
concommand.Add( "open_RulesMenu", RulesMenu ) [/code]
[QUOTE=Crossu88;37636379]-snip-[/QUOTE]
You need to proof read your code because that error was pretty simple to solve if you read over your code instead of hopping straight to facepunch.
Use [.lua][./lua] tags aswell it helps so you don't have to go into np++ to see line numbers.
Your error fixed:
[lua]
--You missed a >(< under here.
myLabel:SetPos( (ScrW()/2)-DermaPanel:GetWide(),(ScrH()/2)-DermaPanel:GetTall() ) // Position
[/lua]
-snip- Fixed the problem.
[QUOTE=Crossu88;37637210]Also, this menu doesn't go past line 7 some reason.
[/QUOTE]
so you're saying it doesn't pop up?
-snip-
-snip-
Getting somewhat of a kick out of watching, of all people, brandonj4 talking down to people like they're 12. If you're going to help them, help them. If you're going to undermine/demean them, leave.
[QUOTE=Divran;37632646]Looks like you're calling drrawGuis serverside. Your menu doesn't exist on the server, only the client[/QUOTE]
Ok, how would i call the function clientside?
Im not very experienced with lua :D
[QUOTE=TNOMCat;37640887]Ok, how would i call the function clientside?
Im not very experienced with lua :D[/QUOTE]
You can simply do
[code]function TOOL:LeftClick( trace )
if SERVER then return true end
drawGuis()
end[/code]
to cause the server to exit out of the function without calling drawGuis, while the client keeps going.
This will break it in single player, however, because garry made LeftClick not run on the client in single player. To fix that, you'll have to use usermessages. Just ask again if you need help with that.
I'd love some help on how to go about debugging binary modules in GM13 (at least I think it's because of my binary module).
Everything works perfectly but suddenly GMod just crashes.
There are no MDMP files generated that I can see.
Attaching a debugger to GMod just makes it terminate instantly.
And I cannot successfully reproduce it as it only happens randomly...
Where do I even begin in order to figure this out?
[QUOTE=Divran;37641011]You can simply do
[code]function TOOL:LeftClick( trace )
if SERVER then return true end
drawGuis()
end[/code]
to cause the server to exit out of the function without calling drawGuis, while the client keeps going.
This will break it in single player, however, because garry made LeftClick not run on the client in single player. To fix that, you'll have to use usermessages. Just ask again if you need help with that.[/QUOTE]
Ok, i need help with that :P
The tool is mostly for single.
[QUOTE=TNOMCat;37643305]Ok, i need help with that :P
The tool is mostly for single.[/QUOTE]
[code]function TOOL:LeftClick( trace )
if SERVER and SinglePlayer() then -- If it's single player
umsg.Start( "drawguis_toolfix", self:GetOwner() ) -- Start a new usermessage
umsg.End() -- Send the usermessage
return true
elseif SERVER then return true end -- If it isn't single player, exit this function
drawGuis() -- If it isn't single player, this will run client side
end
usermessage.Hook( "drawguis_toolfix", function( um ) -- Receive the usermessage
drawGuis()
end)[/code]
Splambob: Normalized Cross product with random vector that isn't in the direction of the normal:
[lua]Normal:Cross(Normal + Vector(Normal.y, Normal.x, 1)):GetNormalized()[/lua]
The vector I'm multiplying with, (Vector(Normal.y, Normal.x, 1)), can never be in the direction of the normal, so the vector you'll get will always be perpendicular to the plane.
[QUOTE=_Chewgum;37628334]Have you tried changing "Gamemode" to "nb" in the nb.txt?[/QUOTE]
Yea, just tried a minute ago with still no luck.
So I've been working on this Blackjack system recently, but I've come to a hitch that I can't work out for the life of me. I'll say that it's probably a simple error and I'm being special, but I've literally spent hours trying to work this out, including a good 15minutes earlier today staring it out after a few days away from it to see if that clears anything up, all to no avail
I should also state that this has been developed in the GMod 13 beta, so maybe it could be a problem with that rather than the code itself (again, probably just my error though)
Using the snippet posted below, and 2 calls of each function, the expected outcome would be that PlayerCards would = 2, and DealerCards would also = 2. However, for some unknown reason, PlayerCards counts fine, but DealerCards seems to return instead of adding the values
[lua]function PANEL:CreatePlayerCard( suit, value, hidden )
self.PlayerCards = self.PlayerCards + 1
print( "[DEBUG] self.PlayerCards = "..self.PlayerCards )
local Card = vgui.Create( "blackjack_card", self )
Card.PlayerCard = true
Card:SetPos( 32+(self.PlayerCards * (32)), 190 )
Card:SetProperties( suit, value, hidden )
print( "[DEBUG] Player card created: "..suit.." "..value )
table.insert( self.Cards, Card )
self.PlayerCards = 0
self.PlayerTotal = 0
for k, v in pairs(self.Cards) do
if !v.PlayerCard then return end
self.PlayerCards = self.PlayerCards + 1
if v.Value == "ACE" then
if self.PlayerTotal + 11 > 21 then
self.PlayerTotal = self.PlayerToal + 1
else
self.PlayerTotal = self.PlayerTotal + 11
end
else
self.PlayerTotal = self.PlayerTotal + CardValues[v.Value]
end
end
print( "[DEBUG] self.PlayerTotal = "..self.PlayerTotal )
end
function PANEL:CreateDealerCard( suit, value, hidden )
self.DealerCards = self.DealerCards + 1
print( "[DEBUG] self.DealerCards = "..self.DealerCards )
local Card = vgui.Create( "blackjack_card", self )
Card.PlayerCard = false
Card:SetPos( 416+(self.DealerCards * (32)), 190 )
Card:SetProperties( suit, value, hidden )
print( "[DEBUG] Dealer card created: "..suit.." "..value )
table.insert( self.Cards, Card )
self.DealerCards = 0
self.DealerTotal = 0
for k, v in pairs(self.Cards) do
if v.PlayerCard then print("[DEBUG] RETURNING") return end
self.DealerCards = self.DealerCards + 1
if v.Value == "ACE" then
if self.DealerTotal + 11 > 21 then
self.DealerTotal = self.DealerToal + 1
else
self.DealerTotal = self.DealerTotal + 11
end
else
self.DealerTotal = self.DealerTotal + CardValues[v.Value]
end
end
print( "[DEBUG] self.PlayerTotal = "..self.PlayerTotal )
end[/lua]
Here's the dump of the improvised print errors that I use for debugging:
[quote][DEBUG] ReceiveDeal running...
[DEBUG] 4 cards received
[DEBUG] self.PlayerCards = 1
[DEBUG] Player card created: HEARTS ACE
[DEBUG] self.PlayerTotal = 11
[DEBUG] self.PlayerCards = 2
[DEBUG] Player card created: HEARTS 8
[DEBUG] self.PlayerTotal = 19
[DEBUG] Created player cards
[DEBUG] self.DealerCards = 1
[DEBUG] Dealer card created: CLUBS 2
[DEBUG] RETURNING
[DEBUG] self.DealerCards = 1
[DEBUG] Dealer card created: SPADES QUEEN
[DEBUG] RETURNING
[DEBUG] Created dealer cards[/quote]
Basically if anyone has any idea as to why it may be returning when it shouldn't it'd be greatly appreciated
[QUOTE=skar;37633158]is there a working mysql module for gmod 13?[/QUOTE]
[QUOTE=Drakehawke;37634413][url=http://drakehawke-gmod.googlecode.com/svn/trunk/AndyVincentGMod/RELEASE]MySQLOO[/url] is working, there's a working version of tmysql out there too, I don't have a link for it though sorry.[/QUOTE]
You have to download it using SVN. Make sure when you are placing your files, go into the 'Release_GM13' folder and use the 'gm_tmysql.dll' file that is in there. And not the 'Release' folder because that '.dll' is for Garry's Mod 12.
[URL="http://code.google.com/p/gmodmodules/source/checkout"]
TMYSQL - And other random modules.[/URL]
[URL="http://tortoisesvn.net/downloads.html"]SVN[/URL]
[QUOTE=xomaxhox;37643970] ... Blackjack stuff ... [/QUOTE]
I think you misunderstood the purphose of some keywords: [B]return, break,[/B] and[B] continue[/B].
Let me explain trought some simple examples:
[B]return[/B] - Breaks method execution, returns the suppied value ( if any )
[lua]
for i = 1, 10 do
if ( i == 5 ) then return end
print( i )
end
print( 11 )
[/lua]
.. would not print any numbers above 4, but it will not print '11' either
[B]break[/B] - It breaks the current execution block. Execution blocks are ifs, fors, and whiles. Like:
[lua]
for i = 1, 10 do
if ( i == 5 ) then break end
print( i )
end
print( 11 )
[/lua]
.. would print numbers to 4, and then stop, since the break "broke" the executon loop, and jumped after its end, printing 11
[B]continue -[/B] Only in gmod lua! This keyword skips the execution loop, but does not break it. ( It does not make sense in if blocks ) Therefore:
[lua]
for i = 1, 10 do
if ( i == 5 ) then continue end
print( i )
end
print( 11 )
[/lua]
.. would print all numbers, except 5, and then 11.
In your case, I am pretty sure that you wanted to use the [B]continue[/B] keyword, instead of return, to sum up the players point.
[editline]12th September 2012[/editline]
I had to edit this post about 11 times until I got [lua] tags right ...
[QUOTE=MDave;37644413]I think you misunderstood the purphose of some keywords: [B]return, break,[/B] and[B] continue[/B].
Let me explain trought some simple examples:
[B]return[/B] - Breaks method execution, returns the suppied value ( if any )
[lua]
for i = 1, 10 do
if ( i == 5 ) then return end
print( i )
end
print( 11 )
[/lua]
.. would not print any numbers above 4, but it will not print '11' either
[B]break[/B] - It breaks the current execution block. Execution blocks are ifs, fors, and whiles. Like:
[lua]
for i = 1, 10 do
if ( i == 5 ) then break end
print( i )
end
print( 11 )
[/lua]
.. would print numbers to 4, and then stop, since the break "broke" the executon loop, and jumped after its end, printing 11
[B]continue -[/B] Only in gmod lua! This keyword skips the execution loop, but does not break it. ( It does not make sense in if blocks ) Therefore:
[lua]
for i = 1, 10 do
if ( i == 5 ) then continue end
print( i )
end
print( 11 )
[/lua]
.. would print all numbers, except 5, and then 11.
In your case, I am pretty sure that you wanted to use the [B]continue[/B] keyword, instead of return, to sum up the players point.
[editline]12th September 2012[/editline]
I had to edit this post about 11 times until I got [lua] tags right ...[/QUOTE]
Thanks for the help there, I've always known of break and return and the basics of what they do, but I'd never heard of 'continue' before, so that was very interesting to find
Anyway, I'm pleased to announce that it now works, thanks so much for the help as my lack of knowledge would have prevented me from working it out myself, appreciate your help with this
[quote][DEBUG] ReceiveDeal running...
[DEBUG] 4 cards received
[DEBUG] self.PlayerCards = 1
[DEBUG] Player card created: HEARTS JACK
[DEBUG] self.PlayerTotal = 10
[DEBUG] self.PlayerCards = 2
[DEBUG] Player card created: HEARTS KING
[DEBUG] self.PlayerTotal = 20
[DEBUG] Created player cards
[DEBUG] self.DealerCards = 1
[DEBUG] Dealer card created: DIAMONDS 5
[DEBUG] CONTINUE
[DEBUG] CONTINUE
[DEBUG] self.PlayerTotal = 20
[DEBUG] self.DealerCards = 2
[DEBUG] Dealer card created: CLUBS 3
[DEBUG] CONTINUE
[DEBUG] CONTINUE
[DEBUG] self.PlayerTotal = 20
[DEBUG] Created dealer cards[/quote]
[QUOTE=xomaxhox;37644733]Thanks for the help there, I've always known of break and return and the basics of what they do, but I'd never heard of 'continue' before, so that was very interesting to find
Anyway, I tried changing the 'return' bits to 'continue' in both functions, and it still didn't work, all I got was a slightly strange debug print (strange being that "continue" was printed twice each time):[/QUOTE]
This is the expected behavior, since you want to skip player cards while adding the score of the dealer.
I think the function now works properly, your debug prints are wrong, check the last one. You are printing the players score instead of the dealers score in it.
[lua]
self.DealerTotal = self.DealerTotal + CardValues[v.Value]
end
end
-- There: Isn't it supposed to be "print( "[DEBUG] self.DealerTotal = "..self.DealerTotal )" ?
print( "[DEBUG] self.PlayerTotal = "..self.PlayerTotal )
end
[/lua]
[QUOTE=MDave;37644811]This is the expected behavior, since you want to skip player cards while adding the score of the dealer.
I think the function now works properly, your debug prints are wrong, check the last one. You are printing the players score instead of the dealers score in it.
[lua]
self.DealerTotal = self.DealerTotal + CardValues[v.Value]
end
end
-- There: Isn't it supposed to be "print( "[DEBUG] self.DealerTotal = "..self.DealerTotal )" ?
print( "[DEBUG] self.PlayerTotal = "..self.PlayerTotal )
end
[/lua][/QUOTE]
Sorry I edited my post after realising that it was in fact working. I just noticed that it was printing "CONTINUE" and thought it wasn't working, when in actual fact it was printing that as it looped through the PlayerCards, so when I re-read my post I realised I had read it wronly
Thanks again for the help, and just to clarify again, it is working :v:
[editline]12th September 2012[/editline]
Also you're right about the print being wrong, I didn't notice because I'd never got the function to that stage in the first place though
-snip-
[QUOTE=Divran;37643477][code]function TOOL:LeftClick( trace )
if SERVER and SinglePlayer() then -- If it's single player
umsg.Start( "drawguis_toolfix", self:GetOwner() ) -- Start a new usermessage
umsg.End() -- Send the usermessage
elseif SERVER then return true end -- If it isn't single player, exit this function
drawGuis() -- If it isn't single player, this will run client side
end
usermessage.Hook( "drawguis_toolfix", function( um ) -- Receive the usermessage
drawGuis()
end)[/code][/QUOTE]
Thanks, its running the function fine now without any nils :D
[QUOTE=TNOMCat;37645290]Thanks, its running the function fine now without any nils :D[/QUOTE]
actually it should error, because I just noticed I forgot something. I edited my post with the fix.
I've been trying to learn lua myself and I've ran into a problem I don't understand.
[code]
if SERVER then
AddCSLuaFile( "shared.lua" )
end
if CLIENT then
SWEP.PrintName = "weapon_ttt_ddeagle"
SWEP.Slot = 6 -- add 1 to get the slot number key
SWEP.ViewModelFOV = 72
SWEP.ViewModelFlip = true
end
-- Always derive from weapon_tttbase.
SWEP.Base = "weapon_tttbase"
--- Standard GMod values
SWEP.HoldType = "pistol"
SWEP.Primary.Delay = 15
SWEP.Primary.Recoil = 15
SWEP.Primary.Automatic = false
SWEP.Primary.Damage = 1
SWEP.Primary.Cone = 0.025
SWEP.Primary.Ammo = "smg1"
SWEP.Primary.ClipSize = 1
SWEP.Primary.ClipMax = 1
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Sound = Sound( "Weapon_Deagle.Single" )
SWEP.IronSightsPos = Vector( 6.05, -5, 2.4 )
SWEP.IronSightsAng = Vector( 2.2, -0.1, 0 )
SWEP.ViewModel = "models/weapons/v_pist_deagle.mdl"
SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl"
--- TTT config values
SWEP.Kind = WEAPON_EQUIP2
SWEP.AutoSpawnable = false
SWEP.AmmoEnt = "item_ammo_smg1_ttt"
SWEP.CanBuy = { ROLE_DETECTIVE }
SWEP.InLoadoutFor = nil
SWEP.LimitedStock = true
SWEP.AllowDrop = false
SWEP.IsSilent = false
SWEP.NoSights = false
-- Equipment menu information is only needed on the client
if CLIENT then
-- Path to the icon material
SWEP.Icon = "VGUI/ttt/icon_pistol"
-- Text shown in the equip menu
SWEP.EquipMenuData = {
type = "Detective Deagle",
desc = "Kills Traitors on the first bullet, If you miss, be ready to face the consequences"
};
end
hook.Add("EntityTakeDamage","DDeagle",function(target, weapon, attacker, dmg, dmginfo)
if(weapon:IsWeapon() && weapon:GetClass() == "weapon_ttt_ddeagle" && target:IsPlayer() && attacker:IsPlayer() && ((attacker:GetDetective() && target:GetTraitor()) || (attacker:GetTraitor() && target:GetDetective()))) then
if(ent:GetTraitor()) then
dmginfo:ScaleDamage(5000)
else
dmginfo:ScaleDamage(0)
attacker:Kill()
end
end
end)
if SERVER then
resource.AddFile("materials/VGUI/ttt/icon_pistol.vmt")
end
[/code]
I'm attempting to get this to work, but it seems to just not do it. First, it doesn't appear in the buy menu or even seem to be an entity, yet, all other SWEPs created show up that I do. This one refuses to become an entity, and the code @ the end I'm not 100% it works, but it should.
Can you help?
[QUOTE=FPtje;37643626]Splambob: Normalized Cross product with random vector that isn't in the direction of the normal:
[lua]Normal:Cross(Normal + Vector(Normal.y, Normal.x, 1)):GetNormalized()[/lua]
The vector I'm multiplying with, (Vector(Normal.y, Normal.x, 1)), can never be in the direction of the normal, so the vector you'll get will always be perpendicular to the plane.[/QUOTE]
Thanks for the reply, the part I'm having trouble with is using the up-vector and the forward-vector to generate an Angle. Unless there's a simple method, I think I'm going to use some parts from wiremod's quaternion library.
[QUOTE=PencilOnDesk;37640585]If you're going to help them, help them.[/QUOTE]
Your error fixed:
[lua]
--You missed a >(< under here.
myLabel:SetPos( (ScrW()/2)-DermaPanel:GetWide(),(ScrH()/2)-DermaPanel:GetTall() ) // Position
[/lua]
You're not parenting it to the derma menu.
[lua]
local CategoryList = vgui.Create( "DPanelList", DermaPanel)
--or
CategoryList:SetParent(DermaPanel)
[/lua]
[B]PencilOnDesk are you fucking [I]blind[/I]?[/B]
[QUOTE=PencilOnDesk;37640585] If you're going to undermine/demean them, leave.[/QUOTE]
[B]PencilOnDesk you don't contribute much to this community. Why're you being an asshole?[/B]
[QUOTE=Splambob;37646650]Thanks for the reply, the part I'm having trouble with is using the up-vector and the forward-vector to generate an Angle. Unless there's a simple method, I think I'm going to use some parts from wiremod's quaternion library.[/QUOTE]
do you want the angle between the normal and the vector on the plane? That's always 90.
If you want to turn the plane vector into an angle you can just do
vector:Angle()
The angle will be parallel to the plane.
Sorry, you need to Log In to post a reply to this thread.