Pick up an object.
#1

How can you pick up an object? I made a command where you spawn a crate, and I'm trying to figure out how to pick it up and walk around with it with a proper animation.
Reply
#2

See SetPlayerAttachedObject
https://sampwiki.blast.hk/wiki/SetPlayerAttachedObject
Reply
#3

You could do it like this:
When you drop/spawn the object, add it in a variable.
e.g. Item[i] = CreateDynamicObject(objectid, X, Y, Z,0,0,0, world);

ApplyAnimation(playerid,"CARRY","crry_prtial",4.0, 1,0,0,1,1,1);
SetPlayerAttachedObject(playerid, 2, objectid,3,0.13,-0.32,-0.26,0.0,0.0,0.0,1.00,1.00,1.00);
DestroyDynamicObject(Item[i]);
Reply
#4

Store the information in an array (coordinates, the object model, and anything else you may need) in order to contain it and work on it from there by checking if the player is at the object's coordinates then execute accordingly. If you're not very familiar with the Scripting Functions you can see a full list here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)