stock GetAttachedObjectPos(objectid, Float:offset_x, Float:offset_y, Float:offset_z, &Float:x, &Float:y, &Float:z)
{
new Float:object_px,
Float:object_py,
Float:object_pz,
Float:object_rx,
Float:object_ry,
Float:object_rz;
GetObjectPos(objectid, object_px, object_py, object_pz);
GetObjectRot(objectid, object_rx, object_ry, object_rz);
new Float:cos_x = floatcos(object_rx, degrees),
Float:cos_y = floatcos(object_ry, degrees),
Float:cos_z = floatcos(object_rz, degrees),
Float:sin_x = floatsin(object_rx, degrees),
Float:sin_y = floatsin(object_ry, degrees),
Float:sin_z = floatsin(object_rz, degrees);
x = object_px + offset_x * cos_y * cos_z - offset_x * sin_x * sin_y * sin_z - offset_y * cos_x * sin_z + offset_z * sin_y * cos_z + offset_z * sin_x * cos_y * sin_z;
y = object_py + offset_x * cos_y * sin_z + offset_x * sin_x * sin_y * cos_z + offset_y * cos_x * cos_z + offset_z * sin_y * sin_z - offset_z * sin_x * cos_y * cos_z;
z = object_pz - offset_x * cos_x * sin_y + offset_y * sin_x + offset_z * cos_x * cos_y;
}
new Float:ox,Float:oy,Float:oz,Float:orx,Float:ory,Float:orz; GetObjectPos(firstobjectid,ox,oy,oz); GetObjectRot(firstobjectid,orx,ory,orz); secondobjectid = CreateObject(modelid,ox,oy,oz,orx,ory,orz); //AttachObjectToObject(secondobjectid,firstobjectid,0.0,0.0,0.0,orx,ory.orz); //attach if you want to
Prop[playerid] = CreatePlayerObject(playerid, PropPositions[ii][ModelID], PropPositions[ii][Offset][0], PropPositions[ii][Offset][1], PropPositions[ii][Offset][2], PropPositions[ii][Rot][0], PropPositions[ii][Rot][1], PropPositions[ii][Rot][2]);
AttachObjectToPlayer(Prop[playerid], playerid , PropPositions[ii][Offset][0], PropPositions[ii][Offset][1], PropPositions[ii][Offset][2], PropPositions[ii][Rot][0], PropPositions[ii][Rot][1], PropPositions[ii][Rot][2]);
Prop[playerid] = CreatePlayerObject(playerid, PropPositions[ii][ModelID], PropPositions[ii][Offset][0], PropPositions[ii][Offset][1], PropPositions[ii][Offset][2], PropPositions[ii][Rot][0], PropPositions[ii][Rot][1], PropPositions[ii][Rot][2]); AttachObjectToPlayer(Prop[playerid], playerid , PropPositions[ii][Offset][0], PropPositions[ii][Offset][1], PropPositions[ii][Offset][2], PropPositions[ii][Rot][0], PropPositions[ii][Rot][1], PropPositions[ii][Rot][2]); new Float:ox,Float:oy,Float:oz,Float:orx,Float:ory,Float:orz; GetObjectPos(Prop[playerid],ox,oy,oz); GetObjectRot(Prop[playerid],orx,ory,orz); for(new i = 0; i < MAX_PLAYERS; i++){ if(!IsPlayerConnected(i))continue; if(i == playerid)continue; Prop[i] = CreatePlayerObject(i, PropPositions[ii][ModelID], ox,oy,oz,orx,ory,orz); AttachObjectToPlayer(Prop[playerid], playerid ,ox,oy,oz,orx,ory,orz); }
this should add it to everyone else on the server
Код:
Prop[playerid] = CreatePlayerObject(playerid, PropPositions[ii][ModelID], PropPositions[ii][Offset][0], PropPositions[ii][Offset][1], PropPositions[ii][Offset][2], PropPositions[ii][Rot][0], PropPositions[ii][Rot][1], PropPositions[ii][Rot][2]); AttachObjectToPlayer(Prop[playerid], playerid , PropPositions[ii][Offset][0], PropPositions[ii][Offset][1], PropPositions[ii][Offset][2], PropPositions[ii][Rot][0], PropPositions[ii][Rot][1], PropPositions[ii][Rot][2]); new Float:ox,Float:oy,Float:oz,Float:orx,Float:ory,Float:orz; GetObjectPos(Prop[playerid],ox,oy,oz); //<-----------get pos of first obj GetObjectRot(Prop[playerid],orx,ory,orz); //<-----------get rotation of first obj for(new i = 0; i < MAX_PLAYERS; i++){ if(!IsPlayerConnected(i))continue; if(i == playerid)continue; Prop[i] = CreatePlayerObject(i, PropPositions[ii][ModelID], ox,oy,oz,orx,ory,orz); //<create object for all other players where 1st obj was AttachObjectToPlayer(Prop[playerid], playerid ,ox,oy,oz,orx,ory,orz); //<-----fix that object to the orignal player for the new player } |