Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
/ python-samp Public archive

Python library for interfacing with San Andreas Multiplayer using memory

License

Notifications You must be signed in to change notification settings

rmdlv/python-samp

Repository files navigation

python-samp

Python library for interfacing with San Andreas Multiplayer using memory

GitHub repo size GitHub issues by-label

Installation

You can install the latest version with the command:

pip install -U https://github.com/rmdlv/python-samp/archive/refs/heads/main.zip

High-level example

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()

Low-level example

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()

Events example

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}')

Miscellaneous example

from python_samp import SAMP, Misc

samp = SAMP()
misc = Misc(samp)

misc.coord_master(316.0837, -1376.215, 31.92003)
samp.close()

Contributing

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!

License

Copyright © 2021 rmdlv.
This project has a MIT license.

About

Python library for interfacing with San Andreas Multiplayer using memory

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages