29.07.2010, 18:01
Well here is an example on how to check the player's position and how to move the objects one by one (Will not compile):
pawn Код:
new bankObjects[6]; //6 Pillars
new bankCheck[MAX_PLAYERS]; //Timer
public OnFilterScriptInit()
{
bankObjects[0] = CreateObject...
bankObjects[1] = CreateObject...
bankObjects[2] = CreateObject...
bankObjects[3] = CreateObject...
bankObjects[4] = CreateObject...
bankObjects[5] = CreateObject...
bankObjects[6] = CreateObject...
return 1;
}
public OnPlayerConnect(playerid)
{
//This will run the function BankCheck every 2 seconds
bankCheck[playerid] = SetTimerEx("BankCheck", 2000, 1, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(bankCheck[playerid]);
return 1;
}
public BankCheck(playerid)
{
//Is player near the keyboard, add your own coords
if(IsPlayerInRangeOfPoint(playerid, 3, 0.0, 0.0, 0.0)
{
//Move the first pillar...
MoveObject(bankObjects[0]...);
}
else
{
//Move all the objects back to their normal position
}
return 1;
}
public OnObjectMoved(objectid)
{
//This will move the objects one after another
if(objectid == bankObjects[0])
{
MoveObject(bankObjects[1]...);
}
else if(objectid == bankObjects[1])
{
MoveObject(bankObjects[2]...);
}
else if(objectid == bankObjects[2])
{
MoveObject(bankObjects[3]...);
}
else if(objectid == bankObjects[3])
{
MoveObject(bankObjects[4]...);
}
else if(objectid == bankObjects[4])
{
MoveObject(bankObjects[5]...);
}
else if(objectid == bankObjects[5])
{
MoveObject(bankObjects[6]...);
}
return 1;
}