Ok, I haven't coded in a long time and I am returning to GMod13. (Which has a tonne of lua changes/updates)
My timer has stopped working.
Here is the timer I have as an example:
[lua] if SERVER then
timer.Simple(1.5, whatlol);
end
end
[/lua]
Here is the error the console now prints:
[html] Timer Failed! [Simple][@gamemodes/darkrp/entities/weapons/lockpick/shared.lua (line 113) [/html]
The SWEP works perfectly, it's just this console command prints every time I click with it.
How would I go about correcting this to work with Garry's new timer format?
Can anyone help me out with this?
Massive thank-you in advance for any info/help.
EDIT:
Ok, I tried this and it still refuses to work.
[lua]if SERVER then
timer.Simple( 1.5, function() whatlol end );
end
end [/lua]
Ideas?
bump?
Try this:
[lua]
if SERVER then
timer.Simple( 1.5, function() whatlol() end );
end
end
[/lua]
I don't know if it works or not. I'm not very experienced with timers.
Try to take a look at this:
[url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit?pli=1[/url]
[QUOTE=ms333;38723406]Try this:
[lua]
if SERVER then
timer.Simple( 1.5, function() whatlol() end );
end
end
[/lua]
I don't know if it works or not. I'm not very experienced with timers.
Try to take a look at this:
[url]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit?pli=1[/url][/QUOTE]
This didn't work unfortunately :c
bump?
What's the whatlol function?
[lua]function SWEP:TryToBatter ( Target )
/*
if Target:GetDoorOwner() == self.Owner then
self.Owner:Notify('You pick open your own doors. Use a key!');
return false;
end
*/
self:EmitSound(self.BatterSound);
local function whatlol ( )
if !self or !self:IsValid() then return false; end
local Randomness = math.random(1, 100);
local SetOffHouseAlarm = true;
if Randomness <= self.BreakSelfChance then
self:EmitSound(self.BreakSound);
self.Owner:Notify('Your lock pick broke!');
self.Owner:RemoveEquipped(EQUIP_SIDE);
elseif Randomness <= self.BreakSelfChance + self.PercentChance then
Target:Fire('unlock', '', 0);
Target:Fire('open', '', .5);
SetOffHouseAlarm = false;
if IsValid(self.Owner) then
self.Owner:GiveExperience
end
end
if SetOffHouseAlarm then
local GroupTable = Target
if (GroupTable) then
local Group = GroupTable.ID;
if GAMEMODE.HouseAlarms[Group] and (!Target:GetTable().LastSirenPlay or Target:GetTable().LastSirenPlay + 30 < CurTime()) and Target:GetDoorOwner() and Target:GetDoorOwner():IsValid() and Target:GetDoorOwner():IsPlayer() then
umsg.Start("perp_house_alarm");
umsg.Entity(Target);
umsg.End();
Target:GetTable().LastSirenPlay = CurTime()
local lifeAlertZone = Target:GetZoneName();
if (lifeAlertZone) then
GAMEMODE:PlayerSay(self:GetDoorOwner(), "/911 [Burglar Alarm] A break in has occured at " .. lifeAlertZone .. ". Police requested.", true, false);
else
Msg("no life alert zone.\n")
end
end
end
end
end
if SERVER then
timer.Simple( 1.5, function() whatlol() end );
end
end[/lua]
Sorry, you need to Log In to post a reply to this thread.