question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: question (
/showthread.php?tid=188592)
question -
iJumbo - 08.11.2010
hi .. i have a question..
its possibile do this functions (OnObjectStopMoving) ?? thx
Re: question -
iggy1 - 08.11.2010
Heres something i wrote (some from wiki) should work. Unless i missed something
pawn Код:
forward OnObjectStopMoving(objectid);//forward the timer
public OnPlayerCommandText(playerid, cmdtext[])//from the wiki
{
if(strcmp(cmdtext, "/moveobject", true) == 0)
{
new string[50];
new movetime = MoveObject(obj, 0, 0, 10, 2.00);
format(string, sizeof(string), "Object will finish moving in %d milliseconds", movetime);
SendClientMessage(playerid, 0xFF000000, string);
SetTimerEx("OnObjectStopMoving", movetime, false, "i", objectid);// swap objectid for your gate/moving objects id
return 1;
}
return 0;
}
public OnObjectStopMoving(objectid)//this is called when the object stops moving
{
//do something with your object id here
return 1;
}
Re: question -
HireMe - 08.11.2010
I am not the best scripter but i thought about something like this
pawn Код:
#include <a_samp>
new OldMove;
new NewMove;
new ObjectMoving;
forward isobjectmoving(Objectid);
forward OnObjectStopMoving(Objectid);
public OnFilterScriptInit()
{
OldMove = 0;
NewMove = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/moveobject", cmdtext, true) == 0)
{
// here you put something like new ObjectId;
// place something to check the ID for it;
ObjectMoving = SetTimer("isobjectmoving", 3000, 1); // this is a loop that repeats every 3 sec
return 1;
}
return 0;
}
public isobjectmoving(Objectid)
{
// here you put something to check if a object is moving something like NewMove = CheckObjectPosition(Objectid)
if(NewMove == OldMove)
{
KillTimer(ObjectMoving);
OnObjectStopMoving(Objectid);
return 1;
}
else
{
OldMove = NewMove;
}
return 1;
}
public OnObjectStopMoving(Objectid)
{
// your stuff here
return 1;
}
Re: question -
Bessensap - 08.11.2010
There's a callback called OnObjectMoved....
Re: question -
iggy1 - 08.11.2010
Quote:
Originally Posted by Bessensap
There's a callback called OnObjectMoved....
|
Lol i'm always missing callbacks and functions, i spent about 25min the other day making a function to return the name of a weapon.... Then i found "GetWeaponName" proper facepalm moment.
Re: question -
iJumbo - 08.11.2010
thx all xD