01-15-2014, 05:40 AM
Thanks.
For my permissions plugin i used this for table.insert:
rank[Player:GetName()] = result;What is better?
And how can i check if he is in the table?
rank[Player:GetName()] = result;What is better?
local Table = {} Table.insert(Table, "Test") print(Table[1]) -- Result is "Test" Table.insert(Table, "Test2") print(Table[2]) -- Result is "Test2"When you use your way:
local Table = {} Table["Test"] = "Test" print(Table["Test"]) -- Result is "Test"You add a key. This is propably better then using table.insert because you already know the name of the key.
if (rank[Player:GetName()] == nil) then -- He's not in the table end
local Amount = cRoot:Get():GetServer():GetNumPlayers()
(01-16-2014, 12:11 AM)STR_Warrior Wrote: [ -> ]2 and 3: the cFile class might be able to do something.
(01-16-2014, 12:22 AM)daniel0916 Wrote: [ -> ]I will copy on startup from the server the backup from the minigame map to the mcserver folder.
And on server stop i will delete the world folder.
(01-16-2014, 12:49 AM)xoft Wrote: [ -> ]You might want to consider the Forgetful storage schema, settable in world.ini. It will cause the server to load chunks from the MCA files, but not save them anywhere, so as soon as the chunks are unloaded (all players log out or move too far away) the chunks seemingly regenerate back to their previous state.
http://wiki.mc-server.org/doku.php?id=co...ge_section
function AddSchedule(Function, Parameters, Ticks) table.insert(ScheduleTable, {Function, Parameters, Ticks}) end function OnScheduleTick(Time) for I=1, #ScheduleTable do if ScheduleTable[I][4] < 0 then ScheduleTable[I][2](ScheduleTable[I][3]) table.remove(ScheduleTable, I) else ScheduleTable[I][4] = ScheduleTable[I][4] - 1 end end end
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnScheduleTick);
AddSchedule(MyFunction, {}, 200);
function MyFunction(Params) cRoot:Get():BroadcastChat("Schedule!"); end
[16:12:40] Stack trace:
[16:12:40] [C](-1): (no name)
[16:12:40] Plugins/SurvivalGames/main.lua(75): (no name)
[16:12:40] Stack trace end
[16:12:40] Error in plugin SurvivalGames calling function <callback>()
[16:12:40] LUA: Plugins/SurvivalGames/main.lua:75: attempt to compare nil with number
if ScheduleTable[I][4] < 0 then
local Table = {12, 43, 13} Index: 1 2 3
function OnScheduleTick(Time) for I=1, #ScheduleTable do if ScheduleTable[I][3] < 0 then ScheduleTable[I][2](ScheduleTable[I][3]) table.remove(ScheduleTable, I) else ScheduleTable[I][3] = ScheduleTable[I][3] - 1 end end end
function OnScheduleTick(Time) for I=1, #ScheduleTable do if ScheduleTable[I][3] < 0 then ScheduleTable[I][1](ScheduleTable[I][2]) table.remove(ScheduleTable, I) else ScheduleTable[I][3] = ScheduleTable[I][3] - 1 end end end