12.07.2016, 18:40
Quote:
Hi, i'm trying to make a basic drop/loot system with ColAndreas and this include. I used Peppe's example to make a function that creates an onbject to throw. If I use the function CreateObject (native) it works perfectly, but if use the streamer of ColAndreas or Incognito's streamer the object spawns, but it doesn't move. I need to use streamer due to objects limit. Any solution?
Код:
public DropInventoryItem(playerid, modelid) { #define SPEED (10.0) #define Z_SPEED (4.0) #define GRAVITY (13.0) new Float:posx, Float:posy, Float:posz, Float:posa; GetPlayerPos(playerid, posx, posy, posz); GetPlayerFacingAngle(playerid, posa); Streamer_Update(playerid); new obj = CA_CreateDynamicObject_DC(modelid, posx, posy - 0.5 * floatcos(-(posa + 90.0), degrees), posz, 93.7, 120.0, posa + 60.0, -1, -1, -1, 300.0, 300.0); PHY_InitObject(); PHY_UseColAndreas(obj, 1); PHY_SetObjectVelocity(obj, SPEED * floatsin(-posa, degrees), SPEED * floatcos(-posa, degrees), Z_SPEED); PHY_SetObjectFriction(obj, 100); PHY_SetObjectGravity(obj, GRAVITY); ApplyAnimation(playerid, "GRENADE", "WEAPON_throwu", 3.0, 0, 0, 0, 0, 0); return 1; } |
Use CreateObject.
Activate it's physics.
Wait for the world collided callback.
Get the objects information and add the drop.
Add the streamer object.
Destroy the object.
Deactivate it's physics.