1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| local api -- control the street object table, obtained through the sf_start event callback, and stored in module local variables. For details, please refer to (api interface.txt) local members -- array of game player objects, obtained through sf_start event callback, stored in module local variables -- Each user object table has uid, name, position, vip, gold, gender attributes
--- Start game event, called every time the game starts, used to initialize variables and start the game -- @function sf_start -- @tab members array of all players -- @tab nativeapi, control interface local function sf_start(membersArray, nativeapi) --Put these variables in module variables and use them in other event callbacks api = nativeapi members = membersArray api.log("game start") return true end
--- Receive client network data response event. -- @function sf_message -- @tab data data table table -- @int index Which player sent the information local function sf_message(data, index)
end
--- The player is offline in the game and the reconnection event can be omitted. -- @function offline -- @int index Which player's status changed -- @boolean isOnline true to reconnect online, false to offline. local function sf_offline(index,isOnline)
end
--- In the game, spectatorship requires data and can be omitted. -- @function sf_looker -- @tab lm Who is here to watch? Watch user information, which can be used as the first parameter of api.send local function sf_looker(lm)
end
-- Output two required event interfaces, and can output 2 optional interfaces return { start=sf_start, message=sf_message, offline=sf_offline, looker=sf_looker, }
|