Python library for interfacing with San Andreas Multiplayer using memory
You can install the latest version with the command:
pip install -U https://github.com/rmdlv/python-samp/archive/refs/heads/main.zip
from python_samp import SAMP, API
samp = SAMP()
api = API(samp)
scoreboard = api.get_local_scoreboard_data()
api.send_chat(f"My name is {scoreboard.name}")
samp.close()
from python_samp import SAMP
samp = SAMP()
username = samp.process.read_string(samp.module + 0x219A6F)
data = f"My name is {username}"
address = samp.process.allocate(len(data))
samp.process.write_string(address, data)
samp.process.start_thread(samp.module + 0x57F0, address)
samp.process.free(address)
samp.close()
from python_samp import SAMP, API, Events
samp = SAMP()
api = API(samp)
events = Events()
@events.listen(api.read_chat)
def handler(data):
print(f'New chat message: {data}')
from python_samp import SAMP, Misc
samp = SAMP()
misc = Misc(samp)
misc.coord_master(316.0837, -1376.215, 31.92003)
samp.close()
Pull requests are supported! Before creating a pull request, read CONTRIBUTING.md. We are pleased to see your contribution to the development of the library. Ask questions in the Issues section and in Telegram chat!