27.03.2013, 05:34
You're doing it wrong, here some explanation what you have tried
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:
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
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
}
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);
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
