IDK What's wrong...
#1

Im making clothes shop with editattachedobject...
The problem is that the position on the object is not saving. When i set their position where i want to be and than make a GMX than the object (hat or glasses) are in my stomach.
Here is the code:

pawn Код:
//OnPlayerEditAttachedObject
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)
{
    if(response)
    {
        if(index == 1)
        {
            if(PlayerInfo[playerid][pObleka1] == 0)
            {
                PlayerInfo[playerid][pObleka1] = modelid;
                PlayerInfo[playerid][pObleka1x] = fOffsetX;
                PlayerInfo[playerid][pObleka1y] = fOffsetY;
                PlayerInfo[playerid][pObleka1z] = fOffsetZ;
                PlayerInfo[playerid][pObleka1rx] = fRotX;
                PlayerInfo[playerid][pObleka1ry] = fRotY;
                PlayerInfo[playerid][pObleka1rz] = fRotZ;
                PlayerInfo[playerid][pObleka1sx] = fScaleX;
                PlayerInfo[playerid][pObleka1sy] = fScaleY;
                PlayerInfo[playerid][pObleka1sz] = fScaleZ;
                RemovePlayerAttachedObject(playerid, 1);
                SetPlayerAttachedObject(playerid, 1, modelid, 2, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
                OnPlayerUpdateCustom(playerid);
                return 1;
            }
        }
    }
    return 1;
}



//Saving
public OnPlayerUpdateCustom(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid])
        {
            new string3[64];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "Tomato Roleplay/Igraci/%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
                format(var, 64, "Obleka1=%d\n",PlayerInfo[playerid][pObleka1]);fwrite(hFile, var);
                format(var, 64, "Obleka1x=%f\n",PlayerInfo[playerid][pObleka1x]);fwrite(hFile, var);
                format(var, 64, "Obleka1y=%f\n",PlayerInfo[playerid][pObleka1y]);fwrite(hFile, var);
                format(var, 64, "Obleka1z=%f\n",PlayerInfo[playerid][pObleka1z]);fwrite(hFile, var);
                format(var, 64, "Obleka1rx=%f\n",PlayerInfo[playerid][pObleka1rx]);fwrite(hFile, var);
                format(var, 64, "Obleka1ry=%f\n",PlayerInfo[playerid][pObleka1ry]);fwrite(hFile, var);
                format(var, 64, "Obleka1rz=%f\n",PlayerInfo[playerid][pObleka1rz]);fwrite(hFile, var);
                format(var, 64, "Obleka1sx=%f\n",PlayerInfo[playerid][pObleka1sx]);fwrite(hFile, var);
                format(var, 64, "Obleka1sy=%f\n",PlayerInfo[playerid][pObleka1sy]);fwrite(hFile, var);
                format(var, 64, "Obleka1sz=%f\n",PlayerInfo[playerid][pObleka1sz]);fwrite(hFile, var);
            }
        }
    }
    return 1;
}


//On login (when you spawn)
public SetPlayerSpawn(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        SetPlayerSkin(playerid, PlayerInfo[playerid][pChar]);
        if(PlayerInfo[playerid][pObleka1] != 0)
        {
            RemovePlayerAttachedObject(playerid, 1);
            SetPlayerAttachedObject(playerid, 1, PlayerInfo[playerid][pObleka1], 2, PlayerInfo[playerid][pObleka1x], PlayerInfo[playerid][pObleka1y], PlayerInfo[playerid][pObleka1z], PlayerInfo[playerid][pObleka1rx], PlayerInfo[playerid][pObleka1ry], PlayerInfo[playerid][pObleka1rz], PlayerInfo[playerid][pObleka1sx], PlayerInfo[playerid][pObleka1sy], PlayerInfo[playerid][pObleka1sz]);
        }
    }
}
Reply
#2

Maybe set the glasses to set in the head by default
Reply
#3

Код:
SetPlayerAttachedObject(playerid, 1, modelid, 2, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
The number "2" is the bone (head) but something is wrong with the position savers... When i edit the object in-game and go to my .ini file in scriptfiles than the coordinates are 0.00000 for rotation and 1.200000 for scale
Reply
#4

This is my .ini file
pawn Код:
Obleka1=18939  // object id
Obleka1x=0.000000 // OffsetX
Obleka1y=0.000000 // OffsetY
Obleka1z=0.000000 // OffsetZ
Obleka1rx=0.000000 // fRotX
Obleka1ry=0.000000 // fRotY
Obleka1rz=0.000000 // fRotZ
Obleka1sx=1.000000 // fScaleX
Obleka1sy=1.000000 // fScaleY
Obleka1sz=1.000000 // fScaleZ
This are definitely not the coordinates when i edited the object in-game
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)