їGetAttachedObjectPos?
#1

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?
Reply
#2

No hay una funciуn, aunque como las posiciones y rotaciones son constantes, sabrбs que valores tiene.
Reply
#3

esta funciуn puede serte ъtil.

saludos.


http://forum.sa-mp.com/showpost.php?...postcount=3262
Reply
#4

Intenta poniendo esto en un include y aсadiйndolo a tu cуdigo:

PHP код:
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;
} 
PHP код:
/*
    * 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 
Las funciones para obtener los datos estбn en los comentarios.
Reply
#5

Quote:
Originally Posted by _Zume
Посмотреть сообщение
Intenta poniendo esto en un include y aсadiйndolo a tu cуdigo:

PHP код:
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;
} 
PHP код:
/*
    * 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 
Las funciones para obtener los datos estбn en los comentarios.
un consejo, abrevia un poco los nombre de las variable/funciones, cuando se termina de escribirlo ya salieron las funciones oficiales.

saludos.
Reply
#6

Quote:
Originally Posted by _Zume
Посмотреть сообщение
Intenta poniendo esto en un include y aсadiйndolo a tu cуdigo:

PHP код:
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;
} 
PHP код:
/*
    * 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 
Las funciones para obtener los datos estбn en los comentarios.
Buenнsimo, muchas gracias. No creo que haya algъn tipo de comentario que alcance a describir un agradecimiento, pero en el fondo se le tiene un gran aprecio a este tipo de comentarios.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)