[Tutorial] How to make Airdrop system? (using Mapandreas)
#5

Aborting an airdrop isn't very realistic, how come a player swallow the drop by pressing a key!

And that command /pickairdrop can very easily be made from OnPlayerKeyStateChange.
Here is the snippet:
pawn Код:
CMD:pickairdrop(playerid)
{
        //the player will be not allowed to pickup the airdrop while in a vehicle
        if(! IsPlayerInAnyVehicle(playerid))
        {
            //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 airdrop is on the ground, dropped
                    if(gAirdrop[i][a_droped])
                    {
                        //now using 'IsPlayerInRangeOfPoint', we will check if the player is near that airdrop
                        //The range is 5.0 and resonably fine. You may increase or decrease it if you wish
                        if(IsPlayerInRangeOfPoint(playerid, 5.0, gAirdrop[i][a_pos][0], gAirdrop[i][a_pos][1], gAirdrop[i][a_pos][2]))
                        {
                            //if the player is near the drop...

                            //We will apply a picking animation just for realisticity :)
                            ApplyAnimation(playerid, "MISC", "pickup_box", 1.0, 1, 1, 1, 1, 0);

                            //the gametext showing the player is picking the drop
                            GameTextForPlayer(playerid, "~b~~h~~h~~h~Picking...", 2000, 3);

                            //now we will make a timer to destroy the airdrop after 2 seconds
                            //the anim will be ovver by then
                            KillTimer(gAirdrop[i][a_expire_timer]);
                            gAirdrop[i][a_expire_timer] = SetTimerEx("OnPlayerPickupAirdrop", 2000, false, "ii", playerid, i);
                            gAirdrop[i][a_droped] = false;

                            //break the loop
                            break;
                        }
                    }
                }
            }
        }
        return 1;
}
And the message can be easily displayed when the airdrop is dropped on the ground, i.e. use SendClientMessage or anything else to notify players in OnObjectMoved.
Reply


Messages In This Thread
How to make Airdrop system? (using Mapandreas) - by Gammix - 08.06.2015, 17:14
Re: How to make Airdrop system? (using Mapandreas) - by Excel™ - 09.06.2015, 15:56
Re: How to make Airdrop system? (using Mapandreas) - by Q_Lite - 12.06.2015, 08:47
Re: How to make Airdrop system? (using Mapandreas) - by justice96 - 21.06.2015, 15:30
Re: How to make Airdrop system? (using Mapandreas) - by Gammix - 21.06.2015, 16:26
Re: How to make Airdrop system? (using Mapandreas) - by justice96 - 21.06.2015, 16:36
Re: How to make Airdrop system? (using Mapandreas) - by Gammix - 22.06.2015, 04:06
Re: How to make Airdrop system? (using Mapandreas) - by justice96 - 22.06.2015, 04:15
Re: How to make Airdrop system? (using Mapandreas) - by Gammix - 22.06.2015, 07:15
Re: How to make Airdrop system? (using Mapandreas) - by justice96 - 22.06.2015, 07:18
Re: How to make Airdrop system? (using Mapandreas) - by $$inSane - 10.07.2015, 12:07

Forum Jump:


Users browsing this thread: 1 Guest(s)