When i use this. The player don't lose one level only a little bit xp.
cRoot:Get():ForEachPlayer(function(Player)
Player:DeltaExperience(-cPlayer:XpForLevel(1));
end)
I'm pretty sure this is because the experience for levels is not linear - try this instead, where currentLevel is the current level of the player.
cRoot:Get():ForEachPlayer(function(Player)
Player:DeltaExperience(-(cPlayer:XpForLevel(currentLevel) - cPlayer:XpForLevel(currentLevel - 1)));
end)
(01-16-2014, 12:07 AM)daniel0916 Wrote: [ -> ]2. How can i copy a folder with lua?
If you still need this. In my new Execute I have 3 example scripts,
one off them contains a CopyFolder function.
(01-16-2014, 05:30 AM)STR_Warrior Wrote: [ -> ] (01-16-2014, 12:07 AM)daniel0916 Wrote: [ -> ]2. How can i copy a folder with lua?
If you still need this. In my new Execute I have 3 example scripts, one off them contains a CopyFolder function.
Maybe. But i don't think because i can disable chunk saving in the world.ini..
I use the PlayerSpawn Hook and there is:
local onlineplayers = cRoot:Get():GetServer():GetNumPlayers();
0
And i tried to start a new schedule when the old schedule is at 0 but this don't work. MCServer crash without a error..
Okay, i tried it now again but i can't start a new schedule from the end of the old.
MCServer will be cancelled.
The message from ubuntu is in german but translated it should be: Canceled (Written dump)
I think it crashes because the table gets editted while you are proccessing it. You'l have to find a way around it.
I made now 2 tables. It's working but sometimes the first scheduler stops at any time.. But often it's working.
I'm guessing you only changed the OnScheduleTick function. Could I see that code?
(01-17-2014, 02:27 AM)STR_Warrior Wrote: [ -> ]I'm guessing you only changed the OnScheduleTick function. Could I see that code?
I made 2 hooks for Lobby and Start.
Code:
function AddLobbySchedule(Function, Parameters, Ticks)
table.insert(LobbyScheduleTable, {Function, Parameters, Ticks})
end
function OnLobbyScheduleTick(Time)
for Idx, ScheduleTask in pairs(LobbyScheduleTable) do
LobbyScheduleTable[Idx][3] = LobbyScheduleTable[Idx][3] - 1 -- Countdown
if ScheduleTask[3] < 1 then
ScheduleTask[1](ScheduleTask[2])
LobbyScheduleTable[Idx] = nil
end
end
end
function AddStartSchedule(Function, Parameters, Ticks)
table.insert(StartScheduleTable, {Function, Parameters, Ticks})
end
function OnStartScheduleTick(Time)
for Idx, ScheduleTask in pairs(StartScheduleTable) do
StartScheduleTable[Idx][3] = StartScheduleTable[Idx][3] - 1 -- Countdown
if ScheduleTask[3] < 1 then
ScheduleTask[1](ScheduleTask[2])
StartScheduleTable[Idx] = nil
end
end
end
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnLobbyScheduleTick);
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnStartScheduleTick);
But then.. What's the difference?
