If object is edited
#1

I got command for choose object and edit with EditObject function, and another command for delete object. Now, i want to make delete command current editing object, how can I check that?

Any function like IsPlayerEditingObject?
Reply
#2

you could create a bool var & set it to true for the player whenever you use EditObject,
then set it to false once OnPlayerEditObject gets called.

i'd hook EditObject and put it in there, just like this
(im hooking it so that you have to set it to true just once instead of everytime you use that function)
pawn Code:
new bool:IsEditingObject[MAX_PLAYERS];

EditObjectNEW(playerid, objectid)
{
    IsEditingObject[playerid] = true;
    return EditObject(playerid, objectid);
}
#if defined _ALS_EditObject
    #undef EditObject
#else
    #define _ALS_EditObject
#endif
#define EditObject EditObjectNEW


public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
    IsEditingObject[playerid] = false;
    return 1;
}

YCMD:editobj(playerid, params[], help)
{
    SetPlayerPos(playerid,0,0,3.5);
    new ob = CreateObject(18053,0,0,0,0,0,0);
    EditObject(playerid,ob);
    return 1;
}

YCMD:checkedit(playerid, params[], help)
{
    if(IsEditingObject[playerid]) GameTextForPlayer(playerid,"~g~Editing!",3000,3);
        else GameTextForPlayer(playerid,"~r~Not editing!",3000,3);
    return 1;
}
so when you do /editobj you're editing an object. then do /checkedit and it will say "Editing!"
cancle the editor and do /checkedit again and it will say "Not editing!"
tested & works. you could use this as a "work around" - solution thingy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)