OnPlayerSelectObject

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 07:58, 22 April 2014
MP2 (Talk | contribs)

← Previous diff
Revision as of 11:46, 9 August 2017
OstGot (Talk | contribs)

Next diff →
Line 13: Line 13:
{{Param|Float:fZ|The Z position of the selected object}} {{Param|Float:fZ|The Z position of the selected object}}
-{{NoReturnCallback}}+{{Returns|
 +* '''1''' - Will prevent other filterscripts from receiving this callback.
 +* '''0''' - Indicates that this callback will be passed to the next filterscript.
 +* It is always called first in filterscripts.}}
{{Example}} {{Example}}

Revision as of 11:46, 9 August 2017



OnPlayerSelectObject was added in SA-MP 0.3e This function was added in SA-MP 0.3e and will not work in earlier versions!


Description:

This callback is called when a player selects an object after SelectObject has been used.


Parameters:
(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
playeridThe ID of the player that selected an object
objectidThe ID of the selected object
Float:fXThe X position of the selected object
Float:fYThe Y position of the selected object
Float:fZThe Z position of the selected object


Return Values:

  • 1 - Will prevent other filterscripts from receiving this callback.
  • 0 - Indicates that this callback will be passed to the next filterscript.
  • It is always called first in filterscripts.


Example Usage:

public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
    printf("Player %d selected object %d", playerid, objectid);
    if(type == SELECT_OBJECT_GLOBAL_OBJECT)
    {
        EditObject(playerid, objectid);
    }
    else
    {
        EditPlayerObject(playerid, objectid);
    }
    SendClientMessage(playerid, 0xFFFFFFFF, "You now are able to edit your object!");
    return 1;
}

Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

Personal tools