13.07.2015, 05:06
Cуmo podrнa sacar las coordenadas de posiciуn y rotaciуn de un objeto que tengo adjunto con SetPlayerAttachedObject? Y tambiйn cуmo se podrнa sacar el tamaсo?
CMD:attachpos(playerid, params[])
{
if(sscanf(params, "d", params[0]))
return 1;
new Float:pPas[3];
GetPlayerAttachedObjectPos(playerid, params[0], pPas[0], pPas[1], pPas[2]);
SendClientMessageEx(playerid, -1, "%.2f, %.2f, %.2f", pPas[0], pPas[1], pPas[2]);
return 1;
}
/*
* Funciones [Adicionales] Attachements.
GetPlayerAttachedObjectScale(playerid, index, &Float:ScaleX, &Float:ScaleY, &Float:ScaleZ);
GetPlayerAttachedObjectRot(playerid, index, &Float:RotX, &Float:RotY, &Float:RotZ);
GetPlayerAttachedObjectPos(playerid, index, &Float:PosX, &Float:PosY, &Float:PosZ);
*/
enum z_playerAttachements
{
Exists,
ModelID,
BoneID,
pMaterialColor1, pMaterialColor2,
Float:pOffsetX, Float:pOffsetY, Float:pOffsetZ,
Float:pRotX, Float:pRotY, Float:pRotZ,
Float:pScaleX, Float:pScaleY, Float:pScaleZ
};
new
playerAttachements[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][z_playerAttachements];
public OnPlayerConnect(playerid)
{
for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
RemovePlayerAttachedObjectExZ(playerid, i);
#if defined z_OnPlayerConnect
return z_OnPlayerConnect(playerid);
#else
return 1;
#endif
}
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 )
{
SetPlayerAttachedObjectExZ(playerid, index, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, playerAttachements[playerid][index][pMaterialColor1], playerAttachements[playerid][index][pMaterialColor2]);
#if defined z_OnPlayerEditAttachedObject
return z_OnPlayerEditAttachedObject( playerid, response, index, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ );
#else
return 1;
#endif
}
stock RemovePlayerAttachedObjectExZ(playerid, index)
{
playerAttachements[playerid][index][Exists] = 0;
RemovePlayerAttachedObject(playerid, index);
}
stock SetPlayerAttachedObjectExZ(playerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0)
{
playerAttachements[playerid][index][Exists] = 1;
playerAttachements[playerid][index][ModelID] = modelid;
playerAttachements[playerid][index][BoneID] = bone;
playerAttachements[playerid][index][pOffsetX] = fOffsetX;
playerAttachements[playerid][index][pOffsetY] = fOffsetY;
playerAttachements[playerid][index][pOffsetZ] = fOffsetZ;
playerAttachements[playerid][index][pRotX] = fRotX;
playerAttachements[playerid][index][pRotY] = fRotY;
playerAttachements[playerid][index][pRotZ] = fRotZ;
playerAttachements[playerid][index][pScaleX] = fScaleX;
playerAttachements[playerid][index][pScaleY] = fScaleY;
playerAttachements[playerid][index][pScaleZ] = fScaleZ;
playerAttachements[playerid][index][pMaterialColor1] = materialcolor1;
playerAttachements[playerid][index][pMaterialColor2] = materialcolor2;
SetPlayerAttachedObject(playerid, index, modelid, bone, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, materialcolor1, materialcolor2);
}
stock GetPlayerAttachedObjectPos(playerid, index, &Float:PosX, &Float:PosY, &Float:PosZ)
{
PosX = playerAttachements[playerid][index][pOffsetX];
PosY = playerAttachements[playerid][index][pOffsetY];
PosZ = playerAttachements[playerid][index][pOffsetZ];
return 1;
}
stock GetPlayerAttachedObjectRot(playerid, index, &Float:RotX, &Float:RotY, &Float:RotZ)
{
RotX = playerAttachements[playerid][index][pRotX];
RotY = playerAttachements[playerid][index][pRotY];
RotZ = playerAttachements[playerid][index][pRotZ];
return 1;
}
stock GetPlayerAttachedObjectScale(playerid, index, &Float:ScaleX, &Float:ScaleY, &Float:ScaleZ)
{
ScaleX = playerAttachements[playerid][index][pScaleX];
ScaleY = playerAttachements[playerid][index][pScaleY];
ScaleZ = playerAttachements[playerid][index][pScaleZ];
return 1;
}
#if defined _ALS_RemovePlayerAttachedObject
#undef RemovePlayerAttachedObject
#else
#define _ALS_RemovePlayerAttachedObject
#endif
#if defined _ALS_SetPlayerAttachedObject
#undef SetPlayerAttachedObject
#else
#define _ALS_SetPlayerAttachedObject
#endif
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#if defined _ALS_OnPlayerEditAttachedObject
#undef OnPlayerEditAttachedObject
#else
#define _ALS_OnPlayerEditAttachedObject
#endif
#define OnPlayerConnect z_OnPlayerConnect
#define OnPlayerEditAttachedObject z_OnPlayerEditAttachedObject
#define SetPlayerAttachedObject SetPlayerAttachedObjectExZ
#define RemovePlayerAttachedObject RemovePlayerAttachedObjectExZ
#if defined z_OnPlayerConnect
forward z_OnPlayerConnect(playerid);
#endif
#if defined z_OnPlayerEditAttachedObject
forward z_OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ );
#endif
Intenta poniendo esto en un include y aсadiйndolo a tu cуdigo:
PHP код:
PHP код:
|
Intenta poniendo esto en un include y aсadiйndolo a tu cуdigo:
PHP код:
PHP код:
|