/*
Easy Object Moving by Jochemd
This is just an easy include. Use it if you think it could you save you some time
Jochem
*/
new ObjectMoving[MAX_OBJECTS];
/* Hook the OnObjectMoved callback in your main script */
#if defined _ALS_OnObjectMoved
#undef OnObjectMoved
#else
#define _ALS_OnObjectMoved
#endif
#define OnObjectMoved jOnObjectMoved
#define MoveObject jMoveObject
#define StopObject jStopObject
forward jOnObjectMoved(objectid);
/* It will be automatically called now. Do not edit this above. */
/* Easy stocks. A variable gets set to 1 whenever the object starts moving. Once it stops moving, it gets set back to 0.*/
stock jMoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0)
{
if(IsObjectMoving(objectid)) StopObject(objectid);
ObjectMoving[objectid] = 1;
return MoveObject(objectid, X, Y, Z, Speed, RotX, RotY, RotZ);
}
stock jStopObject(objectid)
{
if(IsObjectMoving(objectid))
{
StopObject(objectid);
return 1;
}
else return 0;
}
stock IsObjectMoving(objectid)
{
return ObjectMoving[objectid];
}
public jOnObjectMoved(objectid)
{
ObjectMoving[objectid] = 0;
return 1;
}
CMD:objectmoving(playerid,params[])
{
new objectid = strval(params);
if(IsObjectMoving(objectid)) SendClientMessage(playerid,-1,"The Object ID you entered is currently moving.");
else SendClientMessage(playerid,-1,"The Object ID you entered is currently NOT moving.");
return 1;
}
stock jMoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0)
{
if(IsObjectMoving(objectid)) StopObject(objectid);
ObjectMoving[objectid] = 1;
return jMoveObject(objectid, X, Y, Z, Speed, RotX, RotY, RotZ);
}
The defines must be AFTER the functions.
Why? Take a look at this: pawn Код:
|