• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Actor weapon
#11
sorry my dumb...

ty so much to try to help, a lot people can use this :)



on position 0 is under floor...





result of /actorweapon -> OnPlayerEditDynamicObject

Code:
created [15:21:57] x[-29.020599] y[-186.818206] z[1003.546875] RotX[0] RotY[0] RotZ[0] a[%f]

moved [15:23:45] x[-28.945550] y[-186.275421] z[1003.882324] rx[0.000000] ry[-3.300002] rz[98.899940]

how should be /test?





Code:
CMD:test(playerid) {

    new Float:offset_x = object_x;

    new Float:offset_y = object_y;

    new Float:offset_z = object_z - actor_z;

    new Float:rx = object_rx;

    new Float:ry = object_ry;

    new Float:rz = object_rz;

    new actorid = 1001;

    new gunid = 24;

    CreateDynamicActorWeapon(actorid,gunid,offset_x,offset_y,offset_z,rx,ry,rz);

    return true;

}





Code:
CMD:actorweapon(playerid, params[]) {

    new actorid; // 1001 = primeiro npc

    if(sscanf(params,"i", actorid)) return SendClientMessage(playerid, -1, "Use: /actorweapon [actorid]");

    if(IsValidDynamicActor(actorid)) {

        ApplyDynamicActorAnimation(actorid, "PED","ARRESTgun", 4.1, 0, 0, 0, 1, 0);

        new Float:x, Float:y, Float:z, Float:a;

        GetDynamicActorPos(actorid, x, y, z);

        GetDynamicActorFacingAngle(actorid, a);

        new string[128];

        format(string, sizeof(string), "[ACTOR POS] x[%f] y[%f] z[%f] RotX[0] RotY[0] RotZ[0] a[%f]", x, y, z, a);

        SendClientMessage(playerid, COLOR_GREY, string);

        if(IsValidDynamicObject(EditingDynamicObjectID[playerid])) { DestroyDynamicObject(EditingDynamicObjectID[playerid]); }

        new weaponobj = CreateDynamicObject(GetGunObjectID(24), x, y, z, 0.0, 0.0, 0.0);

        EditingDynamicObjectID[playerid] = weaponobj;

        EditDynamicObject(playerid, EditingDynamicObjectID[playerid]);

    }

    return 1;

}



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

{

    if(response == EDIT_RESPONSE_FINAL || response == EDIT_RESPONSE_CANCEL)

    {

        new string[128];

        format(string, sizeof(string), "x[%f] y[%f] z[%f] rx[%f] ry[%f] rz[%f]", x, y, z, rx, ry, rz );

        SendClientMessage(playerid, COLOR_GREY, string);

    }

}
  Reply


Messages In This Thread
Actor weapon - by annety - 2021-03-07, 02:30 PM
RE: Actor weapon - by Virsenas - 2021-03-07, 02:34 PM
RE: Actor weapon - by Y_Less - 2021-03-07, 04:28 PM
RE: Actor weapon - by annety - 2021-03-08, 01:16 AM
RE: Actor weapon - by Y_Less - 2021-03-10, 02:06 AM
RE: Actor weapon - by Radical - 2021-03-10, 10:38 AM
RE: Actor weapon - by annety - 2021-03-21, 06:47 PM
RE: Actor weapon - by annety - 2021-04-20, 06:22 AM
RE: Actor weapon - by AbyssMorgan - 2021-04-20, 02:53 PM
RE: Actor weapon - by annety - 2021-04-21, 07:19 AM
RE: Actor weapon - by annety - 2021-04-26, 08:30 AM
RE: Actor weapon - by AbyssMorgan - 2021-04-27, 03:05 PM

Forum Jump: