[HELP] SetPlayerObjectMaterial
#1

I'm using SetPlayerObjectMaterial.
But i want to delete object, only material text, i try ID 19300 but dont work.
Reply
#2

You Need To Set A Variable For That Object Then you need to apply that material to that object
Reply
#3

heres my example

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>

#define MAX_BLOCKS 100

#define Loop(%0,%1) for(new %0 = 0; %0 < %1; %0++)

#define ALLBLOCK Loop(i, MAX_BLOCKS)

enum BInfo
{
     Float:OffX,
     Float:OffY,
     Float:OffZ,
     Float:RX,
     Float:RY,
     Float:RZ
}
new BlockInfo[MAX_BLOCKS][BInfo];
new AllBlock[MAX_BLOCKS];
new IsPlayerCreateBlock[MAX_PLAYERS][MAX_BLOCKS];
new BID;

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

CMD:createblock(playerid,params[])
{
   new type;
   if(sscanf(params, "i",type)) return SendClientMessage(playerid,-1,"/createblock <1-5>");
   {
   new Float:X,Float:Y,Float:Z;
   IsPlayerCreateBlock[playerid][BID] = 1;
   GetPlayerPos(playerid,X,Y,Z);
   CreateDynamicBlock(type,X,Y,Z,0.00,0.00,0.00);
   new str[128];
   format(str, sizeof(str), "Object Id: %d", BID);
   CreatePlayer3DTextLabel(playerid,str,0x008080FF,X,Y,Z,40.0);
   }
   return 1;
}




stock CreateDynamicBlock(type,Float:X,Float:Y,Float:Z,Float:RotX,Float:RotY,Float:RotZ)
{
    if(type == 1)
    {
    BlockInfo[BID][OffX] = X;
    BlockInfo[BID][OffY] = Y;
    BlockInfo[BID][OffZ] = Z;
    BlockInfo[BID][RX] = RotX;
    BlockInfo[BID][RY] = RotX;
    BlockInfo[BID][RZ] = RotZ;
    AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
    SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "red", 0xFFFFFF10);
    BID++;
    }
    if(type == 2)
    {
    BlockInfo[BID][OffX] = X;
    BlockInfo[BID][OffY] = Y;
    BlockInfo[BID][OffZ] = Z;
    BlockInfo[BID][RX] = RotX;
    BlockInfo[BID][RY] = RotX;
    BlockInfo[BID][RZ] = RotZ;
    AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
    SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "green", 0xFFFFFF10);
    BID++;
    }
    if(type == 3)
    {
    BlockInfo[BID][OffX] = X;
    BlockInfo[BID][OffY] = Y;
    BlockInfo[BID][OffZ] = Z;
    BlockInfo[BID][RX] = RotX;
    BlockInfo[BID][RY] = RotX;
    BlockInfo[BID][RZ] = RotZ;
    AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
    SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "orange", 0xFFFFFF10);
    BID++;
    }
    if(type == 4)
    {
    BlockInfo[BID][OffX] = X;
    BlockInfo[BID][OffY] = Y;
    BlockInfo[BID][OffZ] = Z;
    BlockInfo[BID][RX] = RotX;
    BlockInfo[BID][RY] = RotX;
    BlockInfo[BID][RZ] = RotZ;
    AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
    SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "yellow", 0xFFFFFF10);
    BID++;
    }
    else
    {
    //create black block
    BlockInfo[BID][OffX] = X;
    BlockInfo[BID][OffY] = Y;
    BlockInfo[BID][OffZ] = Z;
    BlockInfo[BID][RX] = RotX;
    BlockInfo[BID][RY] = RotX;
    BlockInfo[BID][RZ] = RotZ;
    AllBlock[BID] = CreateDynamicObject(3799,X,Y,Z,RotX,RotY,RotZ);
    SetDynamicObjectMaterial(AllBlock[BID], 0, 18646, "MatColours", "blue", 0xFFFFFF10);
    BID++;
    }
    return 1;
}
Reply
#4

You dont understand me, i want to make ObjectMaterialText, but i want to hide that object.
Reply
#5

do this
pawn Код:
SetObjectMaterialText(yourobject, "Your Text", 0, OBJECT_MATERIAL_SIZE_256x128,\"Arial", 28, 0, 0xFFFF8200, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
Код:

objectid	The ID of the object to replace the texture of with text.
text	The text to show on the object.
materialindex	The object's material index to replace with text.
materialsize	The size of the material.
fontface	The font to use.
fontsize	The size of the text (MAX 255).
bold	Bold text. Set to 1 for bold, 0 for not.
fontcolor	The color of the text, in ARGB format.
backcolor	The background color, in ARGB format.//change back colour to "0" to disable the background colour
textalignment	The alignment of the text (default: left).
change backcolour to "0" to disable it
Reply
#6

And what i gona put in CreateObject?
Reply
#7

I add this but dont work.
CMD:grafiti(playerid, params[])
{
new Float,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
myobject = CreateObject(1651, x, y, z, 0.0, 0.0, 90.0);
SetObjectMaterialText(myobject, "Your Text", 0, OBJECT_MATERIAL_SIZE_256x128,\"Arial", 28, 0, 0x808080FF, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
return 1;
}
Reply
#8

pawn Код:
CMD:grafiti(playerid,params[])
{
   new Text[MAX_PLAYERS];
   new Float:X,Float:Y,Float:Z;
   GetPlayerPos(playerid,X,Y,Z);
   Text[playerid] = CreateObject(19353, X, Y, Z, 0.0, 0.0, 90.0);
   SetObjectMaterialText(Text[playerid],"Hello", 0, OBJECT_MATERIAL_SIZE_256x128,\"Arial", 28, 0, 0xFFFF8200, 0, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
   return 1;
}
this should work, i test on my server
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)