Object - Please help!
#4

what I did once is this:

pawn Код:
new objectident;

CMD:co(playerid, params[])
{
    new str1[128];
    if(sscanf(params, "d", objectident)) return SendClientMessage(playerid, -1, "USAGE: /co [object id]");
    else
    {
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        objectident = CreateObject(objectident,x,y+3,z,0,0,0);
        EditObject(playerid, objectident);
        format(str1,sizeof(str1),"You Have Created Object %d.", objectident);
        SendClientMessage(playerid, -1, str1);
    }
    return 1;
}

CMD:eo(playerid, params[])
{
    new str1[128];
    if(sscanf(params, "d", objectident)) return SendClientMessage(playerid, -1, "USAGE: /eo [object id]");
    if(!IsValidObject(objectident)) return SendClientMessage(playerid,-1,"This Object Does Not Exist.");
    else
    {
        format(str1,sizeof(str1),"You Are Now Editing Object %d.", objectident);
        SendClientMessage(playerid, -1, str1);
        EditObject(playerid, objectident);
    }
    return 1;
}

CMD:do(playerid, params[])
{
    new str1[128];
    if(sscanf(params, "d", objectident)) return SendClientMessage(playerid, -1, "USAGE: /do [object id]");
    if(!IsValidObject(objectident)) return SendClientMessage(playerid,-1,"This Object Does Not Exist.");
    else
    {
        format(str1,sizeof(str1),"You Have Deleted Object %d.", objectident);
        SendClientMessage(playerid, -1, str1);
        DestroyObject(objectident);
    }
    return 1;
}

public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
    new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ;
    GetObjectPos(objectident, oldX, oldY, oldZ);
    GetObjectRot(objectident, oldRotX, oldRotY, oldRotZ);
    if(!playerobject)
    {
        if(!IsValidObject(objectident)) return 1;
        SetObjectPos(objectident, fX, fY, fZ);
        SetObjectRot(objectident, fRotX, fRotY, fRotZ);
    }

    if(response == EDIT_RESPONSE_FINAL)
    {
        if(!IsValidObject(objectident)) return 1;
        SetObjectPos(objectident, fX, fY, fZ);
        SetObjectRot(objectident, fRotX, fRotY, fRotZ);
    }

    if(response == EDIT_RESPONSE_CANCEL)
    {
        if(!playerobject)
        {
            SetObjectPos(objectident, oldX, oldY, oldZ);
            SetObjectRot(objectident, oldRotX, oldRotY, oldRotZ);
        }
        else
        {
            SetPlayerObjectPos(playerid, objectident, oldX, oldY, oldZ);
            SetPlayerObjectRot(playerid, objectident, oldRotX, oldRotY, oldRotZ);
        }
    }
    return 1;
}
This happened to return the object id and not the model id. It tells you the object identification number used to delete it.
Reply


Messages In This Thread
Object - Please help! - by NickHaudMTA - 24.11.2014, 20:28
Re: Object - Please help! - by NickHaudMTA - 24.11.2014, 22:45
Re: Object - Please help! - by Wingman - 25.11.2014, 02:59
Re: Object - Please help! - by Banana_Ghost - 25.11.2014, 03:16
Re: Object - Please help! - by PinkFloydLover - 25.11.2014, 03:18
Re: Object - Please help! - by NickHaudMTA - 25.11.2014, 13:46

Forum Jump:


Users browsing this thread: 1 Guest(s)