SetPlayerObjectMaterial

SetPlayerObjectMaterial

Description:
Function SetPlayerObjectMaterial replace the texture of a player-object with the texture from another model in the game.
Function SetPlayerObjectMaterial was added in 0.3e and will not work in earlier versions!
Vertex lightning of the object will disappear if material color is changed.
You MUST use ARGB color format, not RGBA like used in client messages etc.


Parameters:
(playerid, objectid, materialindex, modelid, txdname[], texturename[], materialcolor)
int playerid The ID of the player the object is associated to.
int objectid The ID of the object to replace the texture of.
int materialindex The material index on the object to change (0 to 15).
int modelid The modelid on which replacement texture is located. Use 0 for alpha. Use -1 to change the material color without altering the existing texture.
string txdname The name of the txd file which contains the replacement texture (use "none" if not required).
string texturename The name of the texture to use as the replacement (use "none" if not required).
int materialcolor The object color to set, as an integer or hex in ARGB format. Using 0 keeps the existing material color.


Return Values:
This function does not return any specific values.


Examples:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext,"/objmat",true))
    {
        new Float:X, Float:Y, Float:Z;
        new myobject;
        GetPlayerPos(playerid, X, Y, Z);
        myobject = CreatePlayerObject(playerid, 19371, X, Y, Z+0.5, 0.0, 0.0, 0.0, 300.0);
        SetPlayerObjectMaterial(playerid, myobject, 0, 19341, "egg_texts", "easter_egg01", 0xFFFFFFFF);
        // Replaces the texture of our player-object with the texture of model 19341
        return 1;
    }
    return 0;
}


Related Functions
The following functions may be useful, as they are related to this function in one way or another.
  • SetObjectMaterial: Replace the texture of an object with the texture from another model in the game.


Filterscripts with texturing/text support:
  • Ultimate Creator by Nexius
  • Fusez's Map Editor by RedFusion