GetPickupPos Extended
#10

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;
}
Reply


Messages In This Thread
[SOLVED]GetPickupPos Extended - by gurmani11 - 11.10.2014, 10:36
Re: GetPickupPos Extended - by austin070 - 11.10.2014, 11:11
Re: GetPickupPos Extended - by gurmani11 - 11.10.2014, 11:12
Re: GetPickupPos Extended - by austin070 - 11.10.2014, 11:14
Re: GetPickupPos Extended - by gurmani11 - 11.10.2014, 11:39
Re: GetPickupPos Extended - by Pottus - 11.10.2014, 12:47
Re: GetPickupPos Extended - by gurmani11 - 11.10.2014, 14:03
Re: GetPickupPos Extended - by Pottus - 11.10.2014, 14:46
Re: GetPickupPos Extended - by gurmani11 - 11.10.2014, 15:10
Re: GetPickupPos Extended - by Pottus - 11.10.2014, 15:26

Forum Jump:


Users browsing this thread: 4 Guest(s)