• Could not include ....
    13 replies, posted
i have a money system, and everything was working fine before, but now everytime i join my server it says "Could not include moneysystem.lua(file not found)" the file is in (gamemode)/gamemode/ <-- here with init.lua(and such) it WAS working properly, i edited the money system then i get this error, i do update the cache, so that is not the problem ( i think ) [editline]12:35AM[/editline] help me please !!
in gamemode/gamemode/init.lua is that where your including from? Updating the cache wont be a problem unless its serverside either i believe, also check if anything else in your gamemode is erroring.
nothing else in my gamemode is having an error, inside of my init.lua i have [lua]AddCSLuaFile( "moneysystem.lua" )[/lua] i am including from my shared.lua
Is the error clientside and serverside or just one?
just orange error :< (clients)
Could you post the code for moneysystem.lua, if theres alot just the clientside bits.
[lua]local STARTMONEY = 0 local PAYDAYS = false local PAYDAY_AMOUNT = 5 local PAYDAY_INTERVAL = 8 local PAYDAY_SOUND = true local MONEY_HUD = true if SERVER then local pm = FindMetaTable("Player") function PlayerMoneySpawn( ply ) ply:Money_Create() end hook.Add("PlayerInitialSpawn", "MoneySystemStart", PlayerMoneySpawn) function pm:Money_Create() -- DONT TOUCH! THIS FUNCTION SAVES THE SHIT print("Creating money account for: "..self:Nick()) if self:GetPData( "cash" ) == nil then self:SetPData( "cash", STARTMONEY ) end end function pm:Money_Set( cash ) self:SetPData( "cash", tonumber(cash) ) self:SetNWInt( "cash", tonumber(cash) ) end function pm:Money_Add( cash ) if cash > 0 then local current = tonumber(self:GetPData( "cash" )) self:Money_Set( current + cash ) end end --[[MOST RECENT CHANGE]]-- function playerDies( victim, weapon, killer ) Msg( "Player " .. victim:GetName() .. " has died."\n ) killer:Money_Add( 100 ) end hook.Add( "PlayerDeath", "playerDeathTest", playerDies ) function pm:Money_Has( cash ) local current = tonumber(self:GetPData( "cash" )) if current >= tonumber(cash) then return true else return false end end function pm:Money_Get() local current = tonumber(self:GetPData( "cash" )) return current end function pm:Money_Take( cash ) if self:Money_Has( cash ) then local current = tonumber(self:GetPData( "cash" )) self:Money_Set( current - cash ) end end if PAYDAYS then timer.Create( "payday_timer", PAYDAY_INTERVAL, 0, function() for k, ply in pairs(player.GetAll()) do ply:Money_Add( PAYDAY_AMOUNT ) if PAYDAY_SOUND then ply:EmitSound("items/ammo_pickup.wav") end end end ) end else local function Money_Draw() if not MONEY_HUD then return end local mulleh = LocalPlayer():GetNWInt( "cash" ) draw.DrawText("Yen: "..mulleh, "Trebuchet18", 5, 5, Color(255,215,0,255)) end hook.Add("HUDPaint", "MoneyPainting", Money_Draw) end[/lua]
Remember to check if killer:IsPlayer(), but that isnt the cause of this error... hm but it should still be able to include to give you an error if there was one, if you remove the recent change does it work again?
Sounds like your cache is not updated correctly, or you are calling AddCSLuaFile on the client.
i update my cache everytime i start the server, also what do you mean by this [quote]or you are calling AddCSLuaFile on the client[/quote]
What file is AddCSLuaFile("moneysystem.lua") in
init.lua [editline]02:23AM[/editline] problem fixed [lua] function playerDies( victim, weapon, killer ) Msg( "Player " .. victim:GetName() .. " has died."\n ) killer:Money_Add( 100 ) end hook.Add( "PlayerDeath", "playerDeathTest", playerDies )[/lua] causes it, but without that i cant get people to be paid for killing FFF
Put \n inside the string, i said that on your other thread :P
I get the same porblem for the achievements in my lobby, just put what doesn't work in autorun and only use addcslua file ... Worked for me
Sorry, you need to Log In to post a reply to this thread.