problem with pickup IDs
#1

Hey all! I got a problem with my pickups IDs. I have a variable in which I store ID of the pickup for a gift. So when anyone walks through that pickup, it gives him something and then the pickup is deleted. But when I start my server, first pickup that is created is bugged. It has ID 0, and it shows completely different text that it should show.
pawn Код:
EnterExitPU[7] = CreatePickup(1239, 1,-2571.4, 318.3, 10.6); // this pickup is for buying weed seeds

public OnPlayerPickUpPickup(playerid, pickupid)
{
// here are many other pickups stored in EnterExitPU array
if(pickupid == EnterExitPU[7])
        {
            GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~y~/buyseeds",1000, 3);
                // I dont see this text, which I should
        }
for(new i=0;i<11;i++)
    {
        if(pickupid == ATMPickup[i])
        {
// I see this text, which is for one of the ATM pickups placed somewhere in the town, and also, ATM pickups are created later on, so they got larger ID than previous pickups
            GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~g~/atm",1000, 3);
            return 1;
        }
    }
return 1;
}
Does anyone know why are my pickup IDs messed up? And one more thing, does CreatePickup creates a pickup with starting number of 1, or is it 0? Thank you
Reply
#2

You messed up your id's somewhere, backtrack them.

useally functions start counting with 0 for default but you can define differently but i dont reccomend it.

goodluck!
Reply
#3

hmm okay. So I should do this:
Код:
new gift; // variable which contains pickups id
// under OnGameModeInit
gift = -1;
since the gift hasn't been spawned, it should be -1
would that be okay? I think gift pickup shouldn't mess up other IDs if it's been set to -1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)