SA-MP Forums Archive
Moving object problem - 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: Moving object problem (/showthread.php?tid=431770)



Moving object problem - Ananisiki - 19.04.2013

Objects not moving for other players..

pawn Код:
forward OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
pawn Код:
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
    if(response == EDIT_RESPONSE_FINAL)
    {
        MoveDynamicObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
    }
    if(response == EDIT_RESPONSE_UPDATE)
    {
        MoveDynamicObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
    }
    return 1;
}
pawn Код:
dcmd_addobject(playerid, params[])
{
    if(!IsPlayerLAdmin(playerid)) return 0;
    new objectid;
    if(sscanf(params, "d", objectid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /addobject (Object ID)");
    if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
    if(objectid >= 20000) return SendClientMessage(playerid, COLOR_RED, "Invalid Object ID.");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    PlayerObjectCount[playerid]++;
    PlayerObject[playerid][PlayerObjectCount[playerid]] = CreateDynamicObject(objectid, x + 6, y + 6, z + 0.5, 0.0, 0.0, 96.0);
    new string[128];
    format(string, sizeof string, "You Have Spawned Object ID %d. Editing ID %d.", objectid, PlayerObjectCount[playerid]);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    return 1;
}

dcmd_editobject(playerid, params[])
{
    if(!IsPlayerLAdmin(playerid)) return 0;
    new objectid;
    if(sscanf(params, "d", objectid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /editobject (Object Editing ID)");
    if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
    if(IsSpecing[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
    if(PlayerObjectCount[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Invalid Object Editing ID.");
    if(!IsValidDynamicObject(PlayerObject[playerid][objectid]) || objectid < 1) return SendClientMessage(playerid, COLOR_RED, "Invalid Object Editing ID.");
    if(IsPlayerEditingObject[playerid] == 1) CancelEdit(playerid);
    else IsPlayerEditingObject[playerid] = 1;
    EditDynamicObject(playerid, PlayerObject[playerid][objectid]);
    return 1;
}



Re: Moving object problem - Ananisiki - 19.04.2013

really need help with this..


Re: Moving object problem - Pottus - 19.04.2013

I don't think what your doing is a good idea, don't move the object set the position of the object on update that is the proper way.


Re: Moving object problem - Ananisiki - 25.04.2013

Bump


Re: Moving object problem - MP2 - 25.04.2013

You're using the native callback. You need to use the streamer's callback.

pawn Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)



Re: Moving object problem - Ananisiki - 25.04.2013

pawn Код:
(3247) : error 017: undefined symbol "fX"
(3251) : error 017: undefined symbol "fX"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
    if(response == EDIT_RESPONSE_FINAL)
    {
        MoveDynamicObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
    }
    if(response == EDIT_RESPONSE_UPDATE)
    {
        MoveDynamicObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
    }
    return 1;
}



Re: Moving object problem - MP2 - 25.04.2013

Look at the parameters in the callback; they don't match.


Re: Moving object problem - Ananisiki - 25.04.2013

Should it be like this?

pawn Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
    if(response == EDIT_RESPONSE_FINAL)
    {
        MoveDynamicObject(objectid, x, y, z, 10.0, rx, ry, rz);
    }
    if(response == EDIT_RESPONSE_UPDATE)
    {
        MoveDynamicObject(objectid, x, y, z, 10.0, rx, ry, rz);
    }
    return 1;
}



Re: Moving object problem - Pottus - 25.04.2013

Why are you still trying to do this? Didn't I mention this is a bad idea it won't work as expected and will be glitchy set the position instead of moving the object in a donkey ass fancy schmancy way that is completely silly.


Re: Moving object problem - MP2 - 25.04.2013

Pottus is right. It can become glitchy if you use MoveObject.