Gate automatically closes
#1

How to make gate, waht will open by a cmd, but closes automatically after 5 seconds?
Reply
#2

here is an Example:
pawn Код:
//Top of script
forward objTimer();
new obj, objstatus = 1;


public OnGameModeInit()
{
    obj = CreateObject(objid, X, Y, Z, rX, rY, rZ);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/gate", true) == 0)
    {
        if(objstatus = 1)
        {
            MoveObject(obj, newX, newY, newZ);
            objstatus = 0;
        }
        SetTimer("objTimer", 5000, false);//5000 = 5 seconds
        return 1;
    }
    return 1;
}

public objTimer()
{
    if(objstatus == 0)
    {
        MoveObject(objID, oldX, oldY, oldZ);
        objstatus = 1;
    }
    return 1;
}
This should work, Hope you under stand this

newX/Y/Z = where to move
oldX/Y/Z = Original location to move back the opbject
Reply
#3

and, how this will make gate close automatically
Which line?
Reply
#4

read the SetTimer("objTimer, 5000, false);
as you might see there is a Forward and Call back READ it!
Reply
#5

Quote:
Originally Posted by Castle
read the SetTimer("objTimer, 5000, false);
as you might see there is a Forward and Call back READ it!
Thanks man, Firstly i saw the tiny part of yout script, sorry about that.
Reply
#6

when i was writing the code i pressed 'submit' by mistake so i edited
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)