Apparantly this is calling timer.simple wrong?
[code]
timer.Simple( .1, SendGlobalData );
[/code]
SendGlobalData is a local function.
[img]https://dl.dropbox.com/u/17839069/C_017.png[/img]
Maybe someone has a clue as to how I can remove these shitty env_cube reflections...
I'd like to keep the env_cube reflections for the whole map, just excluding this specific entity.
I've tried setting mat_specular to 0, however no luck.
Anyone know why this doesn't work? The box works, but it doesn't list the users and then i get lua errors and kicks me around the local IsVIP = "No" part.
This is the error i get. but if im superadmin i dont get any errors but it still doesnt list any users in the box.
[PHP][ERROR] lua/autorun/client/test.lua:42: attempt to call method 'IsVIP' (a nil value)
[/PHP]
[PHP]local VIP_ENABLED = true
local DONATE_URL = "URL"
function ulx.vip( calling_ply )
if not VIP_ENABLED then return calling_ply:PrintMessage( HUD_PRINTTALK, "Buying VIP is currently disabled... check back another time." ) end
umsg.Start( "VIPDonate", calling_ply ) umsg.End()
end
local vip = ulx.command( "Utility", "ulx vip", ulx.vip, "!vip" )
vip:defaultAccess( ULib.ACCESS_ALL )
vip:help( "Opens the donation menu" )
usermessage.Hook( "VIPDonate", function( um )
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 300, 225 )
DermaPanel:Center()
DermaPanel:SetTitle( "VIP Donation Menu" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local DermaListView = vgui.Create("DListView")
DermaListView:SetParent( DermaPanel )
DermaListView:SetPos( 25, 50 )
DermaListView:SetSize( 250, 150 )
DermaListView:SetMultiSelect( false )
local Nick = DermaListView:AddColumn( "Name" )
Nick:SetMinWidth( 128 )
Nick:SetMinWidth( 128 )
DermaListView:AddColumn( "Is VIP" )
DermaListView:AddColumn( "Friend" )
for _, v in pairs( player.GetAll() ) do
if v:CheckGroup( "moderator" ) or v:IsAdmin() then continue end -- moderator and up get VIP default.
local IsVIP = "No"
if v:IsVIP() then IsVIP = "Yes" end
local IsFriend = "No"
if v:GetFriendStatus() == "friend" then IsFriend = "Yes" end
local Line = DermaListView:AddLine( v:Nick(), IsVIP, IsFriend )
Line.IsVIP = v:IsVIP()
Line.SteamID = v:SteamID()
end
local function DonateFor( SteamID )
if not SteamID or SteamID == "NULL" then return end
gui.OpenURL( DONATE_URL .. "&custom=" .. SteamID )
LocalPlayer():PrintMessage( HUD_PRINTTALK, "When you donate, it takes around 1-2 minutes for it to process your donation to add you to VIP, once done it'll notice you in chatbox." )
LocalPlayer():PrintMessage( HUD_PRINTTALK, "You won't see a notification when you extend your VIP time, you can re-open this menu to check if your VIP expire date has changed." )
DermaPanel:Close()
end
local function OpenMenu( Info, Line )
local Panel = Info:GetLine( Line )
if Panel then
local Nick = Panel:GetValue( 1 )
local IsVIP = Panel.IsVIP
local SteamID = Panel.SteamID
local Popup = DermaMenu()
if IsVIP then
if SteamID == LocalPlayer():SteamID() then
Popup:AddOption( "Extend your VIP by two months", function() DonateFor( SteamID ) end )
else
Popup:AddOption( "Extend " .. Nick .. "'s VIP by two months", function() DonateFor( SteamID ) end )
end
else
if SteamID == LocalPlayer():SteamID() then
Popup:AddOption( "Buy VIP for yourself", function() DonateFor( SteamID ) end )
else
Popup:AddOption( "Buy VIP for " .. Nick, function() DonateFor( SteamID ) end )
end
end
Popup:Open()
end
end
DermaListView.OnRowSelected = OpenMenu
DermaListView.OnRowRightClick = OpenMenu
end )
[/PHP]
I've been tearing my hair out for the past few days and have no idea how I can fix keypads, I really need help here, what can I do?
[lua]
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
Keypad = {}
Keypad.Passwords = {}
Keypad.CurrentNum = {}
util.PrecacheSound("buttons/button14.wav")
util.PrecacheSound("buttons/button9.wav")
util.PrecacheSound("buttons/button11.wav")
util.PrecacheSound("buttons/button15.wav")
function ENT:Initialize()
self.Entity:SetModel( "models/props_lab/keypad.mdl" )
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:OnRemove()
local Index = self.Entity:EntIndex()
for k,v in pairs(Keypad.Passwords) do
if (Index == v.Ent) then
table.remove(Keypad.Passwords, k)
end
end
end
function ENT:OnRestore()
table.insert(Keypad.Passwords, {Ent = self.Entity:EntIndex(), Pass = self.Entity.Pass})
end
function ENT:AddPassword(Pass)
self:OnRemove()
Pass = util.CRC(Pass)
self.Entity.Pass = Pass
table.insert(Keypad.Passwords, {Ent = self.Entity:EntIndex(), Pass = Pass})
end
local function CorrectPassword(Ent, Pass)
Ent = tonumber(Ent)
Pass = util.CRC(tonumber(Pass) or 0)
for k,v in pairs(Keypad.Passwords) do
if (Ent == v.Ent) then
if (Pass == v.Pass) then
return true
end
end
end
return false
end
local function RunKeypad(Repeats, Length, Delay, Key, Owner)
for i = 0, Repeats do
timer.Simple(Length*(i)+Delay*i, function () Owner:ConCommand("+gm_special "..Key.."\n") end)
timer.Simple(Length*(i+1)+Delay*i, function () Owner:ConCommand("-gm_special "..Key.."\n") end)
end
end
local function KeypadCommand(Ply, Command, Args)
if (Args == nil) then return end
local Ent = ents.GetByIndex(Args[1])
local Show = Ent:GetNetworkedBool("keypad_showaccess")
local Secure = Ent:GetNetworkedBool("keypad_secure")
if (Show) then return end
if ((Ply:GetShootPos() - Ent:GetPos()):Length() > 50) then return end
if (Args[2] == "reset") then
Ent:SetNetworkedInt("keypad_num", 0)
Ent:EmitSound("buttons/button14.wav")
Keypad.CurrentNum[Args[1]] = nil
elseif (Args[2] == "accept") then
local Num = Ent:GetNetworkedInt("keypad_num")
local Owner = Ent:GetNetworkedEntity("keypad_owner")
local Simple = Ent:GetNetworkedBool("keypad_simple")
local Key
local Length
local Delay
local InitDelay
local Repeats
if (CorrectPassword(Args[1], Keypad.CurrentNum[Args[1]])) then
Key = Ent:GetNetworkedInt("keypad_keygroup1")
Length = Ent:GetNetworkedInt("keypad_length1")
Delay = Ent:GetNetworkedInt("keypad_delay1")
InitDelay = Ent:GetNetworkedInt("keypad_initdelay1")
Repeats = Ent:GetNetworkedInt("keypad_repeats1")
Ent:SetNetworkedBool("keypad_access", true)
Ent:EmitSound("buttons/button9.wav")
else
Key = Ent:GetNetworkedInt("keypad_keygroup2")
Length = Ent:GetNetworkedInt("keypad_length2")
Delay = Ent:GetNetworkedInt("keypad_delay2")
InitDelay = Ent:GetNetworkedInt("keypad_initdelay2")
Repeats = Ent:GetNetworkedInt("keypad_repeats2")
Ent:SetNetworkedBool("keypad_access", false)
Ent:EmitSound("buttons/button11.wav")
end
if (Key != nil) and (Key != -1) then
if (Simple) then
Owner:ConCommand("+gm_special "..Key.."\n")
timer.Simple(Length, function() Owner:ConCommand("-gm_special "..Key.."\n") end)
else
if (InitDelay != 0) then
timer.Simple(InitDelay, function() RunKeypad(Repeats, Length, Delay, Key, Owner) end)
else
RunKeypad(Repeats, Length, Delay, Key, Owner)
end
end
end
Ent:SetNetworkedBool("keypad_showaccess", true)
timer.Simple(2,
function()
if (IsValid(Ent)) then
Ent:SetNetworkedInt("keypad_num", 0)
Ent:SetNetworkedBool("keypad_showaccess", false)
end
Keypad.CurrentNum[Args[1]] = nil
end)
else
-- local Num = Ent:GetNetworkedInt("keypad_num")*10 + Args[2]
Keypad.CurrentNum[Args[1]] = Keypad.CurrentNum[Args[1]] or 0
local Num = Keypad.CurrentNum[Args[1]] *10 + Args[2]
if (Num < 10000) then
Keypad.CurrentNum[Args[1]] = Num
print(Secure)
if (Secure) then
Ent:SetNetworkedInt("keypad_num", 10 ^ (string.len(Num)-1))
else
Ent:SetNetworkedInt("keypad_num", Num)
end
Ent:EmitSound("buttons/button15.wav")
end
end
end
concommand.Add("gmod_keypad", KeypadCommand)
[/lua]
[QUOTE=craigy09;38215370]Anyone know why this doesn't work? The box works, but it doesn't list the users and then i get lua errors and kicks me around the local IsVIP = "No" part.
[/QUOTE]
What about giving us those Lua errors ? Would be useful.
EDIT:
Same thing for you, Crossu88 :3
[QUOTE=MrManiak;38215448]What about giving us those Lua errors ? Would be useful.
EDIT:
Same thing for you, Crossu88 :3[/QUOTE]
Updated my post :p
[QUOTE=MrManiak;38215448]What about giving us those Lua errors ? Would be useful.
EDIT:
Same thing for you, Crossu88 :3[/QUOTE]
Thats the problem, there IS no lua errors, the problem lies in how the keypad used to use +gm_special for button simulation.
[QUOTE=craigy09;38215549]Updated my post :p[/QUOTE]
Looks like there has been another script error in another file (the Lua file that contains the :IsVIP function) before this happens. Are there Lua errors when you launch the server ?
EDIT:
Don't forget that the error is server-sided.
[QUOTE=MrManiak;38215747]Looks like there has been another script error in another file (the Lua file that contains the :IsVIP function) before this happens. Are there Lua errors when you launch the server ?
EDIT:
Don't forget that the error is server-sided.[/QUOTE]
I checked with the keypad tool and there is NO, yes ABSOLUTELY NONE. No errors, help me out here man.
I need a way to push a global clip plane to render.RenderView, pushing it before calling it creates weirdness in the skybox and doesnt clip the world
Is there any boolean/function to disable the context menu aiming? It's a pretty big advantage for players to shoot behind their backs without the need to turn around and all.
Wondering how to return the time in seconds since midnight.
Tried things such as os.time, RealTime, CurTime, os.date, and they didnt help.
Can someone tell me if I'm doing this wrong?
This model (magnusson) used to work in Garry's Mod 12, but now its pink and black.
[img]http://i1218.photobucket.com/albums/dd413/josh980/mag.png[/img]
I'm using this model path: [code]"models/player/magnusson.mdl"[/code]
Does anyone know how/if I can fix this?
Are you sure everything is mounted properly?
[editline]Edited:[/editline]
Actually that's a pretty dumb question. Never mind.
[QUOTE=kp3;38218008]Are you sure everything is mounted properly?[/QUOTE]
I'm pretty sure everything is mounted. The model is in my garrysmod.gcf file. Could the model be broken? (I'm not good with models/textures)
[QUOTE=josh980;38218047]I'm pretty sure everything is mounted. The model is in my garrysmod.gcf file. Could the model be broken? (I'm not good with models/textures)[/QUOTE]
If you can spawn any EP2 stuff you should be able to see the model fine.
Otherwise it's included in the game and the texture is broken.
I can't check for you right now
I'm getting an error in console saying: "Attempt to index global _R. (a nil value)" This is for the Perfected Climb SWEP. Here's the lua:
[CODE]function _R.Player:SpinTo( deg, time, locktime )
self.__spin_deg = deg
self.__spin_time = time
self.__spin = true
self.__pitch = self:GetAngles( ).p
self.CLHasDoneARoll = true
timer.Simple(locktime or time, function()
self.CLHasDoneARoll = false
end)
end
local function umSpinTo( um )
local a, b
a = um:ReadFloat( )
b = um:ReadFloat( )
LocalPlayer():SpinTo( a, b)
end
usermessage.Hook( "Spin To", umSpinTo )
local function umBackFlip( um )
local a, b, c
a = um:ReadFloat( )
b = um:ReadFloat( )
c = um:ReadFloat( )
LocalPlayer():SpinTo( a, b, c )
end
usermessage.Hook( "BackFlip", umBackFlip )
local function UMSGSwitchSound( um )
surface.PlaySound("ambient/siren.wav")
end
usermessage.Hook( "Switch Sound", UMSGSwitchSound )
local function CalcView( pl, pos, ang, fov )
local view
if not pl.__spin then
return
end
view = GAMEMODE:CalcView( pl, pos, ang, fov )
pl.__pitch = math.Approach( pl.__pitch, pl.__spin_deg, FrameTime( ) * pl.__spin_time * pl.__spin_deg )
if pl.__pitch == pl.__spin_deg then
pl.__spin = false
end
view.angles.p = pl.__pitch
return view
end
hook.Add( "CalcView", "Spin View.CalcView", CalcView )
function RollViewReset(UCMD)
if LocalPlayer().CLHasDoneARoll == true then
local ang=UCMD:GetViewAngles()
ang.p = 0
UCMD:SetViewAngles(ang)
end
end
hook.Add("CreateMove", "RollCalcViewSet", RollViewReset)[/CODE]
[QUOTE=Fidchell;38218146]I'm getting an error in console saying: "Attempt to index global _R. (a nil value)" This is for the Perfected Climb SWEP. Here's the lua:
[code]
[/QUOTE]
_R.Player was removed (I think). You'll have to use FindMetaTable
[lua]
local Meta = FindMetaTable( "Player" );
function Meta:SpinTo( deg, time, locktime )
// stuff
end;
[/lua]
[url]http://wiki.garrysmod.com/page/Global/FindMetaTable[/url]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe738.html[/url]
[QUOTE=josh980;38218178]_R.Player was removed (I think). You'll have to use FindMetaTable
local Meta = FindMetaTable( "Player" );function Meta:SpinTo( deg, time, locktime ) // stuffend;
[URL]http://wiki.garrysmod.com/page/Global/FindMetaTable[/URL]
[URL]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexe738.html[/URL][/QUOTE]
Thanks a bunch for the quick reply! I was able to get rid of the error messages, but unfortunately the "roll" function of this addon still doesn't work, meaning the view angles don't change in a way in which it appears you're...well..rolling.
Here's the lua holding that function:
[CODE]umsg.PoolString("Spin To")AddCSLuaFile("autorun/client/roll2.lua")
CreateConVar( "grip_forcelevel", 0, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
CreateConVar( "cswep_snapsallowed", 1, { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
ScriptType = 2
concommand.Add("cswep_switchscript", function(ply)
if not ply:IsAdmin() then
ply:ChatPrint("Admin-Only.")
return
end
if ScriptType == 1 then
ScriptType = 2
hook.Remove("GetFallDamage", "CSWEP_DynamicFallDamage")
hook.Remove("PlayerDeath", "CSWEP_WeDie")
hook.Remove("Tick", "CSWEP_ConstantMovingWhileRolling")
hook.Remove("EntityTakeDamage", "CSWEP_DoARoll")
hook.Remove("OnPlayerHitGround", "CSWEP_WeLand")
hook.Remove("PlayerSpawn", "CSWEP_RollPlayerSpawn")
hook.Add("PlayerSpawn", "RollPlayerSpawn2", RollPlayerSpawn2)
hook.Add("OnPlayerHitGround", "PlayerLandsRoll2", PlayerLandsRoll2)
hook.Add("EntityTakeDamage", "DoARoll2", DoARoll2)
hook.Add("Think","RollThink2", RollThink2)
hook.Add("GetFallDamage","DynamicFallDamage2", DynamicFallDamage2)
for k, v in pairs (player.GetAll()) do
v:ChatPrint("ATTENTION! SCRIPT TYPE HAS BEEN CHANGED TO 2! SWITCH OVER TO ZOEY'S CLIMB SWEP OR OTHERWISE YOU WILL GET LOTS OF ERRORS!")
v:SendLua( string.format( "GAMEMODE:AddNotify( %q, %s, %d )", "ATTENTION! SCRIPT TYPE HAS BEEN CHANGED TO 2! SWITCH OVER TO ZOEY'S CLIMB SWEP OR OTHERWISE YOU WILL GET LOTS OF ERRORS!", "NOTIFY_GENERIC", 5 ) )
end
elseif ScriptType == 2 then
ScriptType = 1
hook.Remove("PlayerSpawn", "RollPlayerSpawn2")
hook.Remove("OnPlayerHitGround", "PlayerLandsRoll2")
hook.Remove("EntityTakeDamage", "DoARoll2")
hook.Remove("Think","RollThink2")
hook.Remove("GetFallDamage","DynamicFallDamage2")
hook.Add("GetFallDamage", "CSWEP_DynamicFallDamage", CSWEP_DynamicFallDamage)
hook.Add("PlayerSpawn", "CSWEP_RollPlayerSpawn", CSWEP_RollPlayerSpawn)
hook.Add("PlayerDeath", "CSWEP_WeDie", CSWEP_WeDie)
hook.Add("Tick", "CSWEP_ConstantMovingWhileRolling", CSWEP_ConstantMovingWhileRolling)
hook.Add("EntityTakeDamage", "CSWEP_DoARoll", CSWEP_DoARoll)
hook.Add("OnPlayerHitGround", "CSWEP_WeLand", CSWEP_WeLand)
for k, v in pairs (player.GetAll()) do
v:ChatPrint("ATTENTION! SCRIPT TYPE HAS BEEN CHANGED TO 1! SWITCH OVER TO SPY'S CLIMB SWEP OR OTHERWISE YOU WILL GET LOTS OF ERRORS!")
v:SendLua( string.format( "GAMEMODE:AddNotify( %q, %s, %d )", "ATTENTION! SCRIPT TYPE HAS BEEN CHANGED TO 1! SWITCH OVER TO SPY'S CLIMB SWEP OR OTHERWISE YOU WILL GET LOTS OF ERRORS!", "NOTIFY_GENERIC", 5 ) )
end
end
end)
function RollPlayerSpawn2(ply)
ply.HasDoneARoll = false
ply.Sounded = false
end
hook.Add("PlayerSpawn", "RollPlayerSpawn2", RollPlayerSpawn2)
local GlobalGrabSound = {
Sound("physics/flesh/flesh_impact_hard3.wav"),
Sound("physics/flesh/flesh_impact_hard4.wav"),
Sound("physics/flesh/flesh_impact_hard6.wav"),
Sound("physics/cardboard/cardboard_box_break3.wav") }
function PlayerLandsRoll2(ply)
if ply:GetVelocity().z <= -400 and ply:GetVelocity().z >= -674 then
ply:SetViewOffsetDucked(Vector(0,0,30))
ply:SetDuckSpeed(0.2)
timer.Simple(0.45, function()
ply:SetDuckSpeed(0.3)
end)
ply:SetUnDuckSpeed(0.3)
ply:ViewPunch(Angle(27,0,13.5))
if not ply:KeyDown(IN_DUCK) then
ply:ConCommand("+duck")
timer.Simple(0.45, function()
ply:SetDuckSpeed(0.3)
ply:ConCommand("-duck")
timer.Simple(0.55, function()
ply:SetViewOffsetDucked(Vector(0,0,35))
ply:SetUnDuckSpeed(0.37)
ply:SetDuckSpeed(0.3)
end)
end)
end
end
if ply:EyeAngles().p >= 25 then
if (ply:KeyDown(IN_RELOAD) or ply:KeyDown(IN_DUCK)) and ply:GetVelocity().z <= -400 and ply:GetVelocity().z >= -800 then
ply.HasDoneARoll = true
ply:EmitSound(GlobalGrabSound[math.random(#GlobalGrabSound)], 75, math.random(82, 90))
ply.Rolling = CurTime() + 0.9
if ply:GetActiveWeapon():IsValid() and ply:IsValid() then
ply:GetViewModel():SetNoDraw(true)
ply:GetActiveWeapon():SetNextPrimaryFire(CurTime() + 0.8)
ply:GetActiveWeapon():SetNextSecondaryFire(CurTime() + 0.8)
ply:GetActiveWeapon().Reloadaftershoot = CurTime() + 0.8
timer.Simple(0.6, function()
if ply:GetActiveWeapon():IsValid() and ply:IsValid() then
ply:GetViewModel():SetNoDraw(false)
ply:GetActiveWeapon():SendWeaponAnim(ACT_VM_PRIMARYATTACK)
timer.Simple(0.01, function()
ply:GetActiveWeapon():SendWeaponAnim(ACT_VM_DRAW)
end)
ply:GetActiveWeapon():SetNextPrimaryFire(CurTime() + ply:GetActiveWeapon():SequenceDuration())
ply:GetActiveWeapon():SetNextSecondaryFire(CurTime() + ply:GetActiveWeapon():SequenceDuration())
ply:GetActiveWeapon().Reloadaftershoot = CurTime() + ply:GetActiveWeapon():SequenceDuration()
end
end)
end
timer.Simple(0.2, function()
if ply:IsValid() then
ply.HasDoneARoll = false
end
end)
end
end
end
hook.Add("OnPlayerHitGround", "PlayerLandsRoll2", PlayerLandsRoll2)
function DoARoll2(ent, dmginfo)
if ent:IsPlayer() then
if ent.HasDoneARoll == true then
if (ent:Health() - (dmginfo:GetDamage() * 0.35)) > 0 then
if dmginfo:IsFallDamage() then
dmginfo:ScaleDamage(0.5)
timer.Simple(0.2, function()
if ent:IsValid() then
ent.HasDoneARoll = false
end
end)
elseif ent:GetVelocity().z <= -800 then
return
end
end
end
end
end
hook.Add("EntityTakeDamage", "DoARoll2", DoARoll2)
function RollThink2()
for k,v in pairs (player.GetAll()) do
if v.Rolling and CurTime() >= v.Rolling then
v.Rolling = nil
v:SetNWInt("RollingP",0)
end
if v.Rolling and CurTime() < v.Rolling then
v:SetLocalVelocity(v:GetForward()*132)
end
end
end
hook.Add("Think","RollThink2",RollThink2)
function DynamicFallDamage2( ply, speed )
speed = speed - 360
return speed * (100/(1024-580))
end
hook.Add("GetFallDamage", "DynamicFallDamage2", DynamicFallDamage2)[/CODE]
Wish I could figure this out on my own but I'm not a coder and I can't find anything on it.
Also, an unrelated question: Is there a way to keep sv_cheats 1 on?? It may have been covered before, but there's no way I can keep my bullet time working without that on.
I'm having a problem with tmysql.
[img]http://gyazo.com/f12df781a7cc6bd16d4c8ac15b6bfa29.png?1351413101[/img]
[code]local function sendOnline ( )
if (GAMEMODE.ServerIdentifier == 0) then return end
tsql:Query("UPDATE `perp_system` SET `value`='" .. os.time() .. "' WHERE `key`='online_" .. GAMEMODE.ServerIdentifier .. "' LIMIT 1");
end
timer.Create("sendOnline", 10, 0, sendOnline);[/code]
[code]function UpdateBT ()
tsql:Query("SELECT `unban_time`, `steamid` FROM `server_bans`", function ( unbantime )
if unbantime[1] and unbantime[1][1] then
for k, v in pairs(unbantime) do
local numUnbanTime = tonumber(v[1])
local newTime = numUnbanTime - os.time()
newTime = newTime / 60;
tsql:Query("UPDATE `server_bans` SET `unban_time_fixed`='" .. FixedTime(newTime) .. "' WHERE `steamid`='" .. v[2] .. "'");
end
end
end)
end
timer.Create("UpdateBT", 20, 0, UpdateBT)[/code]
[QUOTE=PaellaPablo;38217780]Wondering how to return the time in seconds since midnight.
Tried things such as os.time, RealTime, CurTime, os.date, and they didnt help.[/QUOTE]
[lua](os.date("%H")*3600) + (os.date("%M")*60) + os.date("%S")[/lua]
file.Read("basics.txt","DATA")
Is this line wrong?
I put my file to ..\content\data\basics.txt
I am trying to convert a Gamemode, but it looks like that not all client files, espacially shared files are sent. Did Garry changed something in this direction?
And is there a command or a way to see on the client which files were sent?
It's reading from the "data" path. type "path" in the console to see what paths are under the data path (it's only /data/ - not blahblah/content/data/)
[editline]28th October 2012[/editline]
[QUOTE=Sapd;38219293]I am trying to convert a Gamemode, but it looks like that not all client files, espacially shared files are sent. Did Garry changed something in this direction?
And is there a command or a way to see on the client which files were sent?[/QUOTE]
Which files in particular? Did you add AddCSLuaFile() at the top of them?
-snip-
[QUOTE=garry;38219298]It's reading from the "data" path. type "path" in the console to see what paths are under the data path (it's only /data/ - not blahblah/content/data/)
[editline]28th October 2012[/editline]
Thank you i figured it out with this command :)
Which files in particular? Did you add AddCSLuaFile() at the top of them?[/QUOTE]
@garry I think i found the error.
I used this in my sh_init to include files:
[Code]
local t_Files, t_Directories = file.Find("gamemodes/sapd/gamemode/shs/*.lua", "GAME" )
for _, t_File in pairs( t_Files ) do
include("shs/" .. t_File);
end
[/code]
The funny thing is, that this works on the Server... but not the client, that's the reason why it was so hard to find.
But I'm not quite sure how to rewrite it. I guess i must use the "LUA" path, but i tried it then with sapd/gamemode/shs/*.lua and shs/*.lua both didn't find files.
Edit: Nevermind, i used now file.Find("sapd/gamemode/shs/*.lua", "LUA" ) this does work, maybe someone should place a hint in the wiki regarding "GAME" path on client.
[QUOTE=Jayden;38218470]I'm having a problem with tmysql.
[img]http://gyazo.com/f12df781a7cc6bd16d4c8ac15b6bfa29.png?1351413101[/img]
[code]local function sendOnline ( )
if (GAMEMODE.ServerIdentifier == 0) then return end
tsql:Query("UPDATE `perp_system` SET `value`='" .. os.time() .. "' WHERE `key`='online_" .. GAMEMODE.ServerIdentifier .. "' LIMIT 1");
end
timer.Create("sendOnline", 10, 0, sendOnline);[/code]
[code]function UpdateBT ()
tsql:Query("SELECT `unban_time`, `steamid` FROM `server_bans`", function ( unbantime )
if unbantime[1] and unbantime[1][1] then
for k, v in pairs(unbantime) do
local numUnbanTime = tonumber(v[1])
local newTime = numUnbanTime - os.time()
newTime = newTime / 60;
tsql:Query("UPDATE `server_bans` SET `unban_time_fixed`='" .. FixedTime(newTime) .. "' WHERE `steamid`='" .. v[2] .. "'");
end
end
end)
end
timer.Create("UpdateBT", 20, 0, UpdateBT)[/code][/QUOTE]
pitty you removed me :)
its tmysql.query not tsql:Query
unless he's using tmysql4
Another question, I want that my users download my content. So i use resource.AddFile( "materials/example.vtf" ) etc. in init.lua.
But it doesn't work, and everything is properly set up. (it worked in gm12)
I also tryed to change the path to gamemode/sapd/content/materials/example.vtf but it also doesn't work.
Does someone know how to fix this?
And is it allowed to upload the content for a Server on Steam workshop?
Sorry, you need to Log In to post a reply to this thread.