PlayerTextDrawSetPreviewModel

From SA-MP Wiki

Jump to: navigation, search


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


Description:

Sets a player textdraw 2D preview sprite of a specified model ID.


Parameters:
(playerid, PlayerText:text, modelindex)
playeridThe PlayerTextDraw player ID.
textThe textdraw id that will display the 3D preview.
modelindexThe GTA SA or SA:MP model ID to display.


Return Values:

  • 1: The function executed successfully. If an invalid model is passed 'success' is reported, but the model will appear as a yellow/black question mark.
  • 0: The function failed to execute. Player and/or textdraw do not exist.


Example Usage:

new PlayerText:textdraw;
 
public OnPlayerConnect(playerid)
{
    textdraw = CreatePlayerTextDraw(playerid, 320.0, 240.0, "_");
    PlayerTextDrawFont(playerid, textdraw, TEXT_DRAW_FONT_MODEL_PREVIEW);
    PlayerTextDrawUseBox(playerid, textdraw, 1);
    PlayerTextDrawBoxColor(playerid, textdraw, 0x000000FF);
    PlayerTextDrawTextSize(playerid, textdraw, 40.0, 40.0);
    PlayerTextDrawSetPreviewModel(playerid, textdraw, 411); // Show an Infernus (model 411)
    //PlayerTextDrawSetPreviewModel(playerid, textdraw, 0); //Display model 0 (CJ Skin)
    //PlayerTextDrawSetPreviewModel(playerid, textdraw, 18646); //Display model 18646 (police light object)
    PlayerTextDrawShow(playerid, textdraw);
    return 1;
}
Image:32px-Circle-style-warning.png

Important
Note

The textdraw MUST use the font type TEXT_DRAW_FONT_MODEL_PREVIEW in order for this function to have effect.


Related Functions

The following functions may be useful, as they are related to this function in one way or another.


Related Callbacks

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

Personal tools
Navigation
Toolbox