12.10.2011, 18:46
Hello,
I made a very easy include which could save you some work changing your script. As you know, you have to stop the object first to make it move from it's current spot. You don't have to do it anymore with this easy include.
Since the script is only 50 lines long, I'll not use Pastebin or anything related.
Usage: Including is enough. You don't have to do anything else.
I've also included a "IsObjectMoving" into it.
I hope this comes useful for people who can't script it themselfs. It's actually pretty easy to make.
Jochem
Due to lack of GTA I couldn't test this script - I am not sure if it's working, but I think it is. If not, excuse me and I'll fix it.
I made a very easy include which could save you some work changing your script. As you know, you have to stop the object first to make it move from it's current spot. You don't have to do it anymore with this easy include.
Since the script is only 50 lines long, I'll not use Pastebin or anything related.
Usage: Including is enough. You don't have to do anything else.
pawn Код:
/*
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;
}
pawn Код:
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;
}
Jochem
Due to lack of GTA I couldn't test this script - I am not sure if it's working, but I think it is. If not, excuse me and I'll fix it.