Ximboliex 85 Report post Posted October 24, 2016 (edited) You Need serialize.lua run in your server WeekFolder = "scripts/addons/weekprize/" function CheckWeek(role) if exists_file(GetResPath(WeekFolder..""..GetCharID(role)..".txt")) == false then table.save({Week = -1,Registered = 0},GetResPath(WeekFolder..""..GetCharID(role)..".txt"),"a") end local DailyPrize = table.load(GetResPath(WeekFolder..""..GetCharID(role)..".txt"),"r") local NowWeek = GetNowWeek() if DailyPrize.Week ~= NowWeek then GiveWeekPrize(role) else HelpInfo(role,0,"You already have received your award today, come back tomorrow to receive again.") return end end function GiveWeekPrize(role) local DailyPrize = table.load(GetResPath(WeekFolder..""..GetCharID(role)..".txt"),"r") local NowWeek = GetNowWeek() if DailyPrize.Registered >= 6 and NowWeek == 0 then GiveItem(role,0,xxxx,5,1) DailyPrize.Week = NowWeek DailyPrize.Registered = -1 table.save(DailyPrize,GetResPath(WeekFolder..""..GetCharID(role)..".txt"),"w") HelpInfo(role,0,"Congratulations, you collected all the daily prizes and obtained 5 Forbidden Keys") else local WeekPrize = {} WeekPrize[0] = xxx WeekPrize[1] = xxx WeekPrize[2] = xxx WeekPrize[3] = xxx WeekPrize[4] = xxx WeekPrize[5] = xxx WeekPrize[6] = xxx GiveItem(role,0,WeekPrize[NowWeek],1,1) DailyPrize.Week = NowWeek DailyPrize.Registered = DailyPrize.Registered + 1 table.save(DailyPrize,GetResPath(WeekFolder..""..GetCharID(role)..".txt"),"w") HelpInfo(role,0,"You received "..GetItemName(WeekPrize[NowWeek]).."! You can obtain another award again tomorrow.") end end ************************************* in NpcSdk: ( under JumpPage ) elseif item.func == CheckWeek then return CheckWeek(character) ************************************ npc function; function blabla() Talk(1,"Test 1 2 3") Text(1,"Daily Prize",CheckWeek) end -By @Yomazu Edited October 24, 2016 by Ximboliex 1 Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted October 24, 2016 You could give credits to who released it before or did, no? - Firmina @Yomazu 2 Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted September 8, 2017 @Ximboliex can u help me solve this error? Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted September 8, 2017 (edited) 33 minutes ago, FapFap said: @Ximboliex can u help me solve this error? add the following code somewhere inside functions.lua function exists_file(name) local f=io.open(name,"r") if f~=nil then io.close(f) return true else return false end end Edited September 8, 2017 by iZae Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted September 8, 2017 @iZae getting this error.. Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted September 9, 2017 19 hours ago, FapFap said: @iZae getting this error.. Anyone? Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted September 10, 2017 19 hours ago, FapFap said: Anyone? anyone can help me with this?! Quote Share this post Link to post Share on other sites
Andy 39 Report post Posted September 10, 2017 9 minutes ago, FapFap said: anyone can help me with this?! try use normal serialize? instead of xtacy one Quote Share this post Link to post Share on other sites
FapFap 13 Report post Posted September 10, 2017 46 minutes ago, Andy said: try use normal serialize? instead of xtacy one i need help fix this, coz i need xtacy one. Quote Share this post Link to post Share on other sites
Graf 209 Report post Posted November 15, 2019 May be i`m very stupid, but... and see Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted November 17, 2019 On 11/15/2019 at 6:43 PM, Graf said: May be i`m very stupid, but... and see Hello @Graf! Maybe you're missing exists_file function or it called with other name within ur file, check lua_err for a concret answer about the error and tell us. Quote Share this post Link to post Share on other sites
Graf 209 Report post Posted November 18, 2019 @Satan i see not error with this function. Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted November 18, 2019 @Graf If this error appeared in system, it should generate any lua_err. Quote Share this post Link to post Share on other sites
Graf 209 Report post Posted November 20, 2019 В 18.11.2019 в 17:31, Satan сказал: @Graf If this error appeared in system, it should generate any lua_err. No see(( Quote Share this post Link to post Share on other sites
Eviles 179 Report post Posted November 20, 2019 4 hours ago, Graf said: No see(( A good idea to fixing that is you making sure u got all functions needed which are being called in codes. Start from CheckWeek(role), ensure the data file being created and if all working fine. You can replace the GiveWeekPrize(role) which being called in the function CheckWeek(role) to ensure it working. Feel free to pm me if you get no success. Quote Share this post Link to post Share on other sites
squaller 21 Report post Posted December 30, 2021 (edited) WeekFolder = "scripts/addons/weekprize/ its script, not scripts, then you should create the folder weekprize Edited December 30, 2021 by squaller Quote Share this post Link to post Share on other sites