[QUOTE=Lexic;37415832]That won't stop people just typing impulse 101 into console though.
Why do you have sv_cheats set to 1?[/QUOTE]
that's a real good question. did I mention I was up all night?
I use cheats when I'm playing single player, and don't feel like running sv_cheats whenever I want to cheat. I looked up running the console command, and it said that modifying sv_cheats through lua was blocked.
[URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index33a2-2.html"]Heres the wiki on game.consolecommand[/URL], and you can see that sv_cheats is blocked.
But, as I said, I'm real tired. Maybe I'll set it to zero the way it should be. Sure wish I had a dedicated server.
I figure it's best for your gamemode to assume that sv_cheats is always 0.
If the server owner wants to plunge his server into chaos then that's his look out, not yours.
[QUOTE=Lexic;37416496]I figure it's best for your gamemode to assume that sv_cheats is always 0.
If the server owner wants to plunge his server into chaos then that's his look out, not yours.[/QUOTE]
Nah, nobody's gonna play this gamemode but me and my family. I don't think anybody wants to download over a gig of weaponry and stuff. The only reason I'm not making this a source mod on its own is because lua is easier.
Not exactly lua problem, but how do i stop my texture with alpha channel from having white-ish outline?
[url]https://dl.dropbox.com/u/3766002/gm_construct0001.jpg[/url]
PNG and TGA are perfect in photoshop, but whenever i import png directly or use TGA and VTFEdit it has this annoying white outline. Anyone knows what may cause it?
As far as I'm aware, Source and Alpha Blending don't go well together.
Make sure your alpha channel isn't being anti-aliased; keep it at 0 or 255.
... and now I just noticed that when I play multiplayer, sv_cheats is 0. How the fuck did i miss that before today?!
[QUOTE=Lexic;37417417]As far as I'm aware, Source and Alpha Blending don't go well together.
Make sure your alpha channel isn't being anti-aliased; keep it at 0 or 255.[/QUOTE]
Learned new thing today. If i let either gmod13 or VTFEdit resize my texture with alpha, it will look shit and have white outline.
[QUOTE=Drakehawke;37413150]You need to add the folders they're in as include directories.
[editline]26th August 2012[/editline]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexbfe8.html#Setting_up_a_module_project_file_in_Visual_C.2B.2B[/url]
Take a look at that, don't look at the rest of the tutorial though, most of that wont work for GMod 13.[/QUOTE]
Thanks for the help, I've pretty much got it now aside from one error I get.
[code]1>c:\program files (x86)\mymod\public\tier1/bitbuf.h(21): fatal error C1083: Cannot open include file: 'basetypes.h': No such file or directory[/code]
Any idea how to fix this?
First time I'm trying to add a custom font. How the fuck do I set it's size?
[lua]surface.CreateFont( "Transformers Movie", 32, 10, false, true, "Transformers Movie" )[/lua]
[QUOTE=Coffeee;37415293]Can somebody compile tmysql[B]3[/B] for Garry's mod 13?
I'm having a serious problem and all I know is that it started when I began using BlackAwps 'Object Orientated' tmysql.[/QUOTE]
Whats the issue with TMySQL4? Since i've moved to GMod 13, and began to develop there, i've been with TMySQL4. It seems nice and stable, has all the old tmysql functions, and it supports multi connections. Not sure if tmysql3 supports that, but if it does, mhe, then its basically the same as TMySQL4. So i see no reason to not use that instead.
If you need help with TMySQL4, PM me. I can resend the message BlackAwps send to me when he send me the plugin. It explains how connecting, and making a query works.
so, decided to code a custom swep base becouse i wanna try some lua!
the thing is i got no idea where to modify the weapon movement or at least the very basic of it, i.e every player step move the weapon a bit upwards etc etc
if anyone could give me a litttle start or hint i would love it!
[QUOTE=Persious;37419629]First time I'm trying to add a custom font. How the fuck do I set it's size?
[lua]surface.CreateFont( "Transformers Movie", 32, 10, false, true, "Transformers Movie" )[/lua][/QUOTE]
The first number (32) is the size (height in pixels), the second (10) is the weight ('boldness'), but 10 seems really small for weight, the default is 500 or something :s
Those numbers were random, as I've tried a lot of numbers. Do I have to do something to make it reload?
[editline]26th August 2012[/editline]
Figured it out. I'll have to gm_clearfonts all the time?
[QUOTE=Persious;37419849]Those numbers were random, as I've tried a lot of numbers. Do I have to do something to make it reload?[/QUOTE]
In 12 yes, you have to call gm_clearfonts then restart the map.
Okay, one last question. I've got a health bar, and some classes of mine exceed 100 HP. How would I go by keeping the health bar in a specific size, no matter how much HP you've got?
[editline]26th August 2012[/editline]
I suck at math, ikr.
[lua]
local health = LocalPlayer():Health();
if (health > 100) then
health = 100;
end
-- Do size calculations w/ health here
[/lua]
?
[editline]26th August 2012[/editline]
Or do you mean
[lua]
local health = LocalPlayer():Health();
local maxhealth = 120 -- (this number isn't networked, you're going to have to deal with this yourself)
local healthpercent = (health / maxhealth) * 100
-- healthpercent is now a number between 0 and 100
[/lua]
The second one, thank you.
[QUOTE=werewolf0020;37419774]so, decided to code a custom swep base becouse i wanna try some lua!
the thing is i got no idea where to modify the weapon movement or at least the very basic of it, i.e every player step move the weapon a bit upwards etc etc
if anyone could give me a litttle start or hint i would love it![/QUOTE]
repost for new page
I remember either a vmt parameter or a function that would remove the texture filtering, but I can't seem to find it anymore.
For some reason this code isn't working. Any ideas why?
[lua]local bone = CreateClientConVar("bone", "head", true, false)
if not(ady > fov or adp > fov) then
if bone == "head" then
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Head1"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
elseif bone == "neck" then
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Neck1"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
elseif bone == "spine" then
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Spine"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
else
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Head1"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
end
end[/lua]
It always goes to the last else statement.
[QUOTE=boxxyy;37420967]For some reason this code isn't working. Any ideas why?
[lua]local bone = CreateClientConVar("bone", "head", true, false)
if not(ady > fov or adp > fov) then
if bone == "head" then
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Head1"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
elseif bone == "neck" then
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Neck1"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
elseif bone == "spine" then
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Spine"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
else
targetpos,targetang = v:GetBonePosition(v:LookupBone("ValveBiped.Bip01_Head1"))
LocalPlayer():SetEyeAngles((targetpos - LocalPlayer():GetShootPos()):Angle())
end
end[/lua]
It always goes to the last else statement.[/QUOTE]
bone:GetString()
[QUOTE=vexx21322;37421041]bone:GetString()[/QUOTE]
Thanks, I'm an idiot.
[editline]26 August 2012[/editline]
I still need help with [url=http://facepunch.com/showthread.php?t=1160598&p=37418501&viewfull=1#post37418501]this[/url].
I'm a bit confused with this sound.Add command, is it NEEDED to add custom sounds? I've been trying to get a sound to play for me and it just won't work even when it's in the right folder and I was wondering if this is the reason.
starting to get used to swep modfying to swell, decided to code my own base just to learn a bit
got an issue alredy when trying to use swep:getviewmodelposition(); to simulate "iron sights"
i keep getting bad argument *2 To LerpVector (vector expected,got nill); i double chcked my variables to see if it wasnt nill and im just plain confused now
[lua]
function SWEP:GetViewModelPosition(pos, ang)
local FT = FrameTime();
local ApproachRate = 0.5 * FT;
local BlendPos = Vector(0,0,0);
local TargetPos = Vector(0,0,0);
TargetPos = self.WalkCycle; // i declared WalkCycle at the start of the swep as SWEP.WalkCycle = vector(0,0,0);
BlendPos = LerpVector(ApproachRate, BlendPos, TargetPos)
pos = pos + BlendPos; // this is where the error occurs
return pos, ang
end
[/lua]
How would i make bullet hole-making handled clientside, while server would only handle tracing, making dmg, and pushing anything (just standard _R.Player.FireBullets). Currently i have eefy code that isn't shared (since i don't use any model for weapons, only sprites).
Also, how i could make world animation of player doing something? I remember there was some animation API, is it still good to use?
I made my own version of evolve (working with mysql instead of .txt + glon which is extremely slow), and it works fine except that I have a little problem about nick saving.
I do this :
[lua]
function evolve:SetProperty(uniqueid, id, value)
local query = db:query(string.format([[UPDATE evolve SET %s = "%s" WHERE UniqueID = '%s']], id, value, uniqueid))
query:start()
end
-- example :
evolve:SetProperty( Player:UniqueID(), "Nick", Player:Nick() )
[/lua]
Here's my problem : if I have a player with quotations marks on his name (""), I will get an sql error because it will close the quotation marks I opened. Like this if the player name is [i]Kittens"[/i] :
[img]http://uppix.net/c/2/3/e8532050dce5139d183c835fb92d8.jpg[/img]
[code]
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"Kittens"" WHERE UniqueID = '0'' at line 1
[/code]
Any idea? I better not use string.gsub and remove quotation marks because it will break some queries. By the way, I use mysqloo.
You have to escape any user inputted strings before you use them in ANY SQL query, otherwise they could put their own SQL statements in and do whatever they want in your database.
[lua]
function evolve:SetProperty(uniqueid, id, value)
local query = db:query(string.format([[UPDATE evolve SET %s = %s WHERE UniqueID = %s]], sql.SQLStr(id), sql.SQLStr(value), sql.SQLStr(uniqueid)))
query:start()
end[/lua]
[QUOTE=Drakehawke;37426808]You have to escape any user inputted strings before you use them in ANY SQL query, otherwise they could put their own SQL statements in and do whatever they want in your database.
[lua]
function evolve:SetProperty(uniqueid, id, value)
local query = db:query(string.format([[UPDATE evolve SET %s = %s WHERE UniqueID = %s]], sql.SQLStr(id), sql.SQLStr(value), sql.SQLStr(uniqueid)))
query:start()
end[/lua][/QUOTE]
Thanks, I'll do it.
What's the right position to get a DModelPanel's view straight on a model?
Need help with upgrade the moneyprinter:
I want to use a wrench ([URL="http://www.garrysmod.org/downloads/?a=view&id=96000"]wrench[/URL])
I hope every one can help me
[code]-- RRPX Money Printer reworked for DarkRP by philxyz
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.SeizeReward = 950
local PrintMore
function ENT:Initialize()
self:SetModel("models/props_c17/consolebox01a.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
phys:Wake()
self.sparking = false
self.damage = 100
self.IsMoneyPrinter = true
timer.Simple(math.random(100, 350), PrintMore, self)
end
function ENT:OnTakeDamage(dmg)
if self.burningup then return end
self.damage = (self.damage or 100) - dmg:GetDamage()
if self.damage <= 0 then
local rnd = math.random(1, 10)
if rnd < 3 then
self:BurstIntoFlames()
else
self:Destruct()
self:Remove()
end
end
end
function ENT:Destruct()
local vPoint = self:GetPos()
local effectdata = EffectData()
effectdata:SetStart(vPoint)
effectdata:SetOrigin(vPoint)
effectdata:SetScale(1)
util.Effect("Explosion", effectdata)
GAMEMODE:Notify(self.dt.owning_ent, 1, 4, "Your money printer has exploded!")
end
function ENT:BurstIntoFlames()
GAMEMODE:Notify(self.dt.owning_ent, 0, 4, "Your money printer is overheating!")
self.burningup = true
local burntime = math.random(8, 18)
self:Ignite(burntime, 0)
timer.Simple(burntime, self.Fireball, self)
end
function ENT:Fireball()
if not self:IsOnFire() then self.burningup = false return end
local dist = math.random(20, 280) -- Explosion radius
self:Destruct()
for k, v in pairs(ents.FindInSphere(self:GetPos(), dist)) do
if not v:IsPlayer() and not v.IsMoneyPrinter then v:Ignite(math.random(5, 22), 0) end
end
self:Remove()
end
PrintMore = function(ent)
if ValidEntity(ent) then
ent.sparking = true
timer.Simple(3, ent.CreateMoneybag, ent)
end
end
function ENT:CreateMoneybag()
if not ValidEntity(self) then return end
if self:IsOnFire() then return end
local MoneyPos = self:GetPos()
if math.random(1, 22) == 3 then self:BurstIntoFlames() end
local amount = GetConVarNumber("mprintamount")
if amount == 0 then
amount = 250
end
DarkRPCreateMoneyBag(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15), amount)
self.sparking = false
timer.Simple(math.random(100, 350), PrintMore, self)
end
function ENT:Think()
if not self.sparking then return end
local effectdata = EffectData()
effectdata:SetOrigin(self:GetPos())
effectdata:SetMagnitude(1)
effectdata:SetScale(1)
effectdata:SetRadius(2)
util.Effect("Sparks", effectdata)
end
[/code]
Sorry, you need to Log In to post a reply to this thread.