Do something if object arrives at destination
#1

How can I make something happen when the moveobject has arrived its position?
Reply
#2

pawn Код:
public OnObjectMoved(objectid)
{

    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}
https://sampwiki.blast.hk/wiki/OnObjectMoved
Reply
#3

Quote:
Originally Posted by ScRaT
Посмотреть сообщение
pawn Код:
public OnObjectMoved(objectid)
{

    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}
https://sampwiki.blast.hk/wiki/OnObjectMoved
Yeah but i have it like this
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/firework", cmdtext, true, 10) == 0)
	{
	    new blabla;
        new Float:pX, Float:pY, Float:pZ;
  		GetPlayerPos(playerid, pX, pY, pZ);
  		blabla = CreateObject(2918, pX, pY, pZ, 0.0, 0.0, 100.0);
  		MoveObject(firework, pX, pY, pZ + 20, 8.00);
  		SendClientMessage(playerid, -1, "{3EFAF7}k.");
  		return 1;
	}
	return 0;
}

public OnObjectMoved(objectid)
{
    // Won't work since its a private variable
    return 1;
}
Reply
#4

pawn Код:
// global variable
new
    firework
;

// OnPlayerCommandText Callback: /firework (NOTE: its lenght is 9, not 10)
firework= CreateObject(..);
MoveObject(firework, ..);

public OnObjectMoved(objectid)
{
    if(objectid == firework)
    {
        // Do something
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)