Toy position doesn't save
#1

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
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;
}
Dialog EDITTOYS2
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");
        }
    }
Reply
#2

Help me please?

EDIT: I had this before I change it to the new system, may help you:
pawn Код:
if(dialogid == EDITTOYSPX)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < -100) offset = 0;
            else if(offset > 100) offset = 100;
            offset = offset/100;
            PlayerToyInfo[playerid][slotselection[playerid]][ptPosX] = offset;
        }
        ShowEditMenu(playerid);
    }
    if(dialogid == EDITTOYSPY)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < -100) offset = 0;
            else if(offset > 100) offset = 100;
            offset = offset/100;
            PlayerToyInfo[playerid][slotselection[playerid]][ptPosY] = offset;
        }
        ShowEditMenu(playerid);
    }
    if(dialogid == EDITTOYSPZ)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < -100) offset = 0;
            else if(offset > 100) offset = 100;
            offset = offset/100;
            PlayerToyInfo[playerid][slotselection[playerid]][ptPosZ] = offset;
        }
        ShowEditMenu(playerid);
    }
    if(dialogid == EDITTOYSRX)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < -100) offset = 0;
            else if(offset > 360) offset = 360;
            PlayerToyInfo[playerid][slotselection[playerid]][ptRotX] = offset;
        }
        ShowEditMenu(playerid);
    }
    if(dialogid == EDITTOYSRY)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < -100) offset = 0;
            else if(offset > 360) offset = 360;
            PlayerToyInfo[playerid][slotselection[playerid]][ptRotY] = offset;
        }
        ShowEditMenu(playerid);
    }
    if(dialogid == EDITTOYSRZ)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < -100) offset = 0;
            else if(offset > 360) offset = 360;
            PlayerToyInfo[playerid][slotselection[playerid]][ptRotZ] = offset;
        }
        ShowEditMenu(playerid);
    }
    if(dialogid == EDITTOYSSX)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < 1) offset = 1;
            else if(offset > 1.5) offset = 1.5;
            PlayerToyInfo[playerid][slotselection[playerid]][ptScaleX] = offset;
        }
        ShowEditMenu(playerid);
    }if(dialogid == EDITTOYSSY)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < 1) offset = 1;
            else if(offset > 1.5) offset = 1.5;
            PlayerToyInfo[playerid][slotselection[playerid]][ptScaleY] = offset;
        }
        ShowEditMenu(playerid);
    }if(dialogid == EDITTOYSSZ)
    {
        if(response)
        {
            new Float:offset = floatstr(inputtext);
            if(offset < 1) offset = 1;
            else if(offset > 1.5) offset = 1.5;
            PlayerToyInfo[playerid][slotselection[playerid]][ptScaleZ] = offset;
        }
        ShowEditMenu(playerid);
}
Reply
#3

Sorry for bump, I need this so much please help...
Reply
#4

Bump, help me please, let me explain better.I got That^^ script on OnPlayerEditAttachedObject, it saves the object to wrong position.Please help me solving this problem, I need help...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)