Object won't attach to player
#1

Well, on my dialog response, instead of attaching an object to player, nothing happens. The dialog just closes down.

pawn Код:
if(dialogid == 73)
    {
        if(!response) return 1;
        ObjectBoneSelection[playerid] = listitem + 1;

        if(PlayerInfo[playerid][pDonator] < 1)
        {
            if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
           
            if(ObjectSlotSelection[playerid] == 0)
            {
                 SetPlayerAttachedObject(playerid, 9, PlayerInfo[playerid][pObject1], ObjectBoneSelection[playerid]);
                 EditAttachedObject(playerid, 9);
                 return 1;
            }
            if(ObjectSlotSelection[playerid] == 1)
            {
                 SetPlayerAttachedObject(playerid, 9, PlayerInfo[playerid][pObject2], ObjectBoneSelection[playerid]);
                 EditAttachedObject(playerid, 9);
                 return 1;
            }
            if(ObjectSlotSelection[playerid] == 2)
            {
                 SetPlayerAttachedObject(playerid, 9, PlayerInfo[playerid][pObject3], ObjectBoneSelection[playerid]);
                 EditAttachedObject(playerid, 9);
                 return 1;
            }
            if(ObjectSlotSelection[playerid] == 3)
            {
                 SetPlayerAttachedObject(playerid, 9, PlayerInfo[playerid][pObject4], ObjectBoneSelection[playerid]);
                 EditAttachedObject(playerid, 9);
                 return 1;
            }
            if(ObjectSlotSelection[playerid] == 4)
            {
                 SetPlayerAttachedObject(playerid, 9, PlayerInfo[playerid][pObject5], ObjectBoneSelection[playerid]);
                 EditAttachedObject(playerid, 9);
                 return 1;
            }
        }
    }


This is the dialog that sets ObjectSlotSelection variable
pawn Код:
if(dialogid == 72)
    {
        if(!response) return 1;
        if(listitem == 0 && PlayerInfo[playerid][pObject1] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That slot is emtpy.");
        if(listitem == 1 && PlayerInfo[playerid][pObject2] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That slot is emtpy.");
        if(listitem == 2 && PlayerInfo[playerid][pObject3] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That slot is emtpy.");
        if(listitem == 3 && PlayerInfo[playerid][pObject4] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That slot is emtpy.");
        if(listitem == 4 && PlayerInfo[playerid][pObject5] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That slot is emtpy.");
   
        ObjectSlotSelection[playerid] = listitem;
        new msgstr2[1024];
        for(new x;x<sizeof(AttachmentBones);x++)
        {
            format(msgstr2, sizeof(msgstr2), "%s%s\n", msgstr2, AttachmentBones[x]);
        }
        ShowPlayerDialog(playerid, 73, DIALOG_STYLE_LIST, \
        "{FF0000}Bone Selection", msgstr2, "Select", "Cancel");
        return 1;
   
    }
Reply
#2

these are the arguments for SetPlayerAttachedObject

pawn Код:
(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ, materialcolor1, materialcolor2)
one problem is you use the index of 9 in every one no matter what your slot is.
another is you provide no offsets, i would start with all the offsets at 0.0
Reply
#3

/rcon login YourPassword
/rcon loadfs attachments

This will help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)