15.12.2014, 07:29
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;
}