Attached object texture?
#1

Hi, basicly that.

How can I use SetPlayerAttachedObject with a different texture?

I've tried with this code:

Код:
new attached;

attached = CreateObject(1305, 0, 0, 0, 0.0, 0.0, 0.0);


if(strcmp(cmdtext, "/attached9", true) == 0)
{
		SetPlayerAttachedObject(playerid,0,attached,1,0.0,-5.0,0.0,0.000000,0.000000,75.000000,30.000000,30.000000,30.000000, 0xFF00FF00);
        
	return 1;
}
But it doesn't work.

Thanks in advance.
Reply
#2

you can only change the colour.. (which you did already (0xFF00FF00))
Reply
#3

You're doing it wrong, here some explanation what you have tried
pawn Код:
new attached; // assign "attached" variable

attached = CreateObject(1305, 0, 0, 0, 0.0, 0.0, 0.0); // Create object number 1305 at X: 0, Y: 0, Z:0, RX: 0, RY: 0, RZ: 0 and then return the object ID to "attached" variable"


if(strcmp(cmdtext, "/attached9", true) == 0) // If string compare of "cmdtext" with "/attached9" (ignore case) is same or equal to/returning 0, then do...
{
        SetPlayerAttachedObject(playerid,0,attached,1,0.0,-5.0,0.0,0.000000,0.000000,75.000000,30.000000,30.000000,30.000000, 0xFF00FF00);
// set a holding object to be attached on player in index number 0, with model id of "attached" (which actually an object id and not object model id), in bone 1 (spine), with specified offsets with size of 30 times larger with color 0xFF00FF00 (pink)
       
    return 1; // return 1 so the command is processed
}
The function SetPlayerAttachedObject is seperated from the CreateObject / CreatePlayerObject pools.
However you can not change the material texture of attached, you can only change 2 material colors.
so try to do this:

pawn Код:
if(!strcmp(cmdtext, "/attached9", true)) return SetPlayerAttachedObject(playerid, 0, 1305, 1, 0.0, -5.0, 0.0, 0.0, 0.0, 75.0, 30.0, 30.0, 30.0, 0xFF00FF00);
That code will allow a player get an attached object with model number 1305 at index 0, in spine (bone:1), with 30x larger size, with 0xFF00FF00 color at the first material object

You may like to use my player attached object editor to create attached objects.

But if you really want an object with different texture, try to attach your created object with this function:
SetObjectMaterial
AttachObjectToPlayer

However the object will not attached to the player skin's part, it will just follow the player position, when they move.

hope it helps
Reply
#4

oh, you used CreateObject
pawn Код:
AttachObjectToPlayer(...);
SetObjectMaterial(...);
Reply
#5

Oh, I see. I'll change the attached object's colour then.

Thanks a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)