question
#1

hi .. i have a question..
its possibile do this functions (OnObjectStopMoving) ?? thx
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

There's a callback called OnObjectMoved....
Reply
#5

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.
Reply
#6

thx all xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)