2021-04-26, 08:30 AM
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
how should be /test?
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);
}
}