SetPlayerAttachedObject -
Aleksabre - 14.08.2015
I'm a bit confused here as I never used it before.
SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, materialcolor1, materialcolor2);
so I want the SWATblock shield to be attached to a player just like this:
https://www.youtube.com/watch?v=Pno3Ayrplq0
Can someone please tell me how can I get to the coords?
ID of the shield: 18637
Re: SetPlayerAttachedObject -
HarrisonC - 14.08.2015
You should attach the object like so
Then you should use
Код:
EditAttachedObject(playerid, chosen index);
When you've saved it to your liking, use the information in the parameters of this callback
Код:
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
}
Re: SetPlayerAttachedObject -
Aleksabre - 14.08.2015
So, like this:
Код:
SetPlayerAttachedObject(playerid, 1, 18637, 5));
EditAttachedObject(playerid, 1);
public OnPlayerEditedAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
SetPlayerAttachedObject(playerid, 1, 18637, 5));
}
Could you help me somewhere if I'm wrong.
Re: SetPlayerAttachedObject -
HarrisonC - 14.08.2015
Quote:
Originally Posted by Aleksabre
So, like this:
Код:
SetPlayerAttachedObject(playerid, 1, 18637, 5));
EditAttachedObject(playerid, 1);
public OnPlayerEditedAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
SetPlayerAttachedObject(playerid, 1, 18637, 5));
}
Could you help me somewhere if I'm wrong.
|
You would use this in a command somewhere
Код:
SetPlayerAttachedObject(playerid, 1, 18637, 5);
EditAttachedObject(playerid, 1);
Then when you click the save icon, you would have this somewhere amongst your other SAMP callbacks
Код:
public OnPlayerEditedAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
// Do something with Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ
// Save the information by using print() for example to find out how you like it
}
Then once you've got the co-ordinates you like, use them in the next time you have the cmd like /swatshield would give you
Код:
SetPlayerAttachedObject(playerid, 1, 18637, 5, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
Remember though because its important - when using the values passed from the parameters you need to remove the "Float:" part - except from the actual callback public OnPlayerEditedAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY) - don't remove them there
Re: SetPlayerAttachedObject -
Aleksabre - 14.08.2015
Could you help me about this; I made;
SetPlayerAttachedObject(playerid, 1, 18637, 5); in OnPlayerSpawn
then in OnPlayerCommandText
EditAttachedObject(playerid, 1); with the command /shield
and about this:
Код:
public OnPlayerEditedAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
// Do something with Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ
// Save the information by using print() for example to find out how you like it
}
I didn't type that
So,
and yeah, when I spawned, I got it on the left hand, but when I type /shield it says server unknown command;
how do I make when I actually type /shield I get it, and also; I typed /crossarms and the object looks like upside down, not on the right position, how do I fix those things?
Re: SetPlayerAttachedObject -
HarrisonC - 14.08.2015
If you want to find out the exact co-ordinates to use for a fine tuned accurate look - you can should use both the SetPlayerAttachedObject() + EditAttachedObject in one command
public OnPlayerEditedAttachedObject() is a callback so when you're finished doing EditAttachedObject, all the information about how you edited it (the current position etc) are passed on those parameters
You need to find out what the parameters are and then use them in SetPlayerAttachedObjct in the future to have the look you want which would be the position you chose when you saved it after the Edit.