It looks good, WTF I did wrong? Tried to recode Laser from Huntsmod for Gmod 11:
Original code:
[lua]TOOL.ClientConVar[ "r" ] = "255"
TOOL.ClientConVar[ "g" ] = "255"
TOOL.ClientConVar[ "b" ] = "255"
TOOL.ClientConVar[ "a" ] = "255"
TOOL.ClientConVar[ "dmg" ] = "100"
TOOL.ClientConVar[ "width" ] = "3"
function TOOL:LeftClick( trace )
if trace.Entity && trace.Entity:IsPlayer() then return false end
if (CLIENT) then return true end
if ( !self:GetSWEP():CheckLimit( "effects" ) ) then return false end
if self.LastPos ~= nil then
SpawnLaser(self.LastPos, trace.HitPos, self)
self.LastPos = nil
else
self.LastPos = trace.HitPos
end
return true
end
function TOOL:RightClick( trace )
return self:LeftClick( trace )
end
function SpawnLaser ( pos1, pos2, self )
local BasePoint = ents.Create("info_target")
BasePoint:SetPos(pos1)
BasePoint:SetKeyValue("targetname", "HMod_Bases_" .. BasePoint)
BasePoint:Spawn()
local Laser = ents.Create("env_laser")
Laser:SetPos(pos2)
Laser:SetKeyValue("rendercolor", self:GetClientInfo( "r" ) .. " " .. self:GetClientInfo( "g" ) .. " " .. self:GetClientInfo( "b" ))
Laser:SetKeyValue("renderamt", self:GetClientInfo( "a" ))
Laser:SetKeyValue("TextureScroll", "35")
Laser:SetKeyValue("targetname", "HMod_Laser_" .. Laser)
Laser:SetKeyValue("parentname", "")
Laser:SetKeyValue("damage", self:GetClientInfo( "dmg" ))
Laser:SetKeyValue("texture", "sprites/laserbeam.spr")
Laser:SetKeyValue("spawnflags", "1")
Laser:SetKeyValue("width", self:GetClientInfo( "width" ))
Laser:SetKeyValue("dissolvetype", "None")
Laser:SetKeyValue("EndSprite", "")
Laser:SetKeyValue("LaserTarget", "HMod_Bases_" .. BasePoint)
Laser:SetKeyValue("TouchType", "0")
Laser:Spawn()
undo.Create("Laser")
undo.AddEntity(Laser)
undo.AddEntity(BasePoint)
undo.SetPlayer(self:GetOwner())
undo.Finish()
self:GetOwner():AddCount("effects", Laser)
end [/lua]
Have a look at the language.Add section of your code. :smile:
edit: Oh nevermind it's the other way around. :(
I still lol'd how you stole the code and added rav to it.
[QUOTE=iRzilla;17846532]How about we put it in the right directory?[/QUOTE]
lolwut? Is it correct location?: \lua\weapons\gmod_tool\stools
And for this stealing, no one adaptated Laser from HMod to gmod11 (at least I wasn't found it :P) and tried to remake it using adv spawner and madjawa's laser stool as templates, but both have some different code even for naming. Maybe this is problem. If it's done, I will reupload, give 80% of credits to Huntskikbut, 10% to me and 10% to problemsolver. Maybe someone will use this laser like in DJY1991 Idiots from gmod. I wasn't saw these cool vechicles remake too... but it's too hard for me, cuz this laser is my first lua project. So please help meh, check code, not location, I think I'm not noob which can't paste addons in addons and script in lua folder (but who knows)
[QUOTE=Diaklu;17856867][url]http://lua.madjawa.net/LaserSTOOL2Fix.zip[/url][/QUOTE]
Omg, who other will give me link to madjawa's laser/patch?! READ THE CODE FIRST. Hunts laser not acts like madjawa's, REMEMBER!!!
Nobody can help me???
Line 47:
[lua]if ( not ply:CheckLimit( "ravlasers" ) ) then return false; [/lua]
There is a missing "end". So it shoud look like
[lua]if ( not ply:CheckLimit( "ravlasers" ) ) then return false end;[/lua]
[editline]09:50PM[/editline]
[QUOTE=Diaklu;17856867][url]http://lua.madjawa.net/LaserSTOOL2Fix.zip[/url][/QUOTE]
lol what?
Thank you too much. One helpful master, second was Sakarias88 ;). About, "why didn't you look at the console....", um, mine wasn't shown anything about it ;((.
[QUOTE=RavMahov;18047872]Thank you too much. One helpful master, second was Sakarias88 ;). About, "why didn't you look at the console....", um, mine wasn't shown anything about it ;((.[/QUOTE]
Unless you're testing on a dedicated server it should. Maybe the error was way up in the console ( when all entities are spawning) and that's why you were missing it.
Maybe, maybe...
Thread can be closed, I think...
Or it can stay there in case someone has a similar problem and uses the search function. :smile:
Sorry, you need to Log In to post a reply to this thread.