20.03.2009, 15:43
How to make gate, waht will open by a cmd, but closes automatically after 5 seconds?
//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;
}
Originally Posted by Castle
read the SetTimer("objTimer, 5000, false);
as you might see there is a Forward and Call back READ it! |