28.10.2013, 20:37
Top
OnGameModeInit
Somewhere
If you don't need virtualworld just remove that array
pawn Код:
#define MAX_PICKUPS_IN_ENUM 2
enum pickups
{
pModel,
Float:pX,
Float:pY,
Float:pZ,
pWorld
};
new PickupIDS[MAX_PICKUPS_IN_ENUM][pickups] =
{
{pickup_model, X, Y, Z, VirtualWorld},
// {...}, next
{pickup_model, X, Y, Z, VirtualWorld}
};
new PickupID[2];
@RespawnPickup(pickupid,picked);
@RespawnPickup(pickupid,picked)
{
DestroyPickup(pickupid);
CreatePickup(PickupIDS[picked][pModel], 1, PickupIDS[picked][pX], PickupIDS[picked][pY], PickupIDS[picked][pZ], PickupIDS[picked][pWorld]);
return 1;
}
pawn Код:
for(new i=0; i != MAX_PICKUPS_IN_ENUM; i++)
PickupID[!!i] = CreatePickup(PickupIDS[i][pModel], 1, PickupIDS[i][pX], PickupIDS[i][pY], PickupIDS[i][pZ], PickupIDS[i][pWorld]);
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(PickupID[0] <= pickupid <= PickupID[1])
{
DestroyPickup(pickupid);
new Pick = pickupid - PickupID[0];
CreatePickup(PickupIDS[Pick][pModel], 1, PickupIDS[Pick][pX], PickupIDS[Pick][pY], PickupIDS[Pick][pZ], 1000);
SetTimerEx("@RespawnPickup", 20000, false, "ii", pickupid, Pick);
return 1;
}
return 0;
}