Strange, Weird bug regarding text's/pickups.
#1

The pickup you can see below is a Faction Pickup: It shouldn't display the code here but only on the houses...


It seems to be executing this code:

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new string[256];

    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(pickupid == HousePickup[i])
        {
            if(!(strcmp(HouseOwner[i], "nobody", true)))
            {
                format(string, sizeof(string), "~r~For Sale : %s~n~~w~Price: $%d~n~~b~Type '/buyhouse' to purchase.", HouseName[i], HousePrice[i]);
            }
            else
            {
                format(string, sizeof(string), "Address: %s ~n~ Owner: %s", HouseName[i], HouseOwner[i]);
            }

            GameTextForPlayer(playerid, string, 3000, 5);
            break;
        }
    }
    return 1;
}
Can someone help and explain why this is happening?
Reply
#2

'pickupid' seems to be 'HousePickup[i]' - are you sure they are not colliding and that the HousePickup array is holding the correct data?
Reply
#3

They don't collide and yes, because it loads all of the house pickups and game text: Here is the code for both of them under LoadFactions and LoadHouses.

pawn Код:
FactionPickup[y] = CreatePickup(1318, 23, FactionEntX[y], FactionEntY[y], FactionEntZ[y], 0);
pawn Код:
HousePickup[x] = CreatePickup(1273, 23, HouseEntX[x], HouseEntY[x], HouseEntZ[x], 0);
Reply
#4

Bump.
Reply
#5

A temporary work around:
- Loop through all houses, and check if the player is in range of the specific point the pickup ID is referring too.

I seem to remember reading somewhere that sometimes CreatePickup ID's sometimes mis-match and/or return the wrong ID. In all of my scripts I use OnPlayerPickUpPickup to trigger a Loop + IsPlayerInRangeOfPoint search for the right data.

Off Topic: I'm sure I replied to your post (before the bump).
Reply
#6

Thanks very much, I'll give it a try.
Reply
#7

Alright, I put this: Is this what you meant?
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    new string[256];

    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, HousePickup[i], HousePickup[i], HousePickup[i]))
        {
            if(pickupid == HousePickup[i])
            {
                if(!(strcmp(HouseOwner[i], "nobody", true)))
                {
                    format(string, sizeof(string), "~r~For Sale : %s~n~~w~Price: $%d~n~~b~Type '/buyhouse' to purchase.", HouseName[i], HousePrice[i]);
                }
                else
                {
                    format(string, sizeof(string), "Address: %s ~n~ Owner: %s", HouseName[i], HouseOwner[i]);
                }

                GameTextForPlayer(playerid, string, 3000, 5);
                break;
            }
Reply
#8

That should work
Checking if they're in range of it will only allow that pickup (ID) to work in a certain radius - however the actual radius won't matter because they have to pick up the pickup to fire the callback anyway.
Reply
#9

It Doesnt work :/ I'll try something else but I can't guarantee :/

I'll keep you updated!

If I manage to fix it i'll + rep you

EDIT: It's working!! + rep, thank you!
Reply
#10

Good - Anytime
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)