10.07.2013, 16:54
I changed my old toy system to the new one, but when I deattach a toy and attach it, it changes position.Here are some codes:
OnPlayerEditAttachedObject
Dialog EDITTOYS2
OnPlayerEditAttachedObject
pawn Код:
public OnPlayerEditAttachedObject(playerid, response, slotselection[playerid], modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
{
SetPlayerAttachedObject(playerid, slotselection[playerid], modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ);
PlayerToyInfo[playerid][slotselection[playerid]][ptBone] = boneid;
PlayerToyInfo[playerid][slotselection[playerid]][ptPosX] = fOffsetX;
PlayerToyInfo[playerid][slotselection[playerid]][ptPosY] = fOffsetX;
PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ] = fOffsetX;
PlayerToyInfo[playerid][slotselection[playerid]][ptRotX] = fRotX;
PlayerToyInfo[playerid][slotselection[playerid]][ptRotY] = fRotY;
PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ] = fRotZ;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX] = fScaleX;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleY] = fScaleY;
PlayerToyInfo[playerid][slotselection[playerid]][ptScaleZ] = fScaleZ;
return 1;
}
pawn Код:
}
if((dialogid == EDITTOYS2))
{
if(response)
{
if(listitem == 0)
{
ShowPlayerDialog(playerid, EDITTOYSBONE, DIALOG_STYLE_LIST, "Select a Bone", "Spine\nHead\nLeft upper arm\nRight upper arm\nLeft hand\nRight hand\nLeft thigh\nRight thigh\nLeft foot\nRight foot\nRight calf\nLeft calf\nLeft forearm\nRight forearm\nLeft clavicle\nRight clavicle\nNeck\nJaw", "Select", "Cancel");
}
else if(listitem == 1)
{
EditAttachedObject(playerid, slotselection[playerid]);
}
}
else
{
new stringg[512];
for(new x;x<MAX_PLAYERTOYS;x++)
{
new name[24];
format(name, sizeof(name), "None");
for(new i;i<sizeof(HoldingObjectsAll);i++)
{
if(HoldingObjectsAll[i][holdingmodelid] == PlayerToyInfo[playerid][x][ptModelID])
{
format(name, sizeof(name), "%s", HoldingObjectsAll[i][holdingmodelname]);
}
}
format(stringg, sizeof(stringg), "%s(%d) %s (Bone: %s)\n", stringg, x, name, HoldingBones[PlayerToyInfo[playerid][x][ptBone]]);
}
ShowPlayerDialog(playerid, EDITTOYS, DIALOG_STYLE_LIST, "Select a Toy", stringg, "Select", "Cancel");
}
}