22.06.2015, 04:06
I already gave you the key, use OnObjectMoved.
In order to detect the airdrop id, you may notice that i return the index in CreateAirdrop. SO in order to detect the locations from ids, you can make vars for airdrops and use them in callback.
For example we are creating airdrop in BigEar.
Now create your airdrop anywhere like this:
Now in order to detect the airdrop has landed on the ground, use this:
In order to detect the airdrop id, you may notice that i return the index in CreateAirdrop. SO in order to detect the locations from ids, you can make vars for airdrops and use them in callback.
For example we are creating airdrop in BigEar.
pawn Код:
new Airdrop_BigEar;
pawn Код:
Airdrop_BigEar = CreateAirdrop(...);
pawn Код:
public OnObjectMoved(objectid)
{
//looping through all airdrops
for(new i; i < MAX_AIRDROPS; i++)
{
//if the airdrop slot is occupied
//i.e. the airdrop exists
if(gAirdrop[i][a_exist])
{
//if the object id is that of airdrop
if(objectid == gAirdrop[i][a_object])
{
if(i == Airdrop_BigEar)
{
SendClientMessageToAll(-1, "Airdroped at BigEar");
}
//from now the airdrop is on the ground and players can pick it
gAirdrop[i][a_droped] = true;
//start a timer after which the airdrop will be destroyed
//the interval here is 1 minute (60000 ms), You may use a custom value if you wish
gAirdrop[i][a_expire_timer] = SetTimerEx("OnAirdropExpire", (60 * 1000), false, "i", i);
}
}
}
return 1;
}