Skip to content

Documentation for callbacks #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pysamp/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,30 @@ def is_valid(self) -> bool:

@event("OnActorStreamIn")
def on_stream_in(cls, actorid: int, forplayerid: int):
"""This callback is called when an actor is streamed in\
by a player's client.

:param int actorid: The ID of the actor.
:param int forplayerid: The ID of the player\
that streamed the actor in.
:returns: No return value.

.. note:: This callback can also be called by NPC.
"""
return (cls(actorid), Player(forplayerid))

@event("OnActorStreamOut")
def on_stream_out(cls, actorid: int, forplayerid: int):
"""This callback is called when an actor is streamed\
out by a player's client.

:param int actorid: The ID of the actor.
:param int forplayerid: The ID of the player\
that streamed the actor out.
:returns: No return value.

.. note:: This callback can also be called by NPC.
"""
return (cls(actorid), Player(forplayerid))

from pysamp.player import Player # noqa
8 changes: 8 additions & 0 deletions pysamp/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,12 @@ def set_default_camera_col(disable: bool) -> bool:

@event("OnObjectMoved")
def on_moved(cls, objectid: int):
"""This callback is called when an object stops moving after :meth:`move`.

:param int objectid: The ID of the object that was moved.
:returns: No return value.

.. note:: :meth:`set_position` does not work when used in this\
event. To fix it, recreate the object.
"""
return (cls(objectid),)
1 change: 0 additions & 1 deletion pysamp/pickup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pysamp import (
create_pickup, destroy_pickup,
# add_static_pickup
)


Expand Down
Loading