13.04.2016, 00:19
Is it possible to disable AttachObjectToPlayer without DestroyObject ?
What do you even mean exactly? Detach from the player and do what with the object?
|
Well in that case, your right..
-> Create object -> Attach to Player -> Delete object ( Before deleting, GetObjectPos & GetObjectRot ) -> Create new object ( Use coords & rotation which have stored use those 2 functions) Thank you for being so observant |
Wants it to detatch...
As in walk somewhere with it attached, then when he "detaches" for the object to stay there... C'mon... You've been doing so well in answering all those threads (I been seeing) then this? Make a function, doing what I said... GetObjectPos GetObjectRot, then DeleteObject, and CreateObject. Just so it appears to stay in the same spot. Could do CreateObject then DeleteObject so it visually doesn't glitch. |
else if(!strcmp(params, "stop", true))
{
new Float:X, Float:Y, Float:Z, Float:RX, Float:RY, Float:RZ;
if(!UsingStretcher[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not using any stretcher.");
if(!MovingStretcher[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not moving your stretcher.");
MovingStretcher[playerid] = 0;
GetObjectPos(StretcherObj[playerid], X, Y, Z);
GetObjectRot(StretcherObj[playerid], RX, RY, RZ);
DestroyObject(StretcherObj[playerid]);
StretcherObj[playerid] = CreateObject(2146, X, Y, Z, RX, RY, RZ, 100.0);
SendClientMessage(playerid, COLOR_LIGHTRED, "You have stopped moving your stretcher.");
return 1;
}
StretcherObj[playerid] = CreateObject(2146, X, Y, Z, RX, RY, RZ);
DrawDistance is optional, try without it:
Code:
StretcherObj[playerid] = CreateObject(2146, X, Y, Z, RX, RY, RZ); |
GetPlayerPos(playerid, X, Y, Z);
GetObjectRot(StretcherObj[playerid], RX, RY, RZ);
DestroyObject(StretcherObj[playerid]);
X -= 1.00; Z -= 0.50;
StretcherObj[playerid] = CreateObject(2146, X, Y, Z, RX, RY, RZ, 100.0);
There should be a way of doing this, maybe you should use a blank script, and test a heap to see how you can make this work. Another maybe, to not attach the object to the player, but have the object follow the player using MoveObject and use GetPlayerPos, GetPlayerVelocity and all those bits.
You've got a good plan, and it has been done before, but yea, it's going to take some tweaking. |