Set a timer for robbery anims.
#4

You can use SetPlayerAttachedObject to attach any object to the player and use it to attach the bag to the player when the robbery starts.

On the same time, create the box using CreateObject. The object id must be stored in a var or array, use a player array.
For example:
pawn Код:
new RoberyObject[MAX_PLAYERS];
Declare a timer using SetTimerEx. For example:
pawn Код:
SetTimerEx("OnRoberyComplete", 30 * 1000, false, "i", playerid);
Make sure you have all the required arguments in the timer.

So when the robery starts (in your script):
pawn Код:
RoberyObject[playerid] = CreateObject(...);
SetPlayerAttachedObject(..);

SetTimerEx("OnRoberyComplete", 30 * 1000, false, "i", playerid);
Now destroy the box object and the attached object from the player whenever the robbery ends (after 30 secs)
pawn Код:
forward OnRoberyComplete(playerid);
public OnRoberyComplete(playerid)
{
    RemovePlayerAttachedObject(playerid, 0);
    DestroyObject(RoberyObjecy[playerid]);
}
Note the index in RemovePlayerAttachedObject is 0, you can set it to other value provided the object was attached to that slot.
Reply


Messages In This Thread
Set a timer for robbery anims. - by STONEGOLD - 18.06.2015, 04:38
Re: Set a timer for robbery anims. - by STONEGOLD - 18.06.2015, 04:49
Re: Set a timer for robbery anims. - by STONEGOLD - 18.06.2015, 05:34
Re: Set a timer for robbery anims. - by Gammix - 18.06.2015, 05:47
Re: Set a timer for robbery anims. - by STONEGOLD - 18.06.2015, 06:07
Re: Set a timer for robbery anims. - by J0sh... - 18.06.2015, 06:12
Re: Set a timer for robbery anims. - by STONEGOLD - 18.06.2015, 06:29

Forum Jump:


Users browsing this thread: 2 Guest(s)