11.10.2014, 15:26
If your using YSI try it like this then.
pawn Код:
#include <YSI\y_hooks>
#define MAX_PICKUP_ARRAY 4096
#define PICKUP_BOUNDS(%0); if(%0 < 0 || %0 >= MAX_PICKUP_ARRAY) { \
print("Pickup Index out of bounds"); \
return -1;
enum PICKUPINFO
{
gPickupID,
gPickupType,
gPickupModel,
gPickupVW,
Float:gPickupX,
Float:gPickupY,
Float:gPickupZ,
}
static PickupData[MAX_PICKUP_ARRAY][PICKUPINFO];
hook OnGameModeInit()
{
for(new i = 0; i < MAX_PICKUP_ARRAY; i++) PickupData[i][gPickupID] = -1;
return 1;
}
stock AddPickup(model, type, Float:x, Float:y, Float:z, vw)
{
for(new i = 0; i < MAX_PICKUP_ARRAY; i++)
{
if(PickupData[i][gPickupID] == -1)
{
PickupData[i][gPickupID] = CreatePickup(model, type, x, y, z, vw);
PickupData[i][gPickupType] = type;
PickupData[i][gPickupModel] = model;
PickupData[i][gPickupVW] = vw;
PickupData[i][gPickupX] = x
PickupData[i][gPickupY] = y
PickupData[i][gPickupZ] = z'
return i;
}
}
printf("AddPickup::Too many pickups");
return -1;
}
stock DeletePickup(index)
{
PICKUP_BOUNDS(index);
if(PickupData[index][gPickupID] > -1)
{
DestroyPickup(PickupData[index][gPickupID]);
PickupData[index][gPickupID] = -1;
}
printf("DeletePickup::Pickup does not exist");
return 0;
}
stock GetPickupPos(index, &Float:x, &Float:y, &Float:z)
{
PICKUP_BOUNDS(index);
if(PickupData[index][gPickupID] > -1)
{
x = PickupData[index][gPickupX];
y = PickupData[index][gPickupY];
z = PickupData[index][gPickupZ];
return 1;
}
printf("GetPickupPos::Pickup does not exist");
return 0;
}
stock GetPickupVW(index)
{
PICKUP_BOUNDS(index);
if(PickupData[index][gPickupID] > -1) return PickupData[index][gPickupVW]
printf("GetPickupVW::Pickup does not exist");
return -1;
}
stock GetPickupID(index)
{
PICKUP_BOUNDS(index);
if(PickupData[index][gPickupID] > -1) return PickupData[index][gPickupID]
printf("GetPickupID::Pickup does not exist");
return -1;
}
stock GetPickupModel(index)
{
PICKUP_BOUNDS(index);
if(PickupData[index][gPickupID] > -1) return PickupData[index][gPickupModel]
printf("GetPickupModel::Pickup does not exist");
return -1;
}
stock GetPickupType(index)
{
PICKUP_BOUNDS(index);
if(PickupData[index][gPickupID] > -1) return PickupData[index][gPickupType]
printf("GetPickupType::Pickup does not exist");
return -1;
}
CMD:testpickup(playerid, arg[])
{
new index = AddPickup(3337, 1, 1.0, 2.0, 3.0, 10);
new Float:x, Float:y, Float:z, vw, id, model, type;
GetPickupPos(index, x, y, z);
vw = GetPickupVW(index);
id = GetPickupID(index);
model = GetPickupModel(index);
type = GetPickupType(index);
printf("Pos:%f,%f,%f vw: %i id: %i Model: %i Type: %i", x, y, z, vw, id, model, type);
return 1;
}