OnPlayerSelectObject
#1

When doing OnPlayerSelectObject, than making it call the EditObject, it doesnt show the object moving for any player besides the player editing. Even after clicking save.
Code im using (from samp wiki)
And im adding this into GarObject so theyre might be an issue with that

UPDATED CODE: STILL NOT WORKING
pawn Код:
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
    new o = Objects[playerid][objectid];
    new Float:oX, Float:oY, Float:oZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ, Float:rX, Float:rY, Float:rZ;
    GetObjectPos(o, oX, oY, oZ);
    GetObjectRot(o, oldRotX, oldRotY, oldRotZ);
    if(ObjectCreator[Objects[playerid][objectid]] == playerid)
    {
        if(!playerobject) // If this is a global object, move it for other players
        {
            if(!IsValidObject(objectid)) return;
            GetObjectPos(o, X, Y, Z);
            SetObjectPos(o, X, Y, Z);
        }

        if(response == EDIT_RESPONSE_FINAL)
        {
            // The player clicked on the save icon
            // Do anything here to save the updated object position (and rotation)
            GetObjectPos(o, X, Y, Z);
            SetObjectPos(o, X, Y, Z);
            SetObjectRot(o, rX, rY, rZ);
        }

        if(response == EDIT_RESPONSE_CANCEL)
        {
            //The player cancelled, so put the object back to it's old position
            if(!playerobject) //Object is not a playerobject
            {
                SetObjectPos(o, oX, oY, oZ);
                SetObjectRot(o, oldRotX, oldRotY, oldRotZ);
            }
            else
            {
                SetPlayerObjectPos(playerid, o, oX, oY, oZ);
                SetPlayerObjectRot(playerid, o, oldRotX, oldRotY, oldRotZ);
            }
        }
    }
}
public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
    if(type == SELECT_OBJECT_GLOBAL_OBJECT)
    {
        EditObject(playerid, objectid);
    }
    else
    {
        EditPlayerObject(playerid, objectid);
    }
    return 1;
}
pawn Код:
dcmd_select(playerid, params[])
{
    #pragma unused params
    new objectid;
    if(ObjectCreator[Objects[playerid][objectid]] == playerid)
    {
        SelectObject(playerid);
    }
    else
    {
        SendClientMessage(playerid, COLOUR_SYSTEM, "This isnt your object!");
        return 0;
    }
    return 1;
}
Reply
#2

Why don't you return a value to the command?
Reply
#3

I haven't used these functions yet myself, but I believe that you must confirm the new object's position by using SetObjectPos in OnPlayerEditObject.
Reply
#4

Quote:
Originally Posted by vassilis
Посмотреть сообщение
Why don't you return a value to the command?
Quote:

This callback does not handle returns.

Quote:
Originally Posted by Vince
Посмотреть сообщение
I haven't used these functions yet myself, but I believe that you must confirm the new object's position by using SetObjectPos in OnPlayerEditObject.
Hmm, i will try that. Thanks
Reply
#5

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
Hmm, i will try that. Thanks
I am talking for the cmd not for the callback..
But anyway what Vince said might be right..
Reply
#6

Quote:
Originally Posted by vassilis
Посмотреть сообщение
I am talking for the cmd not for the callback..
But anyway what Vince said might be right..
Oh haha, didnt catch that thanks.. But its not the problem
Still havnt tested it yet
Reply
#7

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
Oh haha, didnt catch that thanks.. But its not the problem
Still havnt tested it yet
Oh lol, it's ok but anyway commands should always return a value just to let you know
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
I haven't used these functions yet myself, but I believe that you must confirm the new object's position by using SetObjectPos in OnPlayerEditObject.
Look at my new code!
Reply
#9

bump
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)