Create Gift Pickups OnPlayerDeath
#10

Or alternatively, you could just make the pickup for each time a player is killed.

pawn Код:
new GiftPickup[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        if(GiftPickup[playerid] != -1)
        {
            DestroyPickup(GiftPickup[playerid]);
            GiftPickup[playerid] = -1;
        }
        GiftPickup[playerid] = CreatePickup(19054, 8, X, Y, Z, 0);
    }
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == GiftPickup[playerid]) return SendClientMessage(playerid, -1, "You cannot pickup the Gift that you dropped.");
    for(new i = 0; i < MAX_PLAYERS; i++) //Foreach is a better alternative.
    {
        if(!IsPlayerConnected(i) || i == playerid) continue; //Remove this line if using Foreach.
        if(pickupid != GiftPickup[i]) continue;
        //At this point, the player has picked up a Gift dropped by a player.
        SendClientMessage(playerid, -1, "You have picked up a Gift!");
        DestroyPickup(GiftPickup[i]);
        GiftPickup[i] = -1;
        break;
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(GiftPickup[playerid] != -1)
    {
        DestroyPickup(GiftPickup[playerid]);
        GiftPickup[playerid] = -1;
    }
    return 1;
}
Reply


Messages In This Thread
Create Gift Pickups OnPlayerDeath - by danish007 - 14.12.2014, 19:36
Re: Create Gift Pickups OnPlayerDeath - by MD5 - 14.12.2014, 19:38
Re: Create Gift Pickups OnPlayerDeath - by danish007 - 14.12.2014, 19:41
Re: Create Gift Pickups OnPlayerDeath - by danish007 - 14.12.2014, 19:58
Re: Create Gift Pickups OnPlayerDeath - by mahdi499 - 14.12.2014, 20:21
Re: Create Gift Pickups OnPlayerDeath - by danish007 - 14.12.2014, 20:34
Re: Create Gift Pickups OnPlayerDeath - by danish007 - 15.12.2014, 06:16
Re: Create Gift Pickups OnPlayerDeath - by Divergent - 15.12.2014, 06:20
Re: Create Gift Pickups OnPlayerDeath - by rickisme - 15.12.2014, 06:37
Re: Create Gift Pickups OnPlayerDeath - by Threshold - 15.12.2014, 07:29

Forum Jump:


Users browsing this thread: 3 Guest(s)