开源软件名称(OpenSource Name):THE-FYP/SAMP.Lua开源软件地址(OpenSource Url):https://github.com/THE-FYP/SAMP.Lua开源编程语言(OpenSource Language):Lua 100.0%开源软件介绍(OpenSource Introduction):SAMP.LuaSAMP.Lua is a lua library for MoonLoader that adds some features to make SA:MP modding simpler. Currently this library is work in progress. At this moment the only implemented module is SAMP.Events. InstallationCopy the entire folder SAMP.EventsGives ability to handle SA:MP incoming and outcoming low-level network packets by very easy way. Usagelocal sampev = require 'samp.events'
-- intercept outgoing chat messages
function sampev.onSendChat(msg)
print('You said: ' .. msg)
end You can rewrite data. Just return all arguments in the right order within a table. function sampev.onSendChat(msg)
return {'I said: ' .. msg}
end You can also interrupt processing any packets by returning function sampev.onSetPlayerPos(position)
-- prevent server from changing player's position
return false
end Adding your own packet handlerlocal sampev = require 'samp.events'
local raknet = require 'samp.raknet'
sampev.INTERFACE.INCOMING_RPCS[raknet.RPC.PLAYSOUND] = {'onPlaySound', {soundId = 'int32'}, {coordinates = 'vector3d'}}
function sampev.onPlaySound(sound, coords)
-- add log message
print(string.format('Sound %d at coords %0.2f, %0.2f, %0.2f', sound, coords.x, coords.y, coords.z))
-- and mute sound
return false
end The same way you can add your own types for more complex packet structures. See source code for more information and examples. LinksMoonLoader: http://blast.hk/moonloader/ CreditsFYP, MISTER_GONWIK and contributors. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论