SA-MP Forums Archive
Object position updating to all players? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object position updating to all players? (/showthread.php?tid=577399)



Object position updating to all players? - Metharon - 11.06.2015

Ok , so if i edit my position of object , it get edited.


But all others player don't see the new position..
Example:

Me:

http://i.imgur.com/ttituIK.jpg


Players:

http://i.imgur.com/tWfP3bO.jpg



How i can update the object position for players?


Code:

pawn Код:
//Attaching
                SetPlayerAttachedObject(playerid, 3,19559 .. etc
                PlayerInfo[playerid][pBody] = 19559;
                GetPlayerPos(playerid, x,y,z);
                PlayerPlaySound(playerid, 1055, x,y,z);
                PlayerInfo[playerid][pBodyx] = 0;
                PlayerInfo[playerid][pBodyy] = 0;
                PlayerInfo[playerid][pBodyz] = 0;
                PlayerInfo[playerid][pBodya] = 0;
                PlayerInfo[playerid][pBodyb] = 0;
                PlayerInfo[playerid][pBodyc] = 0;
                PlayerInfo[playerid][pBodyq] = 0;
                PlayerInfo[playerid][pBodyw] = 0;
                PlayerInfo[playerid][pBodye] = 0;
//
pawn Код:
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)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{DC0C0C}(Atasare obiecte) {FF6633} obiectele atasate au fost salvate.");
        if(IsEditingHead[playerid] == 1)
        {
            PlayerInfo[playerid][pHeadx] = fOffsetX;
            PlayerInfo[playerid][pHeady] = fOffsetY;
            PlayerInfo[playerid][pHeadz] = fOffsetZ;
            PlayerInfo[playerid][pHeada] = fRotX;
            PlayerInfo[playerid][pHeadb] = fRotY;
            PlayerInfo[playerid][pHeadc] = fRotZ;
            PlayerInfo[playerid][pHeadq] = fScaleX;
            PlayerInfo[playerid][pHeadw] = fScaleY;
            PlayerInfo[playerid][pHeade] = fScaleZ;
            IsEditingHead[playerid] = 0;

        }
        else if(IsEditingFace[playerid] == 1)
        {
            PlayerInfo[playerid][pFacex] = fOffsetX;
            PlayerInfo[playerid][pFacey] = fOffsetY;
            PlayerInfo[playerid][pFacez] = fOffsetZ;
            PlayerInfo[playerid][pFacea] = fRotX;
            PlayerInfo[playerid][pFaceb] = fRotY;
            PlayerInfo[playerid][pFacec] = fRotZ;
            PlayerInfo[playerid][pFaceq] = fScaleX;
            PlayerInfo[playerid][pFacew] = fScaleY;
            PlayerInfo[playerid][pFacee] = fScaleZ;
            IsEditingFace[playerid] = 0;
        }
        else if(IsEditingBody[playerid] == 1)
        {

            PlayerInfo[playerid][pBodyx] = fOffsetX;
            PlayerInfo[playerid][pBodyy] = fOffsetY;
            PlayerInfo[playerid][pBodyz] = fOffsetZ;
            PlayerInfo[playerid][pBodya] = fRotX;
            PlayerInfo[playerid][pBodyb] = fRotY;
            PlayerInfo[playerid][pBodyc] = fRotZ;
            PlayerInfo[playerid][pBodyq] = fScaleX;
            PlayerInfo[playerid][pBodyw] = fScaleY;
            PlayerInfo[playerid][pBodye] = fScaleZ;
            IsEditingBody[playerid] = 0;
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "failed");
        }
    }
    else
    {
            SendClientMessage(playerid, COLOR_LIGHTRED, "failed");
    }
    return 1;
}



Re: Object position updating to all players? - Vince - 11.06.2015

You need to reattach with the updated positions when the player finishes editing.